public static dealDamageToPlayer ( GameObject other, int damage ) : void | ||
other | GameObject | |
damage | int | |
Результат | void |
void Attack(GameObject other) { timer = 0f; if (other != null) { // Deal damage to player HealthControl.dealDamageToPlayer(other, damage); } }
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); } }