2023-07-07 19:15:56 -04:00

42 lines
702 B
C#

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;
}
}