Beispiel #1
0
    private void OnBecameInvisible()
    {
        transform.position = checkpoint;
        StartCoroutine(BossFightTrigger.resizeCameraSize(5f, Camera.main));
        TakeDamage(3);

        /*if (lifes > 0)
         * {
         *  Tak
         * }
         * else
         * {
         *  //Destroy(player);
         *  SceneManager.LoadScene(0);
         * }*/
    }
Beispiel #2
0
    public void TakeDamage(int damage)
    {
        //health -= damage;

        //health=Mathf.Clamp(health, 0f, maxHealth);

        //if (health == 0 && !isPuzzleNotActive)
        //{
        //    personalSealImage.SetActive(true);
        //    isPuzzleNotActive = true;
        //}

        if (!isPuzzleNotActive)
        {
            health -= damage;

            health = Mathf.Clamp(health, 0f, maxHealth);
            if (health == 0)
            {
                transform.position = checkpoint;
                lifes--;
                StartCoroutine(BossFightTrigger.resizeCameraSize(5f, Camera.main));

                if (lifes > 0)
                {
                    health = maxHealth;
                }
                else
                {
                    personalSealImage.SetActive(true);
                    isPuzzleNotActive = true;
                    animator2d.SetTrigger("Muerte");
                    gameOverObject.playGameOver();
                    isDead = true;
                    //Destroy(player);
                    //SceneManager.LoadScene(0);
                }
            }
        }
    }