Esempio n. 1
0
        /// <summary>
        /// Замена конструктора, процедура инициализации компонента
        /// </summary>
        /// <param name="parEntGameObject">Родительский игровой объект</param>
        public ResultsScreenComponent Init(GameObject parEntGameObject, Player parPlayer)
        {
            base.Init(parEntGameObject, false, true);

            parEntGameObject.LinkedAppModel.GetSoundManager().PlayBgMusic(EAppMusicAssets.LevelResults, true);

            CurrentStage = EResultsScreenStage.ChooseNextAction;
            FinalChoice  = EResultsScreenFinalChoice.None;
            IsBankAndExitActionSelected = false;
            CurrentPlayerName           = "";

            _playersManager = parEntGameObject.LinkedAppModel.GetPlayersManager();
            _mainPlayer     = _playersManager.Player1;

            PlayerActualData = parPlayer;

            IsAlive = true;

            return(this);
        }
        /// <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);
        }