From 212695df5d04700092b0d48295255f81726e9192 Mon Sep 17 00:00:00 2001 From: Nicholas Novak <34256932+NickyBoy89@users.noreply.github.com> Date: Thu, 4 May 2023 00:51:15 -0700 Subject: [PATCH] change: Removed dependencies and references to OLD_StateController --- Assets/Scripts/OLD_StateController.cs | 78 ---------------------- Assets/Scripts/OLD_StateController.cs.meta | 11 --- Assets/Scripts/PlayerBehavior.cs | 8 +-- Assets/Scripts/ProgrammerHUDController.cs | 35 +++++----- Assets/Scripts/StateController.cs | 9 +++ 5 files changed, 32 insertions(+), 109 deletions(-) delete mode 100644 Assets/Scripts/OLD_StateController.cs delete mode 100644 Assets/Scripts/OLD_StateController.cs.meta diff --git a/Assets/Scripts/OLD_StateController.cs b/Assets/Scripts/OLD_StateController.cs deleted file mode 100644 index 180d5fd..0000000 --- a/Assets/Scripts/OLD_StateController.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class OLD_StateController : MonoBehaviour { - - // this is mostly a placeholder for making the programmer HUD work properly - // something like this will be needed later but like with real variables - - public bool canTrumpet = true; - public bool canTambourine = true; - public bool canClarinet = true; - public bool canCymbal = true; - - public enum PlayerStates { - Idle, - Running, - Jumping, - Falling, - TrumpetJumping, - TambourineThrowing, - SpiderGrappling, - ClarinetDiving, - CymbalParrying, - } - public PlayerStates currentState = PlayerStates.Idle; - - - // Start is called before the first frame update - void Start() { - - } - - // Update is called once per frame - void Update() { - if (Input.GetKeyDown(KeyCode.Q)) { - canTrumpet = !canTrumpet; - print("Q"); - } - if (Input.GetKeyDown(KeyCode.W)) { - canTambourine = !canTambourine; - } - if (Input.GetKeyDown(KeyCode.E)) { - canClarinet = !canClarinet; - } - if (Input.GetKeyDown(KeyCode.R)) { - canCymbal = !canCymbal; - } - - if (Input.GetKeyDown("1")) { - currentState = PlayerStates.Idle; - } - if (Input.GetKeyDown("2")) { - currentState = PlayerStates.Running; - } - if (Input.GetKeyDown("3")) { - currentState = PlayerStates.Jumping; - } - if (Input.GetKeyDown("4")) { - currentState = PlayerStates.Falling; - } - if (Input.GetKeyDown("5")) { - currentState = PlayerStates.TrumpetJumping; - } - if (Input.GetKeyDown("6")) { - currentState = PlayerStates.TambourineThrowing; - } - if (Input.GetKeyDown("7")) { - currentState = PlayerStates.SpiderGrappling; - } - if (Input.GetKeyDown("8")) { - currentState = PlayerStates.ClarinetDiving; - } - if (Input.GetKeyDown("9")) { - currentState = PlayerStates.CymbalParrying; - } - } -} diff --git a/Assets/Scripts/OLD_StateController.cs.meta b/Assets/Scripts/OLD_StateController.cs.meta deleted file mode 100644 index 6271a94..0000000 --- a/Assets/Scripts/OLD_StateController.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 73653b02e42804d288eaaf881c511225 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/PlayerBehavior.cs b/Assets/Scripts/PlayerBehavior.cs index c28f3c7..d20fef5 100644 --- a/Assets/Scripts/PlayerBehavior.cs +++ b/Assets/Scripts/PlayerBehavior.cs @@ -102,13 +102,13 @@ public class PlayerBehavior : MonoBehaviour } if (!playerController.IsGrounded() && (currentDashTime < maxDashTime) && isDash) { - if(forward == 1) - { - moveDirection = new Vector3(1f,-1f,0f) * dashDistance; + if (forward == 1) + { + moveDirection = new Vector3(1f, -1f, 0f) * dashDistance; } else { - moveDirection = new Vector3(-1f,-1f,0f) * dashDistance; + moveDirection = new Vector3(-1f, -1f, 0f) * dashDistance; } transform.position = transform.position + moveDirection; currentDashTime += dashStopSpeed; diff --git a/Assets/Scripts/ProgrammerHUDController.cs b/Assets/Scripts/ProgrammerHUDController.cs index 269a21c..bd9f704 100644 --- a/Assets/Scripts/ProgrammerHUDController.cs +++ b/Assets/Scripts/ProgrammerHUDController.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using UnityEngine; using TMPro; -public class ProgrammerHUDController : MonoBehaviour { +public class ProgrammerHUDController : MonoBehaviour +{ // assigned in inspector [SerializeField] TMP_Text trumpetUI; @@ -13,28 +14,30 @@ public class ProgrammerHUDController : MonoBehaviour { [SerializeField] TMP_Text stateText; [SerializeField] GameObject programmerHUD; - [SerializeField] OLD_StateController stateController; // Start is called before the first frame update - void Start() { - trumpetUI.text = "Can Trumpet?\n" + stateController.canTrumpet; - clarinetUI.text = "Can Clarinet?\n" + stateController.canClarinet; - cymbalUI.text = "Can Cymbal?\n" + stateController.canCymbal; - tambourineUI.text = "Can Tambourine?\n" + stateController.canTambourine; - stateText.text = "Current State:\n" + stateController.currentState; + void Start() + { + UpdateText(); + } + + void UpdateText() + { + trumpetUI.text = "Can Trumpet?\n" + StateController.Instance.HasTrumpet(); + clarinetUI.text = "Can Clarinet?\n" + StateController.Instance.HasClarinet(); + cymbalUI.text = "Can Cymbal?\n" + StateController.Instance.HasCymbal(); + tambourineUI.text = "Can Tambourine?\n" + StateController.Instance.HasTambourine(); } // Update is called once per frame - void Update() { - trumpetUI.text = "Can Trumpet?\n" + stateController.canTrumpet; - clarinetUI.text = "Can Clarinet?\n" + stateController.canClarinet; - cymbalUI.text = "Can Cymbal?\n" + stateController.canCymbal; - tambourineUI.text = "Can Tambourine?\n" + stateController.canTambourine; - stateText.text = "Current State:\n" + stateController.currentState; + void Update() + { + UpdateText(); - if (Input.GetKeyDown(KeyCode.H)) { + if (Input.GetKeyDown(KeyCode.H)) + { programmerHUD.SetActive(!programmerHUD.activeSelf); } - + } } diff --git a/Assets/Scripts/StateController.cs b/Assets/Scripts/StateController.cs index 8b7cc2b..fad694e 100644 --- a/Assets/Scripts/StateController.cs +++ b/Assets/Scripts/StateController.cs @@ -10,6 +10,7 @@ public enum UnlockedItems Trumpet, Tambourine, Clarinet, + Cymbal, } public class StateController : MonoBehaviour @@ -75,6 +76,11 @@ public class StateController : MonoBehaviour return this.itemProgression >= UnlockedItems.Clarinet; } + public bool HasCymbal() + { + return this.itemProgression >= UnlockedItems.Cymbal; + } + void OnSceneLoaded(Scene scene, LoadSceneMode mode) { @@ -132,6 +138,9 @@ public class StateController : MonoBehaviour case "ClarinetScene": this.itemProgression = UnlockedItems.Clarinet; break; + case "MushroomForest": + this.itemProgression = UnlockedItems.Cymbal; + break; }; #endregion }