Beispiel #1
0
    void Attack()
    {
        // Reset the timer.
        timer = 0f;

        // If the player has health to lose...
        if (playerHealth.currentHealth > 0)
        {
            anim.SetBool("Attack", playerInRange);
            // ... damage the player.
            playerHealth.TakeDamage(attackDamage);
        }
    }
Beispiel #2
0
 public void OnTriggerEnter(Collider other)
 {
     /*if (other.CompareTag("Bad_guy"))
      * {
      *  if (currentHealth > 0)
      *  {
      *      // ... damage the player.
      *      titanPlayerHealth.TakeDamage(10);
      *      print("Hit");
      *  }
      * }*/
     if (other.CompareTag("Hazard"))
     {
         if (currentHealth > 0)
         {
             // ... damage the player.
             titanPlayerHealth.TakeDamage(50);
             print("Hit yo");
         }
     }
 }