2022-06-06 16:21:26 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
public class RespawnScript : MonoBehaviour
|
|
|
|
{
|
|
|
|
private string currentScene;
|
|
|
|
|
2022-06-15 19:54:44 +02:00
|
|
|
public GameObject mainCh;
|
|
|
|
|
2022-06-06 16:21:26 +02:00
|
|
|
public void RespawnOnCurrentScene()
|
|
|
|
{
|
|
|
|
Scene scene = SceneManager.GetActiveScene();
|
|
|
|
currentScene = scene.name;
|
|
|
|
SceneManager.LoadScene(currentScene);
|
2022-06-15 19:54:44 +02:00
|
|
|
Player player = mainCh.GetComponent<Player>();
|
|
|
|
player.currentHealth = 10.0f;
|
2022-06-06 16:21:26 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|