BaptisteGirard e58928ef8b v2
2023-05-15 15:47:38 -04:00

35 lines
635 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ally : Entity
{
void Update() {
if(IsEnemyDetected) {
AttackEnemy();
}
}
void AttackEnemy() {
//Attack Cooldown
if(AttackSpeed < AttackSpeedWait) {
Enemy.Hp-=AttackDamage;
Debug.Log("Opponent Hp = " + Enemy.Hp);
//Kill if no hp
if(Enemy.Hp <= 0) {
Destroy(Enemy);
}
AttackSpeedWait = 0f;
}
AttackSpeedWait += Time.deltaTime;
}
}