Beispiel #1
0
 void Update()
 {
     if (_state.ActualState == UnitStateBehaviour.State.ATTACK)
     {
         if (_lastAttackTime + attackCooldown <= Time.time && target != null)
         {
             if (target.Health > 0)
             {
                 _animator.SetBool("CanAttack", true);
             }
             else
             {
                 target = null;
             }
         }
         else if (target == null)
         {
             _animator.SetBool("CanAttack", false);
             _animator.SetBool("TargetSet", false);
             _animator.SetBool("IsRunning", true);
             _state.ChangeState(UnitStateBehaviour.State.RUN);
         }
     }
 }
Beispiel #2
0
 void Start()
 {
     _state        = GetComponent <UnitStateBehaviour>();
     _animator     = GetComponent <Animator>();
     _healthSystem = GetComponent <UnitHealthBehaviour>();
 }