public BreakoutGameController CreateBreakoutGame(BreakoutGameConfig config, LevelConfig[] levels) { var breakoutGameController = InstantiateBreakoutGame(config, levels); var gameBoardConfig = config.gameBoardConfig; CreateWalls(breakoutGameController, gameBoardConfig); var cameraConfig = config.cameraConfig; CreateCamera(breakoutGameController, cameraConfig); var paddleConfig = config.paddleConfig; CreatePaddle(breakoutGameController, paddleConfig); return(breakoutGameController); }
private BreakoutGameController InstantiateBreakoutGame(BreakoutGameConfig config, LevelConfig[] levels) { var breakoutGameObject = Instantiate(_breakoutGamePrefab); var breakoutGameController = breakoutGameObject.GetComponent <BreakoutGameController>(); breakoutGameObject.name = _breakoutGamePrefab.name; var gameBoardConfig = config.gameBoardConfig; breakoutGameController.GameBoardWidth = gameBoardConfig.gameBoardWidth; breakoutGameController.GameBoardHeight = gameBoardConfig.gameBoardHeight; breakoutGameController.HorizontalPaddingPercent = gameBoardConfig.horizontalPaddingPercent; breakoutGameController.VerticalPaddingPercent = gameBoardConfig.verticalPaddingPercent; breakoutGameController.UnitSize = gameBoardConfig.unitSize; breakoutGameController.BrickMeshScale = gameBoardConfig.brickMeshScale; var gameplayConfig = config.gameplayConfig; breakoutGameController.LivesController.DefaultLives = gameplayConfig.numLives; breakoutGameController.LevelController.Levels = levels; return(breakoutGameController); }