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() {
|
2023-04-17 15:22:24 -07:00
|
|
|
SetDeathCanvasActive(false);
|
2023-04-19 21:34:00 -07:00
|
|
|
GameObject.Find("Main Camera").GetComponent<CameraMovement>().FindPlayer();
|
2023-04-13 16:52:11 -07:00
|
|
|
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
|
2023-04-11 19:55:24 -07:00
|
|
|
}
|
|
|
|
|
2023-04-17 15:22:24 -07:00
|
|
|
public void SetDeathCanvasActive(bool activeState) {
|
|
|
|
deathCanvas.SetActive(activeState);
|
2023-04-11 19:55:24 -07:00
|
|
|
}
|
|
|
|
}
|