This commit is contained in:
RochesterX
2025-03-31 18:28:05 -04:00
parent edec31d700
commit 5a8de32de0
14 changed files with 1241 additions and 445 deletions

View File

@@ -100,6 +100,7 @@ public class GameManager : MonoBehaviour
foreach (GameObject player in players)
{
player.transform.position = spawnPosition;
player.GetComponent<Damageable>().lives = 0;
}
}
}
@@ -168,7 +169,7 @@ public class GameManager : MonoBehaviour
if (gameMode == GameMode.keepAway) // Player with the most time holding the hat wins
{
GameObject winner = null;
float maxHoldTime = 0f;
float maxHoldTime = -1f;
foreach (var player in GameManager.playerHoldTimes)
{
if (player.Value > maxHoldTime)
@@ -185,6 +186,15 @@ public class GameManager : MonoBehaviour
FindFirstObjectByType<LifeDisplayManager>().HideLifeDisplay();
}
}
if (gameMode == GameMode.obstacleCourse)
{
GameObject winner = ObstacleCourse.playerWon;
print(winner.name + " is the winner!");
FindFirstObjectByType<PlayerCameraMovement>().WinScene(winner);
WinScreen.Instance.ShowWinScreen(players.IndexOf(winner) + 1);
FindFirstObjectByType<LifeDisplayManager>().HideLifeDisplay();
}
}
public List<GameObject> AlivePlayers() // Returns a list of all players that are alive

View File

@@ -3,7 +3,7 @@ using UnityEngine;
public class HatRespawn : MonoBehaviour
{
private float lastInteractionTime;
private const float respawnTime = 10f;
public const float respawnTime = 10f;
private bool isDropped;
public static bool canBePickedUp = true; // Flag to check if the hat can be picked up

View File

@@ -0,0 +1,23 @@
using UnityEngine;
[ExecuteAlways]
public class GameManagerHelper : MonoBehaviour
{
public bool addHatPosition;
public bool addSpawnPosition;
private void Update()
{
if (addHatPosition)
{
addHatPosition = false;
GetComponent<GameManager>().hatSpawnPositions.Add(GameObject.Find("HELPER").transform.position);
}
if (addSpawnPosition)
{
addSpawnPosition = false;
GetComponent<GameManager>().spawnPosition = GameObject.Find("HELPER").transform.position;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4c35a13ba94b04f19a6ee30e6fe34327