ofb/Assets/Scripts/StateController.cs

25 lines
610 B
C#
Raw Normal View History

2023-04-11 19:55:24 -07:00
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;
2023-04-11 19:55:24 -07:00
void Awake() {
deathCanvas.SetActive(false);
2023-04-11 19:55:24 -07:00
}
public void RespawnPlayer() {
ToggleDeathCanvas();
Instantiate(player, spawnPoint.transform.position, spawnPoint.transform.rotation);
2023-04-11 19:55:24 -07:00
}
public void ToggleDeathCanvas() {
deathCanvas.SetActive(!deathCanvas.activeSelf);
2023-04-11 19:55:24 -07:00
}
}