示例#1
0
        public Puck()
        {
            _position.X = (Consts.FIELD_WIDTH + 1) / 2;
            _position.Y = (Consts.FIELD_HEIGHT + 1) / 2;

            Random rnd = new Random();

            int startPuckPosition = rnd.Next(0, 5);

            _direction = PuckDirection.LeftLeftTop + startPuckPosition;
        }
示例#2
0
 public void BeatToPlayer(int playerPart)
 {
     if ((byte)_direction > 8)
     {
         _direction = PuckDirection.LeftTop + playerPart;
     }
     else
     {
         _direction = PuckDirection.LeftBottom - playerPart;
     }
 }
示例#3
0
        public void BeatToLeft()
        {
            ++_position.X;

            if (PuckDirection < PuckDirection.Top)
            {
                PuckDirection = PuckDirection.Top + (3 - (int)PuckDirection);
            }

            if (PuckDirection > PuckDirection.Bottom)
            {
                PuckDirection = PuckDirection.Bottom - ((int)PuckDirection - 11);
            }
        }
示例#4
0
        public void BeatToRight()
        {
            --_position.X;

            if (PuckDirection <= PuckDirection.RightRightTop)
            {
                PuckDirection = PuckDirection.Top - ((int)PuckDirection - 3);
            }

            if (PuckDirection > PuckDirection.RightRightTop)
            {
                PuckDirection = PuckDirection.Bottom + (11 - (int)PuckDirection);
            }
        }
示例#5
0
        public void BeatToBottom()
        {
            --_position.Y;

            PuckDirection = PuckDirection.RightRightTop - ((int)PuckDirection - 8);
        }
示例#6
0
        public void BeatToTop()
        {
            ++_position.Y;

            PuckDirection = PuckDirection.RightRightTop + (8 - (int)PuckDirection);
        }