diff --git a/Assets/Scenes/Menus/MainMenu Server.unity b/Assets/Scenes/Menus/MainMenu Server.unity index 5ef3d8a..152d04e 100644 --- a/Assets/Scenes/Menus/MainMenu Server.unity +++ b/Assets/Scenes/Menus/MainMenu Server.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81882783cf5a376883ed9ca4f106b45f430a5c9af5cefe8480283c39fe2b3c41 -size 145896 +oid sha256:be1fecc5293999a37beabc3563e41990e6d8d9f9dadd8ba50c057c8342875a49 +size 145925 diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 3040d70..6311077 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -20,7 +20,7 @@ public class Character : MonoBehaviour public bool stuck = false; //Am I still stuck? public bool justMoved = false; //Was the logic block I just executed a move command? public bool inPit = false; - Vector3 death = new Vector3(9999, 0, 0); + Vector3 death = new Vector3(-50, 0, 0); #region Inspector Fields [SerializeField] @@ -77,7 +77,7 @@ public class Character : MonoBehaviour } private void Update() { - if(lives < 1) + if(ClientLink.Lives < 1) { this.transform.position = death; } diff --git a/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs b/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs index 3b0cb5e..025d9f3 100644 --- a/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs +++ b/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs @@ -330,57 +330,6 @@ public class RacetrackGameMode : GameMode protected override void OnPlayerMoved(Character character, ClientData client, Block currentBlock) { handleFalling(character, client, currentBlock, character.justMoved); - - /*Debug.Log("Moved to square at " + currentBlock.transform.position.x + ", " - + currentBlock.transform.position.y + ", " - + currentBlock.transform.position.z); - - //If a character has fallen in the water or into a pit, we mark that fact, and they lose the rest of their turn - character.inWater = currentBlock.isWater; - character.respawnNeeded = currentBlock.isPit; - - if (character.inWater == true || character.respawnNeeded == true) - { - character.stuck = true; - } - - Debug.Log("inWater = " + character.inWater + ", respawnNeeded = " + character.respawnNeeded + ", stuck = " + character.stuck);*/ - - //Commented out because we don't do this in the racetrack mode - - /*ClientData OwnedClient; - Material overlay = null; - if (isOwned(currentBlock, out OwnedClient)) - { - if (OwnedClient == client) - return; - - BlocksOwned[OwnedClient].Remove(currentBlock); - - foreach (Material mat in currentBlock.GetComponent().materials) - { - if (mat.name == OverlayMaterial.name + " (Instance)") - overlay = mat; - } - } - - if (overlay == null) - { - overlay = new Material(OverlayMaterial); - List mats = new List(currentBlock.GetComponent().materials); - mats.Add(overlay); - currentBlock.GetComponent().materials = mats.ToArray(); - } - - overlay.SetColor("_NewColor", client.Color); - - if (!BlocksOwned.ContainsKey(client)) - BlocksOwned.Add(client, new List()); - - BlocksOwned[client].Add(currentBlock); - - if (overlay != null) - currentBlock.StartCoroutine(AnimateBlock(overlay, 0.25f));*/ } protected override void OnRoundStart(PlayerData[] allPlayers) @@ -397,11 +346,6 @@ public class RacetrackGameMode : GameMode * It's not needed from move to move, so we clear it */ player.character.justMoved = false; - - /* if (BlocksOwned.ContainsKey(player.client)) - player.client.SceneScore = BlocksOwned[player.client].Count; - else - player.client.SceneScore = 0;*/ } } @@ -438,7 +382,6 @@ public class RacetrackGameMode : GameMode { character.stuck = true; } - //Debug.Log("inWater = " + character.inWater + ", respawnNeeded = " + character.respawnNeeded + ", stuck = " + character.stuck); } protected override void OnPlayerKilled(Character character, ClientData client) diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index d6bbbcb..d868c05 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -83,6 +83,15 @@ public class GameManager : MonoBehaviour playerDataAsArray.ForEach(p => p.client.SendLives()); gameMode.GameStart(playerDataAsArray); + playerData = playerData.OrderBy(unit => unit.Value.character.CurrentBlock.transform.position.x).ToDictionary(unit => unit.Key, unit => unit.Value); + Dictionary filteredPlayers = playerData.Where(p => !p.Value.isDead).ToDictionary(unit => unit.Key, unit => unit.Value); + int order = 1; + foreach (PlayerData data in filteredPlayers.Values) + { + data.character.runOrder = order; + order++; + } + //Loop until the GameMode lets us know the game is over while (!gameMode.isGameOver(playerDataAsArray)) { @@ -190,9 +199,9 @@ public class GameManager : MonoBehaviour } playerData = playerData.OrderBy(unit => unit.Value.character.CurrentBlock.transform.position.x).ToDictionary(unit => unit.Key, unit => unit.Value); - //Dictionary filteredPlayers = playerData.Where(p => !p.Value.isDead).ToDictionary(unit => unit.Key, unit => unit.Value); + Dictionary filteredPlayers = playerData.Where(p => !p.Value.isDead).ToDictionary(unit => unit.Key, unit => unit.Value); int order = 1; - foreach (PlayerData data in playerDataAsArray) + foreach (PlayerData data in filteredPlayers.Values) { data.character.runOrder = order; order++;