using System.Collections; using System.Collections.Generic; using UnityEngine; public class Ally : Entity { public override void Start() { base.Start(); } void Update() { if(IsEnemyDetected) { AttackEnemy(); } } void AttackEnemy() { //Attack Cooldown if(AttackSpeed < AttackSpeedWait) { Enemy.Hit(AttackDamage); //Kill if no hp if(Enemy.Hp <= 0) { IsEnemyDetected = false; Enemy.Death(); } AttackSpeedWait = 0f; } AttackSpeedWait += Time.deltaTime; } }