示例#1
0
        public override Type Execute()
        {
            if (!_movement.HaveTarget())
            {
                return(null);
            }

            _movement.UpdateGame();

            return(GetType());
        }
        public override Type Execute()
        {
            int dist = Mathf.Abs(Vec2.Dist(_krtransform.Pos, _attack.Target.Pos));

            if (dist > _attack.Range)
            {
                _krmovement.Move(_attack.Target.Pos);
                _krmovement.UpdateGame();
            }
            else if (dist == _attack.Range)
            {
                return(null);
            }
            else
            {
                Vec2 nearPos = KRFacade.NearSquareAt(_krtransform.Pos, _attack.Target.Pos, _attack.Range);
                if (nearPos != null)
                {
                    _krmovement.Move(nearPos);
                    return(typeof(MovementState));
                }
            }
            return(GetType());
        }