From 50ac156d92adcfc2a9ac192da0f56df5b992036f Mon Sep 17 00:00:00 2001 From: Claire Peta Date: Fri, 20 Sep 2019 12:36:14 +1000 Subject: [PATCH] Forgot to push lafter class last night --- Assets/Data/Inventory/BaseInventory.asset | 2 +- Assets/Data/Logic Blocks/Wait.asset | 4 +- .../Traps/Conveyor Belt with Cube.prefab | 44 ++++++++++--------- .../Traps/ShootingCannon + Block.prefab | 14 +++--- Assets/Scenes/Client Scenes/LoginScreen.unity | 4 +- Assets/Scenes/Levels/RaceTrack Beta.unity | 4 +- Assets/Scenes/Menus/MainMenu Server.unity | 4 +- .../GameMode/ColorGameMode/ColorGameMode.cs | 5 +++ .../ColorGameMode/RacetrackGameMode.cs | 14 ++++-- Assets/Scripts/GameMode/GameMode.cs | 2 + Assets/Scripts/Logic/BlockReader.cs | 10 +++-- Assets/Scripts/Managers/GameManager.cs | 5 +++ Assets/Scripts/UI/LogicElementUI.cs | 10 ++++- 13 files changed, 78 insertions(+), 44 deletions(-) diff --git a/Assets/Data/Inventory/BaseInventory.asset b/Assets/Data/Inventory/BaseInventory.asset index f1655d2..e7da8f2 100644 --- a/Assets/Data/Inventory/BaseInventory.asset +++ b/Assets/Data/Inventory/BaseInventory.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:07fcd4acc0a169da62bb9e580f52c4c1002bb75840e34c8f645646d3101be1c7 +oid sha256:826ec5d0a327952a321ea2e04fd0bf0bb28619e1f6b1861a4765eddcec2019d6 size 1186 diff --git a/Assets/Data/Logic Blocks/Wait.asset b/Assets/Data/Logic Blocks/Wait.asset index 6bd6514..df98c17 100644 --- a/Assets/Data/Logic Blocks/Wait.asset +++ b/Assets/Data/Logic Blocks/Wait.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6475a06eeda44fd342624dfe1b8a353fcbb2e3fe56665c4747e00928f3d2f670 -size 574 +oid sha256:5b1381e41f5ac83abac527a3f5027da86df42fb91ca17392b26d58ab7c219bba +size 580 diff --git a/Assets/Prefabs/Traps/Conveyor Belt with Cube.prefab b/Assets/Prefabs/Traps/Conveyor Belt with Cube.prefab index 6463a37..4c01f65 100644 --- a/Assets/Prefabs/Traps/Conveyor Belt with Cube.prefab +++ b/Assets/Prefabs/Traps/Conveyor Belt with Cube.prefab @@ -45,11 +45,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6692f0c965cb4fa41b616ba0991653a3, type: 3} m_Name: m_EditorClassIdentifier: - clientData: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2} - Names: [] - left: 0 - forward: 0 - triggeranimate: 0 + VisualOffset: {x: 0, y: 0, z: 0} + is_Walkable: 1 + isWater: 0 + isPit: 0 + isSpawnable: 0 + SpawnDirection: 2 + Action: {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2} --- !u!1 &3424486742927057916 GameObject: m_ObjectHideFlags: 0 @@ -149,14 +151,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 4490968977809283} m_Modifications: - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_Name - value: Cube_GroundL - objectReference: {fileID: 0} - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -201,6 +195,14 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} + propertyPath: m_Name + value: Cube_GroundL + objectReference: {fileID: 0} + - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3} --- !u!1001 &816154313 @@ -210,14 +212,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 4490968977809283} m_Modifications: - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_Name - value: Cube_GroundU - objectReference: {fileID: 0} - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -262,6 +256,14 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} + propertyPath: m_Name + value: Cube_GroundU + objectReference: {fileID: 0} + - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3} --- !u!1001 &1100376119 diff --git a/Assets/Prefabs/Traps/ShootingCannon + Block.prefab b/Assets/Prefabs/Traps/ShootingCannon + Block.prefab index 481f092..1d6d7ce 100644 --- a/Assets/Prefabs/Traps/ShootingCannon + Block.prefab +++ b/Assets/Prefabs/Traps/ShootingCannon + Block.prefab @@ -254,13 +254,13 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7559508468311915786} - m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 0, z: 0.134} + m_LocalRotation: {x: -0, y: -0.8055902, z: -0, w: 0.5924732} + m_LocalPosition: {x: 0, y: 0, z: 0.166} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 6179448856766749153} m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -107.33501, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0.262, y: 1.321} @@ -339,7 +339,7 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_text: 5 + m_text: 3 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -367,8 +367,8 @@ MonoBehaviour: m_outlineColor: serializedVersion: 2 rgba: 4278190080 - m_fontSize: 3 - m_fontSizeBase: 3 + m_fontSize: 5 + m_fontSizeBase: 5 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -385,7 +385,7 @@ MonoBehaviour: m_enableWordWrapping: 1 m_wordWrappingRatios: 0.4 m_overflowMode: 0 - m_firstOverflowCharacterIndex: -1 + m_firstOverflowCharacterIndex: 0 m_linkedTextComponent: {fileID: 0} m_isLinkedTextComponent: 0 m_isTextTruncated: 0 diff --git a/Assets/Scenes/Client Scenes/LoginScreen.unity b/Assets/Scenes/Client Scenes/LoginScreen.unity index ea105c2..7c0bc97 100644 --- a/Assets/Scenes/Client Scenes/LoginScreen.unity +++ b/Assets/Scenes/Client Scenes/LoginScreen.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8db303555f2b5039989ee896f62f0d295bd6448dddc4bbe893977bd85a65d6ea -size 260334 +oid sha256:483604a02c8a92d1ac923e970b4e0bc203385ea51d6a516367cc39fc26648333 +size 260494 diff --git a/Assets/Scenes/Levels/RaceTrack Beta.unity b/Assets/Scenes/Levels/RaceTrack Beta.unity index 531e1a3..27bb9d1 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:8be6d12cb624b41bbec4263d925f0ff9c62f13f2a60df314dae7bfa3c3132aeb -size 33586 +oid sha256:dd7c1363d42eae1aa8086b72ecf7e2ed28f926aaaaa1fd5562c12d6d1fcb5edd +size 33424 diff --git a/Assets/Scenes/Menus/MainMenu Server.unity b/Assets/Scenes/Menus/MainMenu Server.unity index 24b72a0..b94ec80 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:159c761b5e6cd07723112cccb7f6cd3c7160f84327b1ca89967ad80b68a60404 -size 142635 +oid sha256:0b221d228eb4be8b6130a49b01f3b31a24e745acb7b73620669ce045b050af24 +size 142636 diff --git a/Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs b/Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs index 2a2708c..e5a9822 100644 --- a/Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs +++ b/Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs @@ -206,4 +206,9 @@ public class ColorGameMode : GameMode OnPlayerMoved(allPlayers[i].character, allPlayers[i].client, allPlayers[i].character.CurrentBlock); } } + + public override PlayerData[] getPlayerOrder(PlayerData[] AllPlayers) + { + throw new System.NotImplementedException(); + } } diff --git a/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs b/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs index 880c8b6..26bf4ef 100644 --- a/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs +++ b/Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs @@ -4,6 +4,7 @@ using UnityEngine; using Networking.Server; using TMPro; using UnityEngine.UI; +using System.Linq; [CreateAssetMenu(menuName = "Major Project/GameModes/Racetrack", order = 201)] public class RacetrackGameMode : GameMode @@ -225,13 +226,20 @@ public class RacetrackGameMode : GameMode mat.SetFloat("_Multiplier", 1); } - protected override void OnGameStart(PlayerData[] allPlayers) + protected override void OnGameStart(PlayerData[] AllPlayers) { BlocksOwned = new Dictionary>(); RoundCount = 0; - for(int i = 0; i < allPlayers.Length; i++) + AllPlayers = getPlayerOrder(AllPlayers); + for (int i = 0; i < AllPlayers.Length; i++) { - OnPlayerMoved(allPlayers[i].character, allPlayers[i].client, allPlayers[i].character.CurrentBlock); + OnPlayerMoved(AllPlayers[i].character, AllPlayers[i].client, AllPlayers[i].character.CurrentBlock); } } + + public override PlayerData[] getPlayerOrder(PlayerData[] AllPlayers) + { + AllPlayers.OrderByDescending(unit => unit.character.transform.position.x); + return AllPlayers; + } } diff --git a/Assets/Scripts/GameMode/GameMode.cs b/Assets/Scripts/GameMode/GameMode.cs index 16730d5..f50ace3 100644 --- a/Assets/Scripts/GameMode/GameMode.cs +++ b/Assets/Scripts/GameMode/GameMode.cs @@ -147,6 +147,8 @@ public abstract class GameMode : ScriptableObject } + public abstract PlayerData[] getPlayerOrder(PlayerData[] AllPlayers); + public void RoundStart(PlayerData[] allPlayers) { OnRoundStart(allPlayers); diff --git a/Assets/Scripts/Logic/BlockReader.cs b/Assets/Scripts/Logic/BlockReader.cs index 4972d96..0512700 100644 --- a/Assets/Scripts/Logic/BlockReader.cs +++ b/Assets/Scripts/Logic/BlockReader.cs @@ -58,9 +58,12 @@ public class BlockReader /// Returns false if other readers should wait for this one to run again public IEnumerator Read(Character character, float speedMultiplier) { - + if(currentBlockIndex >= LogicChain.Count) + { + yield break; + } LogicBlock currentBlock = LogicChain[currentBlockIndex]; - + //If the character has become stuck, they forfeit their remaining moves - we skip directly to their end of their chain if (character.stuck == true) { @@ -77,8 +80,9 @@ public class BlockReader //(it might not be finished if it is a for loop or something) if (currentBlock.isFinished()) { - currentBlock.Reset(); currentBlockIndex++; + currentBlock.Reset(); + } //Should other readers wait for this one diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 3cfc23a..54367be 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -125,11 +125,16 @@ public class GameManager : MonoBehaviour //Tell the gamemode that we are starting a round gameMode.RoundStart(playerDataAsArray); + //playerDataAsArray.OrderByDescending(unit => unit.character.transform.position.x); + playerDataAsArray.OrderBy(unit => unit.character.transform.position.x).ToArray(); + //Loop until all players have finished moving while (playerDataAsArray.Any(p => !p.blockReader.Finished)) { + + //Loop through all players foreach (PlayerData player in playerDataAsArray) diff --git a/Assets/Scripts/UI/LogicElementUI.cs b/Assets/Scripts/UI/LogicElementUI.cs index 2163358..c3e2b95 100644 --- a/Assets/Scripts/UI/LogicElementUI.cs +++ b/Assets/Scripts/UI/LogicElementUI.cs @@ -67,7 +67,15 @@ public class LogicElementUI : Dragable nameText.outlineWidth = 0.1f; icon.GetComponent().color = LogicElement.Color; - background.GetComponent().sprite = LogicElement.icon; + if(logicElement.icon != null) + { + background.GetComponent().sprite = LogicElement.icon; + } + else + { + background.GetComponent().enabled = false; + } + } }