Esempio n. 1
0
        public new SimulationModel InitModel()
        {
            _gameConfig   = GameCore.GetModel <SettingsModel>().GameConfigs.GameConfig;
            _physicsModel = SimulationSingletons.TryAddSingletonModel(CreateModel <CirclePhysics>()).InitModel();
            _areaModel    = SimulationSingletons.TryAddSingletonModel(CreateModel <AreaModel>())
                            .InitModel()
                            .SetView(null).Model;
            TeamsModelBase.UnitsSpawned += OnSpawnComplete;

            _teamsModel = SimulationSingletons.TryAddSingletonModel(CreateModel <TeamsModel <CircleUnitModel> >())
                          .InitModel();
            SimulationSingletons.TryAddSingletonModel(CreateModel <CameraModel>())
            .InitModel(_gameConfig.gameAreaWidth, _gameConfig.gameAreaHeight)
            .SetView();

            _updatableModels = SimulationSingletons.GetUpdatableModels();

            TeamBase.Lose += inx =>
            {
                if (_isGameOver)
                {
                    return;
                }

                _isGameOver = true;
                SimulationEnd?.Invoke(_simulationTime, _teamsModel.TheVictoriousTeam.TeamColor);
            };

            MainUIModel.NewBtnClick += Restart;

            return(this);
        }
Esempio n. 2
0
        protected override void OnOwnerSet()
        {
            Owner.Forum.RegisterListener<PlayerLaunched>(item => m_LaunchTime = LAUNCH_DURATION);

            m_Physics = Owner.Parent.GetComponent<CirclePhysics>();

            base.OnOwnerSet();
        }