diff --git a/Assets/Plugins/IngameDebugConsole/Sprites.meta b/Assets/Animations.meta similarity index 77% rename from Assets/Plugins/IngameDebugConsole/Sprites.meta rename to Assets/Animations.meta index 504a23d..9ba7b94 100644 --- a/Assets/Plugins/IngameDebugConsole/Sprites.meta +++ b/Assets/Animations.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cb5d7b23a9e684a41a6a5d4f300eb1e6 +guid: 452f251b75e8b1542a101f1ab882a3ba folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Animations/CharacterController.controller b/Assets/Animations/CharacterController.controller new file mode 100644 index 0000000..826609e --- /dev/null +++ b/Assets/Animations/CharacterController.controller @@ -0,0 +1,12 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: CharacterController + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: [] diff --git a/Assets/Animations/CharacterController.controller.meta b/Assets/Animations/CharacterController.controller.meta new file mode 100644 index 0000000..8a53883 --- /dev/null +++ b/Assets/Animations/CharacterController.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed2a73208a872914f8187d96fb1f35e0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 9beb1d1..ca5ff5d 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -7,6 +7,8 @@ using Networking.Server; public class Character : MonoBehaviour { + public enum Animation {Walk,Jump,Slide} + public string nextScene; Animator characterAnimator; public bool isTuteLevel = false; @@ -104,6 +106,8 @@ public class Character : MonoBehaviour return new Vector3(0, y, 0); } + public IEnumerator MoveToBlock(Block Target, Animation animation, float time) + IEnumerator JumpCoroutine(Block Target, Transform Current, float time, float heightMax) { float elapsedTime = 0; diff --git a/Assets/Scripts/GameMode/GameMode.cs b/Assets/Scripts/GameMode/GameMode.cs index 519a0e4..899eb40 100644 --- a/Assets/Scripts/GameMode/GameMode.cs +++ b/Assets/Scripts/GameMode/GameMode.cs @@ -73,6 +73,12 @@ public abstract class GameMode : ScriptableObject /// List of all player Info protected virtual void OnAllPlayersMoved(PlayerData[] allPlayers) { } + /// + /// Called after all environmentblocks have taken their turn + /// + /// All players in scene + protected virtual void OnEnvironmentTurn(PlayerData[] allPlayers) { } + /// /// Called after one round has finished /// @@ -93,7 +99,6 @@ public abstract class GameMode : ScriptableObject public abstract bool isGameOver(PlayerData[] allPlayers); - public float GetRoundTime() { float retVal = gameTimes[0]; @@ -156,6 +161,11 @@ public abstract class GameMode : ScriptableObject AllPlayersMovedEvent?.Invoke(); } + public void EnvironmentTurn(PlayerData[] allPlayers) + { + OnEnvironmentTurn(allPlayers); + } + public void RoundEnd(PlayerData[] allPlayers) { OnRoundEnd(allPlayers); diff --git a/Assets/Scripts/LevelBlocks.meta b/Assets/Scripts/LevelBlocks.meta new file mode 100644 index 0000000..72a3c9c --- /dev/null +++ b/Assets/Scripts/LevelBlocks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8884be0c8b5416f4ca24595d0f32dacb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelBlocks/ActiveBlock.cs b/Assets/Scripts/LevelBlocks/ActiveBlock.cs new file mode 100644 index 0000000..dc10796 --- /dev/null +++ b/Assets/Scripts/LevelBlocks/ActiveBlock.cs @@ -0,0 +1,58 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ActiveBlock : Block +{ + + protected List currentPlayers = new List(); + + + #region Class Functions + + /// + /// Is called after all players have taken one move + /// + /// Should be implemented by a derived class + /// + public virtual void OnEnvironmentTurn(PlayerData[] allPlayers) + { + + } + + /// + /// Is called when a player moves onto this block + /// + /// Should be implemented by a derived class + /// + /// Player which moved on to block + public virtual void OnWalkedOnByPlayer(PlayerData player) + { + currentPlayers.Add(player); + } + + /// + /// Is called when a player moves off of block + /// + /// Should be implemented by a derived class + /// + /// Player which moved on to block + public virtual void OnLeftByPlayer(PlayerData player) + { + currentPlayers.Remove(player); + } + + /// + /// Called after all players have finished all their moves + /// + /// Should be implemented by a derived class + /// + public virtual void OnRoundEnd(PlayerData[] allPlayers) + { + + } + + #endregion Class Functions + + +} diff --git a/Assets/Scripts/LevelBlocks/ActiveBlock.cs.meta b/Assets/Scripts/LevelBlocks/ActiveBlock.cs.meta new file mode 100644 index 0000000..22caf0e --- /dev/null +++ b/Assets/Scripts/LevelBlocks/ActiveBlock.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4346bd3c1435c747921b58965edffd3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Block.cs b/Assets/Scripts/LevelBlocks/Block.cs similarity index 87% rename from Assets/Scripts/Block.cs rename to Assets/Scripts/LevelBlocks/Block.cs index 2729cc0..36b8025 100644 --- a/Assets/Scripts/Block.cs +++ b/Assets/Scripts/LevelBlocks/Block.cs @@ -24,6 +24,7 @@ public class Block : MonoBehaviour [Tooltip("Is this block at the bottom of a pit?")] public bool isPit = false; + [Header("Spawn Settings")] [Tooltip("Can this block be spawned on")] public bool isSpawnable = false; @@ -58,36 +59,9 @@ public class Block : MonoBehaviour } - /// - /// Is called after all players have taken one move - /// - /// Should be implemented by a derived class - /// - public virtual void OnPlayersMoved() - { - - } - - /// - /// Is called when a player moves onto this block - /// - /// Should be implemented by a derived class - /// - /// Player which moved on to block - public virtual void OnWalkedOnByPlayer(PlayerData player) - { - - } - - /// - /// Called after all players have finished all their moves - /// - /// Should be implemented by a derived class - /// - public virtual void OnRoundEnd() - { + - } + #endregion Public Functions diff --git a/Assets/Scripts/Block.cs.meta b/Assets/Scripts/LevelBlocks/Block.cs.meta similarity index 100% rename from Assets/Scripts/Block.cs.meta rename to Assets/Scripts/LevelBlocks/Block.cs.meta diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 0fd86d9..7dc512a 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -33,6 +33,7 @@ public class GameManager : MonoBehaviour #region Private Variables private Dictionary playerData; + private List activeBlocks; #endregion Private Variables #region Read Only @@ -51,7 +52,9 @@ public class GameManager : MonoBehaviour private void Start() { - //Start Game + //Find all active blocks + //#TODO don't use the find function + activeBlocks = FindObjectsOfType().ToList(); StartCoroutine(GameRoutine()); } @@ -119,6 +122,11 @@ public class GameManager : MonoBehaviour //Let Gamemode know all players have moved 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 //if Game is over break out of loop diff --git a/Assets/Scripts/Traps/ShootingCannon.cs b/Assets/Scripts/Traps/ShootingCannon.cs index f04aca9..50679b1 100644 --- a/Assets/Scripts/Traps/ShootingCannon.cs +++ b/Assets/Scripts/Traps/ShootingCannon.cs @@ -1,4 +1,4 @@ -using System.Collections; + using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;