// Camera Logic public Vector3 GetLeader() { if (players.Count == 1 && !practice) { Finish(); } Whaleburt whaleburt = players[0]; foreach (Whaleburt player in players) { if (whaleburt == null && player != null) { whaleburt = player; } if (player != null && whaleburt != null && player.transform.position.z > whaleburt.transform.position.z) { whaleburt = player; } } return(whaleburt.transform.position); }
public void Awake() { for (int i = 0; i < numberOfPlayers; i++) { GameObject newplayer = Instantiate(Whaleburt, Vector3.zero, Quaternion.identity); newplayer.transform.rotation = Quaternion.Euler(8.6f, 0, 0); newplayer.name = "Player_" + i; Whaleburt temp = newplayer.GetComponent <Whaleburt>(); players.Add(temp); temp.hatBehavior.GenerateRandomHat(); } for (int i = 0; i < numberOfBots; i++) { GameObject newplayer = Instantiate(Whaleburt, Vector3.zero, Quaternion.identity); newplayer.transform.rotation = Quaternion.Euler(8.6f, 0, 0); newplayer.name = "Player_" + i; Whaleburt temp = newplayer.GetComponent <Whaleburt>(); players.Add(temp); temp.hatBehavior.GenerateRandomHat(); temp.IsBot(); } instance = this; }