diff --git a/Assets/Scripts/BaseCameraController.cs b/Assets/Scripts/BaseCameraController.cs index b9799cd6bcc6ef413d39e578cc7d7791056340c6..8ff56f2e13f391be5edd97d20b33a589bae09d70 100644 --- a/Assets/Scripts/BaseCameraController.cs +++ b/Assets/Scripts/BaseCameraController.cs @@ -82,7 +82,7 @@ public class BaseCameraController : MonoBehaviour { if (Input.GetKeyDown(KeyCode.Z)) // TODO Remove eventually { - var player = GameObject.FindGameObjectWithTag("Player"); + var player = GameObject.FindGameObjectWithTag("AntiPlayer"); AnimateToPosition(player.transform.position + new Vector3(0f, 0.75f), 1.5f, 0.1f); } if (Input.GetKeyDown(KeyCode.L)) // TODO Also remove eventually... or make a proper feature. diff --git a/Assets/Scripts/RoundController.cs b/Assets/Scripts/RoundController.cs index cf6b562dc282a2456035894ca294e379cad847cb..2d8ee1358454e5510a615c2705de44fecabbd1ed 100644 --- a/Assets/Scripts/RoundController.cs +++ b/Assets/Scripts/RoundController.cs @@ -9,13 +9,15 @@ public interface IRoundCallback void OnRoundEnd(); } -public class RoundController : MonoBehaviour +public class RoundController : MonoBehaviour, IFighterCallback { public static RoundController instance { get; private set; } public List<IRoundCallback> roundCallbacks = new List<IRoundCallback>(); public bool roundRunning { get; private set; } + BaseCameraController cameraController; + public void StartRound() { if (roundRunning) @@ -23,7 +25,10 @@ public class RoundController : MonoBehaviour return; } roundRunning = true; + SetGameSpeed(1f); roundCallbacks.ForEach(c => c.OnRoundStart()); + // Fighters clear their callbacks every round end + GameObject.FindGameObjectWithTag("AntiPlayer").GetComponent<Fighter>().callbacks.Add(this); } public void StopRound() @@ -33,6 +38,7 @@ public class RoundController : MonoBehaviour return; } roundRunning = false; + SetGameSpeed(1f); roundCallbacks.ForEach(c => c.OnRoundEnd()); } @@ -48,9 +54,8 @@ public class RoundController : MonoBehaviour } } - public void ChangeGameSpeed(float multiplier) + public void SetGameSpeed(float multiplier) { - Debug.Log(multiplier); Time.timeScale = multiplier; } @@ -65,6 +70,13 @@ public class RoundController : MonoBehaviour Destroy(gameObject); } DontDestroyOnLoad(gameObject); + + cameraController = Camera.main.GetComponent<BaseCameraController>(); } + public void OnFighterDeath(Fighter fighter) + { + SetGameSpeed(0.5f); + cameraController.AnimateToPosition(fighter.transform.position + new Vector3(0f, 0.75f), 1.5f, 0.05f); + } }