2023-04-11 19:55:24 -07:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class StateController : MonoBehaviour {
|
|
|
|
|
2023-04-13 16:52:11 -07:00
|
|
|
[Header("Respawning")]
|
|
|
|
[SerializeField] GameObject player;
|
|
|
|
public GameObject spawnPoint;
|
|
|
|
[SerializeField] private GameObject deathCanvas;
|
2023-04-11 19:55:24 -07:00
|
|
|
|
2023-04-13 16:52:11 -07:00
|
|
|
void Awake() {
|
|
|
|
deathCanvas.SetActive(false);
|
2023-04-11 19:55:24 -07:00
|
|
|
}
|
|
|
|
|
2023-04-13 16:52:11 -07:00
|
|
|
public void RespawnPlayer() {
|
|
|
|
ToggleDeathCanvas();
|
|
|
|
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
|
2023-04-11 19:55:24 -07:00
|
|
|
}
|
|
|
|
|
2023-04-13 16:52:11 -07:00
|
|
|
public void ToggleDeathCanvas() {
|
|
|
|
deathCanvas.SetActive(!deathCanvas.activeSelf);
|
2023-04-11 19:55:24 -07:00
|
|
|
}
|
|
|
|
}
|