public virtual void Attack(CombatEntity target) { if (AttackReady) { if (target.Health <= 0.0f) { Debug.Log("Enemy is defeated"); inCombat = false; return; } AttackReady = false; prevTime = Time.time; target.TakeDamage(Damage); Debug.Log(ID + " did " + Damage + " Damage to " + target.ID); log[1].text = log[0].text; log[0].text = ID + " did " + Damage + " Damage to " + target.ID; } else { if (ID != "Squid") { Debug.Log(ID + " Attack Cooldown: " + (FireRate - (Time.time - prevTime))); } } }
public void Attack(CombatEntity attacker) { // THIS IS TEMPORARY, FOR TESTING PURPOSES CombatEntity attacked = attacker == fighters[0] ? fighters[1] : fighters[0]; attacked.TakeDamage(attacker.attack); }