ofb/Assets/Scripts/StateController.cs

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