Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.transform.tag == "Heal")
     {
         playerScore.ScoreIncrease(scoreToGive);
         playerHealth.currentHealth += 10;
         if (playerHealth.currentHealth > playerHealth.maxHealth)
         {
             playerHealth.currentHealth = playerHealth.maxHealth;
         }
         Destroy(collision.gameObject);
     }
 }
Ejemplo n.º 2
0
    public void HurtEnemy(int damageToGive)
    {
        currentHealth -= damageToGive;

        flashActive  = true;
        flashCounter = flashLenght;

        if (currentHealth <= 0)
        {
            playerScore.ScoreIncrease(scoreToGive);

            // Destroy enemy
            Destroy(gameObject);
        }
    }
Ejemplo n.º 3
0
    public void HurtEnemy(int damageToGive)
    {
        currentHealth -= damageToGive;

        flashActive  = true;
        flashCounter = flashLenght;
        Debug.Log(currentHealth);
        if (currentHealth <= 0)
        {
            playerScore.ScoreIncrease(scoreToGive);
            BossDied();
            // Destroy enemy
            gameObject.SetActive(false);
        }
    }