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; }
public void BeatToPlayer(int playerPart) { if ((byte)_direction > 8) { _direction = PuckDirection.LeftTop + playerPart; } else { _direction = PuckDirection.LeftBottom - playerPart; } }
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); } }
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); } }
public void BeatToBottom() { --_position.Y; PuckDirection = PuckDirection.RightRightTop - ((int)PuckDirection - 8); }
public void BeatToTop() { ++_position.Y; PuckDirection = PuckDirection.RightRightTop + (8 - (int)PuckDirection); }