/// <summary> /// Замена конструктора, процедура инициализации компонента /// </summary> /// <param name="parEntGameObject">Родительский игровой объект</param> /// <param name="parLevelStartConfig">Стартовая конфигурация игрового уровня</param> public PocketGameViewProvider Init(GameObject parEntGameObject, LevelStartConfig parLevelStartConfig, Player parPlayerData) { base.Init(parEntGameObject, false, true); _levelConfig = parLevelStartConfig; Field = parLevelStartConfig.LevelGameField; BallsPocketed = new List <BallModelData>(); BallsInGame = new List <BallModelData>(); foreach (var ball in parLevelStartConfig.LevelBalls) { BallsInGame.Add(new BallModelData(ball.BallType) { Center = ball.StartCenterPosition }); } PlayerWhiteBall = new BallModelData(parLevelStartConfig.PlayerWhiteBall.BallType) { Center = parLevelStartConfig.PlayerWhiteBall.StartCenterPosition }; BallsInGame.Add(PlayerWhiteBall); ActualPlayer = parPlayerData; PlayerCurrentAimingAngle = START_PLAYER_ANGLE; PlayerChosenShotForce = POWER_MIN; CurrentGameState = EPocketGameState.Init; _playersInputManager = parEntGameObject.LinkedAppModel.GetPlayersManager(); EndLevelResult = ELevelEndResult.None; GameReady = true; return(this); }
/// <summary> /// Стандартный конструктор /// </summary> /// <param name="parLevelName">Название игрового уровня</param> /// <param name="parActualLevelLevelConfig">Связанная стартовая конфигурация уровня</param> public GameLevel(string parLevelName, LevelStartConfig parActualLevelLevelConfig) { LevelName = parLevelName; ActualLevelLevelConfig = parActualLevelLevelConfig; }