Пример #1
0
 private void Update()
 {
     if (!isAttack)
     {
         return;
     }
     if (target.IsDead)
     {
         StopAttackTarget();
     }
     if (timeNextAttack <= Time.time)
     {
         if (CheckDistanceForAttack())
         {
             if (isNearTarget)
             {
                 animatorPlayer.SetArrowAttack(false);
                 isNearTarget = false;
             }
             movementPlayer.MovePosition(target.transform.position);
         }
         else
         {
             if (!isNearTarget)
             {
                 movementPlayer.StopMove();
                 animatorPlayer.SetArrowAttack(true);
                 isNearTarget = true;
                 SetStartTimeAttack();
                 return;
             }
             target.ReceivDamage(statusPlayer.AttackDmg);
             timeNextAttack = Time.time + attackAnimLengh / statusPlayer.AttackSpeed;
         }
     }
 }