示例#1
0
        public override void NextAction(Time elapsed)
        {
            if (Health <= 0)
            {
                return;
            }
            foreach (var ability in Abilities)
            {
                ability.LastUsed += elapsed;
            }

            HandleManaGain(elapsed);
            if (Busy)
            {
                BusyAction(elapsed);
            }
            else if (Target != null)
            {
                AttackAction(elapsed);
            }
            else if (Direction != null)
            {
                Path = new Pathing.Path(Position, (Vector2f)Direction, Game, this);
                MoveAction(Direction, elapsed);
            }
            else
            {
                IdleAction(elapsed);
            }
        }
示例#2
0
 private void AttackAction(Time elapsed)
 {
     if (InReach(Target) && Target.IsHittable())
     {
         UpdateState(2, Time.Zero);
         Abilities[0].LastUsed = Time.Zero;
         Hit(Target);
     }
     else
     {
         Path = new Pathing.Path(Position, Target.Position, Game, this);
         MoveAction(Target.Position, elapsed);
     }
 }