42 lines
652 B
C#
42 lines
652 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Archer : Ally
|
|
{
|
|
|
|
public override void Start()
|
|
{
|
|
base.Start();
|
|
Animation = gameObject.AddComponent<AnimationEntity>();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
|
|
if(IsEnemyDetected) {
|
|
AttackEnemy();
|
|
}
|
|
|
|
}
|
|
|
|
void AttackEnemy()
|
|
{
|
|
|
|
//Attack Cooldown
|
|
if(AttackSpeed < AttackSpeedWait) {
|
|
|
|
Animation.PlayAttackAnim();
|
|
|
|
|
|
|
|
AttackSpeedWait = 0f;
|
|
|
|
}
|
|
|
|
AttackSpeedWait += Time.deltaTime;
|
|
|
|
}
|
|
|
|
}
|