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