コード例 #1
0
ファイル: World.cs プロジェクト: daniellee/BallBounce
        public World(int viewportWidth, int viewportHeight, float scale)
        {
            _boxLength *= scale;
            _startPositionForNewBall = new Vector2(viewportWidth / 2f, (viewportHeight/3f) * 2f);

            _viewportRect = new Rectangle(0, 0,
                viewportWidth,
                viewportHeight);
            _ballsModel = new BallsModel(this, (int)_boxLength, (int)_boxLength, _startPositionForNewBall, _startDirectionForNewBall);
            _frameModel = new FrameModel(this);
            _playerModel = new PlayerModel(this, scale);
            CurrentLevel = LoadLevel(1, scale);
            CurrentState = GameState.Normal;
        }
コード例 #2
0
        public void Setup()
        {
            _world = new World(800, 600, 1f) { GameSpeed = 1f };

            _playerModel = new PlayerModel(_world, 1f);
        }
コード例 #3
0
 public PlayerController(PlayerModel playerModel)
 {
     _playerModel = playerModel;
     _previousMouseState = Mouse.GetState();
 }
コード例 #4
0
ファイル: Ball.cs プロジェクト: daniellee/BallBounce
 private void HandlePlayerAndBallCollision(Rectangle ballRectangle, PlayerModel player)
 {
     if (player.IntersectsWith(ballRectangle))
     {
         player.SetBallVelocityAfterCollision(this);
     }
 }
コード例 #5
0
ファイル: PlayerViewer.cs プロジェクト: daniellee/BallBounce
 public PlayerViewer(PlayerModel playerModel, Texture2D playerTexture)
 {
     _playerModel = playerModel;
     _playerTexture = playerTexture;
 }