コード例 #1
0
        public void Move(Point p, Level level, long time)
        {
            if (time % Cooldown != 0)
            {
                return;
            }

            Point newPos = new Point(Pos.X + MovingPoint.X, Pos.Y + MovingPoint.Y);

            if (GameRule.CanDraw(newPos, level))
            {
                OldPos = Pos;
                Pos    = newPos;
                Paint();
            }
            else
            {
                if (Facing == FacingHorizontal)
                {
                    MovingPoint.X = MovingPoint.X == 1 ? -1 : 1;
                }
                else
                {
                    MovingPoint.Y = MovingPoint.Y == 1 ? -1 : 1;
                }

                if (GameRule.CanDraw(newPos, level))
                {
                    OldPos = Pos;
                    Pos    = newPos;
                    Paint();
                }
            }
        }
コード例 #2
0
 public void MoveToPosition(Point p, Level level)
 {
     if (GameRule.CanDraw(p, level))
     {
         Pos = p;
         Paint();
     }
 }
コード例 #3
0
        public void Move(Point p, Level level, long time)
        {
            Point newPos = new Point(p.X + Pos.X, p.Y + Pos.Y);

            if (GameRule.CanDraw(newPos, level))
            {
                Pos = newPos;
                Paint();
            }
        }