added a way for the player to die and respawn, reconfigured test level

ALSO installed TMP but it has been giving me ISSUES
This commit is contained in:
slevy14
2023-04-13 16:52:11 -07:00
parent f7581dad01
commit 4b7bb231a9
84 changed files with 20683 additions and 867 deletions

View File

@@ -4,75 +4,21 @@ using UnityEngine;
public class 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
[Header("Respawning")]
[SerializeField] GameObject player;
public GameObject spawnPoint;
[SerializeField] private GameObject deathCanvas;
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() {
void Awake() {
deathCanvas.SetActive(false);
}
// 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;
}
public void RespawnPlayer() {
ToggleDeathCanvas();
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
}
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;
}
public void ToggleDeathCanvas() {
deathCanvas.SetActive(!deathCanvas.activeSelf);
}
}