Test
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
23
Assets/Scripts/GameManagerHelper.cs
Normal file
23
Assets/Scripts/GameManagerHelper.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/GameManagerHelper.cs.meta
Normal file
2
Assets/Scripts/GameManagerHelper.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c35a13ba94b04f19a6ee30e6fe34327
|
||||
Reference in New Issue
Block a user