Example #1
0
 public SetPlayerInputEnabledCommand(
     BreakoutGameController breakoutGameController,
     bool inputEnabled) :
     base(breakoutGameController)
 {
     _inputEnabled = inputEnabled;
 }
Example #2
0
 public void AssignBreakoutGameController(
     BreakoutGameController breakoutGameController)
 {
     _breakoutGameController  = breakoutGameController;
     _scoreUi.ScoreController = breakoutGameController.ScoreController;
     _breakoutGameController.ReachedGameOver += OnReachedGameOver;
 }
Example #3
0
        private void GenerateRow(
            BreakoutGameController breakoutGameController,
            RowConfig rowConfig,
            int rowIndex)
        {
            var unitSize   = breakoutGameController.UnitSize;
            var numColumns = rowConfig.numColumns;
            var baseWidth  = (breakoutGameController.PaddedGameBoardWidth / rowConfig.numColumns);

            var brickTopCenterPosition =
                new Vector3(0.0f,
                            -breakoutGameController.PaddedGameBoardHeight * 0.5f * unitSize,
                            0.0f);

            var y      = (rowIndex * unitSize + brickTopCenterPosition.y);
            var startX = -(breakoutGameController.PaddedGameBoardWidth * 0.5f + brickTopCenterPosition.x) * unitSize;

            for (var i = 0; i < numColumns; i++)
            {
                var x           = startX + (i * baseWidth * unitSize) + (baseWidth * 0.5f * unitSize);
                var brickConfig = GetBrickConfigForCoords(rowConfig, i);
                brickConfig.width    = baseWidth;
                brickConfig.unitSize = unitSize;
                var brick = _brickFactory.CreateBrick(brickConfig);
                brick.transform.localPosition = new Vector3(x, 0.0f, -y);
                breakoutGameController.AddBrick(brick);
            }
        }
        private void CreateWalls(
            BreakoutGameController breakoutGameController,
            GameBoardConfig gameBoardConfig)
        {
            var gameBoardWidthHalf  = gameBoardConfig.gameBoardWidth * 0.5f;
            var gameBoardHeightHalf = gameBoardConfig.gameBoardHeight * 0.5f;

            var leftWallConfig = new WallConfig
            {
                x        = -gameBoardWidthHalf,
                angle    = 90.0f,
                width    = gameBoardConfig.gameBoardHeight,
                wallType = WallType.Left
            };

            CreateWall(breakoutGameController, leftWallConfig);

            var rightWallConfig = new WallConfig
            {
                x        = gameBoardWidthHalf,
                angle    = -90.0f,
                width    = gameBoardConfig.gameBoardHeight,
                wallType = WallType.Right
            };

            CreateWall(breakoutGameController, rightWallConfig);

            var topWallConfig = new WallConfig
            {
                y        = gameBoardHeightHalf,
                angle    = 180.0f,
                width    = gameBoardConfig.gameBoardWidth,
                wallType = WallType.Top
            };

            CreateWall(breakoutGameController, topWallConfig);

            var leftCornerConfig = new CornerConfig
            {
                x     = -gameBoardWidthHalf,
                y     = gameBoardHeightHalf,
                angle = 180.0f,
                size  = 1.0f
            };

            CreateCorner(breakoutGameController, leftCornerConfig);

            var rightCornerConfig = new CornerConfig
            {
                x     = gameBoardWidthHalf,
                y     = gameBoardHeightHalf,
                angle = 270.0f,
                size  = 1.0f
            };

            CreateCorner(breakoutGameController, rightCornerConfig);
        }
Example #5
0
 public BallFailDetector(
     BreakoutGameController breakoutGameController,
     Ball ball,
     float ballFailY)
 {
     _breakoutGameController = breakoutGameController;
     _ball      = ball;
     _ballFailY = ballFailY;
 }
