Esempio n. 1
0
    public void RespawnPlayer()
    {
        if (CurrentPlayer != null)
        {
            Destroy(CurrentPlayer);
        }

        if (eventHandler == null)
        {
            eventHandler = GameObject.Find("eventHandler").GetComponent <GameSceneEvents>();
        }

        CurrentPlayer = Instantiate(CurrentPlayerTemplate);
        MainCam.GetComponent <CameraController> ().ResetCamera(CurrentPlayer);

        if (eventHandler)
        {
            eventHandler.onPlayerRespawn();
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        MainCam.GetComponent <Camera>().player = Player;

        StartCoroutine("SpawnEnemy");
    }