Esempio n. 1
0
    private void checkIfPlayerIsAlive()
    {
        if (lostLife() && lives != 0)
        {
            string     hearthStr = playerTag + "_" + Convert.ToString(3 - lives);
            GameObject hearth    = GameObject.FindGameObjectWithTag(hearthStr);
            hearth.SetActive(false);

            if (lives == 1)
            {
                dead = true;
                this.transform.position = new Vector3(-40f, 10f, -15f);
                if (matePlayerScript.isDead())
                {
                    scoreScript.addScore(playerNameManager.getFirstPlayerName(), playerNameManager.getSecondPlayerName(), gameManager.getScore());
                    SceneManager.LoadScene(Constants.GAME_OVER_SCENE);
                }
            }

            else
            {
                floorGenerator.resetStart();
                StartCoroutine(respawnPlayers());
            }
            lives--;
        }
    }