|
@ -33,6 +33,7 @@ public class GameManager : MonoBehaviour |
|
|
|
|
|
|
|
|
#region Private Variables
|
|
|
#region Private Variables
|
|
|
private Dictionary<int, PlayerData> playerData; |
|
|
private Dictionary<int, PlayerData> playerData; |
|
|
|
|
|
private List<ActiveBlock> activeBlocks; |
|
|
#endregion Private Variables
|
|
|
#endregion Private Variables
|
|
|
|
|
|
|
|
|
#region Read Only
|
|
|
#region Read Only
|
|
@ -51,7 +52,9 @@ public class GameManager : MonoBehaviour |
|
|
|
|
|
|
|
|
private void Start() |
|
|
private void Start() |
|
|
{ |
|
|
{ |
|
|
//Start Game
|
|
|
|
|
|
|
|
|
//Find all active blocks
|
|
|
|
|
|
//#TODO don't use the find function
|
|
|
|
|
|
activeBlocks = FindObjectsOfType<ActiveBlock>().ToList(); |
|
|
StartCoroutine(GameRoutine()); |
|
|
StartCoroutine(GameRoutine()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -119,6 +122,11 @@ public class GameManager : MonoBehaviour |
|
|
|
|
|
|
|
|
//Let Gamemode know all players have moved
|
|
|
//Let Gamemode know all players have moved
|
|
|
gameMode.AllPlayersMoved(playerDataAsArray.ToArray()); |
|
|
gameMode.AllPlayersMoved(playerDataAsArray.ToArray()); |
|
|
|
|
|
|
|
|
|
|
|
//Tell each environment block to take a move
|
|
|
|
|
|
activeBlocks.ForEach(p => p.OnEnvironmentTurn(playerDataAsArray)); |
|
|
|
|
|
gameMode.EnvironmentTurn(playerDataAsArray); |
|
|
|
|
|
|
|
|
playerDataAsArray.ForEach(p => p.client.SendScore()); //Update the players score
|
|
|
playerDataAsArray.ForEach(p => p.client.SendScore()); //Update the players score
|
|
|
|
|
|
|
|
|
//if Game is over break out of loop
|
|
|
//if Game is over break out of loop
|
|
|