void Attack() { // Reset the timer. timer = 0f; // If the base has health to lose... if (homeBaseHealth.currentHomeHealth > 0) { // ... damage the base. homeBaseHealth.DamageHome(attackDamage); } }
void Attack() { // Reset the timer. timer = 0f; // If the base has health to lose... if (homeBaseHealth.currentHomeHealth > 0 && !movement.isPlayerLockedOn()) { // ... damage the base. homeBaseHealth.DamageHome(attackDamage); } // If the player has health to lose... else if (playerHealth.currentHealth > 0) { // ... damage the player. playerHealth.TakeDamage(attackDamage); } }