change: Removed dependencies and references to OLD_StateController

This commit is contained in:
Nicholas Novak 2023-05-04 00:51:15 -07:00
parent ee158dd9a1
commit 212695df5d
5 changed files with 32 additions and 109 deletions

View File

@ -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;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 73653b02e42804d288eaaf881c511225
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,7 +3,8 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using TMPro; using TMPro;
public class ProgrammerHUDController : MonoBehaviour { public class ProgrammerHUDController : MonoBehaviour
{
// assigned in inspector // assigned in inspector
[SerializeField] TMP_Text trumpetUI; [SerializeField] TMP_Text trumpetUI;
@ -13,26 +14,28 @@ public class ProgrammerHUDController : MonoBehaviour {
[SerializeField] TMP_Text stateText; [SerializeField] TMP_Text stateText;
[SerializeField] GameObject programmerHUD; [SerializeField] GameObject programmerHUD;
[SerializeField] OLD_StateController stateController;
// Start is called before the first frame update // Start is called before the first frame update
void Start() { void Start()
trumpetUI.text = "Can Trumpet?\n" + stateController.canTrumpet; {
clarinetUI.text = "Can Clarinet?\n" + stateController.canClarinet; UpdateText();
cymbalUI.text = "Can Cymbal?\n" + stateController.canCymbal; }
tambourineUI.text = "Can Tambourine?\n" + stateController.canTambourine;
stateText.text = "Current State:\n" + stateController.currentState; 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 // Update is called once per frame
void Update() { void Update()
trumpetUI.text = "Can Trumpet?\n" + stateController.canTrumpet; {
clarinetUI.text = "Can Clarinet?\n" + stateController.canClarinet; UpdateText();
cymbalUI.text = "Can Cymbal?\n" + stateController.canCymbal;
tambourineUI.text = "Can Tambourine?\n" + stateController.canTambourine;
stateText.text = "Current State:\n" + stateController.currentState;
if (Input.GetKeyDown(KeyCode.H)) { if (Input.GetKeyDown(KeyCode.H))
{
programmerHUD.SetActive(!programmerHUD.activeSelf); programmerHUD.SetActive(!programmerHUD.activeSelf);
} }

View File

@ -10,6 +10,7 @@ public enum UnlockedItems
Trumpet, Trumpet,
Tambourine, Tambourine,
Clarinet, Clarinet,
Cymbal,
} }
public class StateController : MonoBehaviour public class StateController : MonoBehaviour
@ -75,6 +76,11 @@ public class StateController : MonoBehaviour
return this.itemProgression >= UnlockedItems.Clarinet; return this.itemProgression >= UnlockedItems.Clarinet;
} }
public bool HasCymbal()
{
return this.itemProgression >= UnlockedItems.Cymbal;
}
void OnSceneLoaded(Scene scene, LoadSceneMode mode) void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{ {
@ -132,6 +138,9 @@ public class StateController : MonoBehaviour
case "ClarinetScene": case "ClarinetScene":
this.itemProgression = UnlockedItems.Clarinet; this.itemProgression = UnlockedItems.Clarinet;
break; break;
case "MushroomForest":
this.itemProgression = UnlockedItems.Cymbal;
break;
}; };
#endregion #endregion
} }