Example #6
0
        public void GenerateBricks(BreakoutGameController breakoutGameController)
        {
            var numRows = _levelConfig.rowConfigs.Length;

            for (var i = 0; i < numRows; i++)
            {
                var rowConfig = _levelConfig.rowConfigs[i];
                GenerateRow(breakoutGameController, rowConfig, i);
            }
        }
        private void CreateCamera(
            BreakoutGameController breakoutGameController,
            CameraConfig cameraConfig)
        {
            var cameraRigGameObject = Instantiate(_cameraRigPrefab);

            cameraRigGameObject.name = _cameraRigPrefab.name;
            var cameraRig = cameraRigGameObject.GetComponent <CameraRigController>();

            cameraRig.BaseCameraPosition      = cameraConfig.baseCameraPosition;
            cameraRig.BaseCameraRotation      = cameraConfig.baseCameraRotation;
            cameraRig.Camera.fieldOfView      = cameraConfig.baseCameraFov;
            cameraRig.MovementSmoothTime      = cameraConfig.movementSmoothTime;
            cameraRig.PaddleFollowCoefficient = cameraConfig.paddleFollowCoefficient;
            cameraRig.BallFollowCoefficient   = cameraConfig.ballLookCoefficient;

            breakoutGameController.AssignCameraRig(cameraRig);
        }
        private void CreateCorner(
            BreakoutGameController breakoutGameController,
            CornerConfig cornerConfig)
        {
            var wallGameObject = Instantiate(_cornerPiecePrefab);

            wallGameObject.name = _cornerPiecePrefab.name;
            var wall = wallGameObject.GetComponent <Wall>();

            var unitSize = breakoutGameController.UnitSize;

            var wallTransform = wallGameObject.transform;

            wallTransform.localPosition = new Vector3(cornerConfig.x * unitSize, 0.0f, cornerConfig.y * unitSize);
            wallTransform.localRotation = Quaternion.Euler(0.0f, cornerConfig.angle, 0.0f);
            wallTransform.localScale    = new Vector3(cornerConfig.size * unitSize, unitSize, cornerConfig.size * unitSize);

            breakoutGameController.AddWall(wall);
        }
        private void CreateWall(
            BreakoutGameController breakoutGameController,
            WallConfig wallConfig)
        {
            var wallGameObject = Instantiate(_wallPrefab);

            wallGameObject.name = _wallPrefab.name;
            var wall = wallGameObject.GetComponent <Wall>();

            wall.WallType = wallConfig.wallType;

            var unitSize = breakoutGameController.UnitSize;

            var wallTransform = wallGameObject.transform;

            wallTransform.localPosition = new Vector3(wallConfig.x * unitSize, 0.0f, wallConfig.y * unitSize);
            wallTransform.localRotation = Quaternion.Euler(0.0f, wallConfig.angle, 0.0f);
            wallTransform.localScale    = new Vector3(wallConfig.width * unitSize, unitSize, unitSize);

            breakoutGameController.AddWall(wall);
        }
        private void CreatePaddle(
            BreakoutGameController breakoutGameController,
            PaddleConfig paddleConfig)
        {
            var paddleGameObject = Instantiate(_paddlePrefab);

            paddleGameObject.name = _paddlePrefab.name;
            var paddle = paddleGameObject.GetComponent <Paddle>();

            var unitSize = breakoutGameController.UnitSize;

            paddle.XExtents = new Vector2(
                -breakoutGameController.GameBoardWidth * 0.5f * unitSize,
                breakoutGameController.GameBoardWidth * 0.5f * unitSize);

            paddle.SetWidth(unitSize, paddleConfig.paddleWidth);
            paddle.SetMaximumSpeed(paddleConfig.maximumSpeed);
            paddle.SetAcceleration(paddleConfig.acceleration);
            paddle.SetDecceleration(paddleConfig.decceleration);
            paddle.MaxBallReflectionAngle = paddleConfig.maxBallReflectionAngle;

            breakoutGameController.AssignPaddle(paddle);
        }
 public AdvanceLevelCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #12
0
 public FadeInCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #13
0
 public void AssignBreakoutGameController(BreakoutGameController breakoutGameController)
 {
     _breakoutGameController = breakoutGameController;
     _breakoutGameController.DesiredHudEnter += OnDesireEnter;
     _breakoutGameController.DesiredHudExit  += OnDesireExit;
 }
Example #14
0
 public void AssignBreakoutGameController
     (BreakoutGameController breakoutGameController)
 {
     _breakoutGameController = breakoutGameController;
     _breakoutGameController.DesiredStartGameScreen += OnRestartGame;
 }
 public DispatchReachedGameOverCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #16
0
 public BreakoutGameCommand(
     BreakoutGameController breakoutGameController
     ) : base()
 {
     _breakoutGameController = breakoutGameController;
 }
 public DispatchDesireStartGameCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #18
0
 public DispatchBeatCurrentLevelCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #19
0
 public ResetGameCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #20
0
 public LaunchBallCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
 public GotoNextLifeCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
 public StartBallLaunchSequenceCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #23
0
 public void AssignBreakoutGameController(BreakoutGameController breakoutGameController)
 {
     _breakoutGameController = breakoutGameController;
     _breakoutGameController.BeatCurrentLevel += OnBeatCurrentLevel;
     _levelUi.LevelController = _breakoutGameController.LevelController;
 }
Example #24
0
 public CreateBallCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #25
0
 public RemoveLifeCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
Example #26
0
 public DispatchDesireHudEnterCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }
 public DestroyBallCommand(BreakoutGameController breakoutGameController) :
     base(breakoutGameController)
 {
 }