From fb9b352db36cada2debe4b98fd1badb0f14161af Mon Sep 17 00:00:00 2001 From: ClairePeta Date: Fri, 1 Nov 2019 18:49:46 +1100 Subject: [PATCH] Small changes i had here and ones i made to try and fix an error --- Assets/Prefabs/Traps/ShootingCannon.prefab | 11 ++++----- Assets/Scenes/Levels/RaceTrack Beta.unity | 4 ++-- Assets/Scenes/Menus/Lobby.unity | 4 ++-- Assets/Scenes/Menus/MenuBackground.unity | 4 ++-- Assets/Scripts/Browser/SimpleHttpsServer.cs | 4 ++-- Assets/Scripts/Character.cs | 25 ++++++++++++++++----- Assets/Scripts/Managers/GameManager.cs | 6 +++-- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Assets/Prefabs/Traps/ShootingCannon.prefab b/Assets/Prefabs/Traps/ShootingCannon.prefab index 238ac57..983c898 100644 --- a/Assets/Prefabs/Traps/ShootingCannon.prefab +++ b/Assets/Prefabs/Traps/ShootingCannon.prefab @@ -462,7 +462,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: VisualOffset: {x: 0, y: 0, z: 0} - is_Walkable: 1 + is_Walkable: 0 isWater: 0 isPit: 0 isCrystals: 0 @@ -476,6 +476,7 @@ MonoBehaviour: spawnLocation: {fileID: 4411312180479633393} counter: {fileID: 1907555563} counter2: {fileID: 1967023221621108560} + countdown: 3 --- !u!65 &7713460145294617833 BoxCollider: m_ObjectHideFlags: 0 @@ -559,6 +560,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 4407065910963968002} m_Modifications: + - target: {fileID: 1229707520659320, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3} + propertyPath: m_Name + value: Cube_BalkHalf + objectReference: {fileID: 0} - target: {fileID: 4831352554563246, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -615,10 +620,6 @@ PrefabInstance: propertyPath: m_LocalScale.z value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 1229707520659320, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3} - propertyPath: m_Name - value: Cube_BalkHalf - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3} --- !u!1 &4408273554855513639 stripped diff --git a/Assets/Scenes/Levels/RaceTrack Beta.unity b/Assets/Scenes/Levels/RaceTrack Beta.unity index 30607a3..b5ae32c 100644 --- a/Assets/Scenes/Levels/RaceTrack Beta.unity +++ b/Assets/Scenes/Levels/RaceTrack Beta.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d55c679cbf4a61b8fd1bd247cca637c9a4f56d3105ba39284d86dd4e68002b8 -size 40997 +oid sha256:e4a9d3dc6e2016e26aa37189520722a0c9135abaff35df3fd2f0a0a7d39e7d46 +size 43113 diff --git a/Assets/Scenes/Menus/Lobby.unity b/Assets/Scenes/Menus/Lobby.unity index 2d2f674..1d5e312 100644 --- a/Assets/Scenes/Menus/Lobby.unity +++ b/Assets/Scenes/Menus/Lobby.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:522af36cedf7538607021871c5d833031446e7f40e07626f5e059e0d323ceb9e -size 46401 +oid sha256:5c4afffd8a2251baa7b0ef9701d4ca5e046a6d10dfe8247ccc07245fcf6c5340 +size 46417 diff --git a/Assets/Scenes/Menus/MenuBackground.unity b/Assets/Scenes/Menus/MenuBackground.unity index de6a5be..45b2cf4 100644 --- a/Assets/Scenes/Menus/MenuBackground.unity +++ b/Assets/Scenes/Menus/MenuBackground.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:938028e3e34d6913220202dea3966b1045ee47ce508d2fdff1f3418cfaf0801c -size 2851355 +oid sha256:83f4e9ca94f66f8f8b6bbdcd56c40e38f2c9ab33b83c2c76db852129c62ace9d +size 2851361 diff --git a/Assets/Scripts/Browser/SimpleHttpsServer.cs b/Assets/Scripts/Browser/SimpleHttpsServer.cs index 581460b..a37bf34 100644 --- a/Assets/Scripts/Browser/SimpleHttpsServer.cs +++ b/Assets/Scripts/Browser/SimpleHttpsServer.cs @@ -172,7 +172,7 @@ class SimpleHTTPServer filename = Path.Combine(_rootDirectory, filename); - UnityEngine.Debug.Log("Client wants:" + filename); + //UnityEngine.Debug.Log("Client wants:" + filename); if (File.Exists(filename)) { @@ -202,7 +202,7 @@ class SimpleHTTPServer Stream st = context.Response.OutputStream; st.Write(bytes, 0, bytes.Length); - UnityEngine.Debug.Log("Sent"); + //UnityEngine.Debug.Log("Sent"); } catch (Exception ex) { diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 6311077..dc21d0d 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -205,23 +205,36 @@ public class Character : MonoBehaviour { respawnCharacter(CurrentBlock); } - + public void respawnCharacter(Block respawnPosition) { //Having found our target block, we move the character there if (respawnPosition != null) { - this.transform.position = new Vector3(respawnPosition.VisualPosition.x, 0.5f, respawnPosition.VisualPosition.z); - this.respawnNeeded = false; - this._currentBlock = respawnPosition; - respawnPosition.CurrentPlayer = this; - this.stuck = false; + if(ClientLink.Lives > 0) + { + this.transform.position = new Vector3(respawnPosition.VisualPosition.x, 0.5f, respawnPosition.VisualPosition.z); + this.respawnNeeded = false; + this._currentBlock = respawnPosition; + respawnPosition.CurrentPlayer = this; + this.stuck = false; + } + else + { + this.transform.position = new Vector3(-50, 0.5f, 0); + this.respawnNeeded = false; + this._currentBlock = respawnPosition; + respawnPosition.CurrentPlayer = this; + this.stuck = false; + } + } else { //Debug.Log("Failed to find anywhere to put " + this.name); } } + /// /// Upon collision with a floating block, collect its diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index d868c05..8d45d98 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -198,10 +198,12 @@ public class GameManager : MonoBehaviour } } - playerData = playerData.OrderBy(unit => unit.Value.character.CurrentBlock.transform.position.x).ToDictionary(unit => unit.Key, unit => unit.Value); + //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 sortedPlayers = filteredPlayers.OrderBy(p => p.Value.character.CurrentBlock.transform.position.x).ToDictionary(unit => unit.Key, unit => unit.Value); + int order = 1; - foreach (PlayerData data in filteredPlayers.Values) + foreach (PlayerData data in sortedPlayers.Values) { data.character.runOrder = order; order++;