ofb/Assets/Scripts/StateController.cs
slevy14 4b7bb231a9 added a way for the player to die and respawn, reconfigured test level
ALSO installed TMP but it has been giving me ISSUES
2023-04-13 16:52:11 -07:00

25 lines
610 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StateController : MonoBehaviour {
[Header("Respawning")]
[SerializeField] GameObject player;
public GameObject spawnPoint;
[SerializeField] private GameObject deathCanvas;
void Awake() {
deathCanvas.SetActive(false);
}
public void RespawnPlayer() {
ToggleDeathCanvas();
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
}
public void ToggleDeathCanvas() {
deathCanvas.SetActive(!deathCanvas.activeSelf);
}
}