Ejemplo n.º 1
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)
            {
                personalSealImage.SetActive(true);
                isPuzzleNotActive = true;
                gameOverObject.playGameOver();
            }
        }
    }
Ejemplo n.º 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);
                }
            }
        }
    }