dealDamageToPlayer() public static method

public static dealDamageToPlayer ( GameObject other, int damage ) : void
other GameObject
damage int
return void
Esempio n. 1
0
 void Attack(GameObject other)
 {
     timer = 0f;
     if (other != null)
     {
         // Deal damage to player
         HealthControl.dealDamageToPlayer(other, damage);
     }
 }
Esempio n. 2
0
    void OnTriggerEnter(Collider other)
    {
        // Check if the bolt come into contact with a door, wall, boss, other enemy or player
        if (other.gameObject.CompareTag("Door") ||
            other.gameObject.CompareTag("Wall") ||
            (other.gameObject.CompareTag("Enemy") && (enemy != other.gameObject)) ||
            other.gameObject.CompareTag("Boss") || other.gameObject.CompareTag("Player"))
        {
            // Destroy bolt on contact.
            Destroy(gameObject);

            // If bolt hits a player, deal damage to the player.
            HealthControl.dealDamageToPlayer(other.gameObject, boltDamage);
        }
    }