Example #1
0
 public virtual void CheckoutState()
 {
     if (targetControl == null)
     {
         targetControl =
             FightMgr.instance.GetMonsterTarget(transform.position, data.AttackDistance, attackStance);
     }
     if (targetControl != null && data.CurrentAttackInterval <= 0)
     {
         Attack();
     }
 }
Example #2
0
        public override void Attack()
        {
            if (Vector3.Distance(targetControl.transform.position, transform.position) > data.AttackDistance)
            {
                targetControl = FightMgr.instance.GetMonsterTarget(transform.position, data.AttackDistance, attackStance);
            }
            if (targetControl != null && !targetControl.data.Alive)
            {
                targetControl = null;
                return;
            }

            if (targetControl != null && targetControl.data.Alive)
            {
                Damage();
                data.CurrentAttackInterval = data.AttackInterval;
            }
        }