コード例 #1
0
        public Sector(Game game, Point point)
        {
            Place = point;
            Game  = game;
            Size  = new Size(Constants.SIDE, Constants.SIDE);
            PositionSector();
            BackgroundImageLayout = ImageLayout.Zoom;
            BackgroundIndex       = BackgroundDirection.UP;
            SetImage(Constants.SectorBgImageName(BackgroundDirection.UP));

            Game.Sectors.Add(this);
        }
コード例 #2
0
 public void TurnLeft()
 {
     foreach (BallPoint ball in BallPoints)
     {
         ball.Point = new Point(ball.Point.Y, Constants.SECTOR_WIDTH - ball.Point.X + 1);
         ball.DrawBallPoint();
     }
     BackgroundIndex++;
     if ((int)BackgroundIndex > 3)
     {
         BackgroundIndex = BackgroundDirection.UP;
     }
     DrawBackground();
 }
コード例 #3
0
 public void TurnRight()
 {
     foreach (BallPoint ball in BallPoints)
     {
         ball.Point = new Point(Constants.SECTOR_WIDTH - ball.Point.Y + 1, ball.Point.X);
         ball.DrawBallPoint();
     }
     BackgroundIndex--;
     if (BackgroundIndex < 0)
     {
         BackgroundIndex = BackgroundDirection.LEFT;
     }
     DrawBackground();
 }
コード例 #4
0
    public void SetDirection(BackgroundDirection newDirection)
    {
        switch (newDirection)
        {
        case BackgroundDirection.RightToLeft:
            _direction = new Vector2(-1, 0);
            break;

        case BackgroundDirection.LeftToRight:
            _direction = new Vector2(1, 0);
            break;

        case BackgroundDirection.TopToBottom:
            _direction = new Vector2(0, -1);
            break;

        case BackgroundDirection.BottomToTop:
            _direction = new Vector2(0, 1);
            break;
        }

        _isDirectionChanged = true;
    }
コード例 #5
0
 public static string SectorBgImageName(BackgroundDirection direction) =>
 $"sector_{direction.ToString().ToLower()}.gif";