public override void Initialize() { base.Initialize(); StateBehaviours.Add((int)GamePlayModel.EGamePlayState.Load, new GamePlayStateLoad(this)); StateBehaviours.Add((int)GamePlayModel.EGamePlayState.Gathering, new GamePlayStateGathering(this)); StateBehaviours.Add((int)GamePlayModel.EGamePlayState.Unloading, new GamePlayStateUnloading(this)); StateBehaviours.Add((int)GamePlayModel.EGamePlayState.Pause, new GamePlayStatePause(this)); OnGamePlayStateChanged(GamePlayModel.EGamePlayState.Load); // Observing Remote Data. _remoteDataModel.AnimalRemoteDatas.ObserveAdd().Subscribe(OnAnimalAdd).AddTo(Disposables); _remoteDataModel.AnimalRemoteDatas.ObserveRemove().Subscribe(OnAnimalRemove).AddTo(Disposables); _remoteDataModel.HeroRemoteModel.Subscribe(OnHeroAdded).AddTo(Disposables); // Resetting GameTime SignalBus.Fire <ResetGameSignal>(); // Check after each three second for new Animals. Observable.Timer(TimeSpan.FromSeconds(3)).Repeat() .Subscribe((interval) => SignalBus.Fire <SpawnIfSpaceSignal>()) .AddTo(Disposables); // Timer Tick Observable.Timer(TimeSpan.FromSeconds(1)).Repeat() .Subscribe((interval) => SignalBus.Fire <GameTickSignal>()) .AddTo(Disposables); _gamePlayModel.GamePlayState.Subscribe(OnGamePlayStateChanged).AddTo(Disposables); _view.BackButton.onClick.AddListener(OnBackButtonClicked); }
public override void Initialize() { base.Initialize(); StateBehaviours.Add(typeof(MainHubStateDefault), new MainHubStateDefault(this)); _bootstrapModel.LoadingProgress.Subscribe(OnBootstrapState).AddTo(Disposables); _mainHubModel.MainHubState.Subscribe(OnMainHubStateChanged).AddTo(Disposables); }
public override void Initialize() { base.Initialize(); StateBehaviours.Add((int)HudModel.EHudState.StartupScreen, new HudStateStartup(this)); _remoteDataModel.IdleCash.Subscribe(OnIdleCashUpdate).AddTo(Disposables); _remoteDataModel.Cash.Subscribe(OnCashUpdate).AddTo(Disposables); _remoteDataModel.SuperCash.Subscribe(OnSuperCashUpdate).AddTo(Disposables); _hudModel.HudState.Subscribe(OnHudStateChanged).AddTo(Disposables); }
public override void Initialize() { base.Initialize(); StateBehaviours.Add((int)HudModel.EHudState.Hidden, new HudStateHidden(this)); StateBehaviours.Add((int)HudModel.EHudState.GamePlay, new HudStateGamePlay(this)); _remoteDataModel.Coins.Subscribe(OnIdleCashUpdate).AddTo(Disposables); _remoteDataModel.HeroModel.RemainingTime.Subscribe(OnTimerUpdate).AddTo(Disposables); _bootstrapModel.LoadingProgress.Subscribe(OnLoadingStateChange).AddTo(Disposables); _hudModel.HudState.Subscribe(OnHudStateChanged).AddTo(Disposables); }
public override void Initialize() { base.Initialize(); // TODO: Odd collection. Figure something out for states tracking. StateBehaviours.Add((int)StartupModel.ELoadingProgress.LoadPopup, new StartupStateLoadPopup(this)); StateBehaviours.Add((int)StartupModel.ELoadingProgress.LoadStaticData, new StartupStateLoadStaticData(this)); StateBehaviours.Add((int)StartupModel.ELoadingProgress.LoadUserData, new StartupStateLoadUserData(this)); StateBehaviours.Add((int)StartupModel.ELoadingProgress.CreateUserData, new StartupStateCreateUserData(this)); StateBehaviours.Add((int)StartupModel.ELoadingProgress.LoadHud, new StartupStateLoadHud(this)); StateBehaviours.Add((int)StartupModel.ELoadingProgress.LoadGamePlay, new StartupStateLoadGamePlay(this)); StateBehaviours.Add((int)StartupModel.ELoadingProgress.GamePlay, new StartupStateGamePlay(this)); _startupModel.LoadingProgress.Subscribe(OnLoadingProgressChanged).AddTo(Disposables); }
public override void Initialize() { base.Initialize(); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.LoadPopup, new BootstrapStateLoadPopup(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.LoadStaticData, new BootstrapStateLoadStaticData(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.CreateMetaData, new BootstrapStateCreateMetaData(this)); // Temporary State for creating MetaData StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.LoadUserData, new BootstrapStateLoadUserData(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.CreateUserData, new BootstrapStateCreateUserData(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.LoadHud, new BootstrapStateLoadHud(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.LoadMainHub, new BootstrapStateLoadMainHub(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.MainHub, new BootstrapStateMainHub(this)); StateBehaviours.Add((int)BootstrapModel.ELoadingProgress.GamePlay, new BootstrapStateGamePlay(this)); _bootstrapModel.LoadingProgress.Subscribe(OnLoadingProgressChanged).AddTo(Disposables); }
public override void Initialize() { base.Initialize(); // TODO: Perform this action with Command. _gameplayApi.Initialise(); // Binding View and Model. BindView(); StateBehaviours.Add((int)ERouletteState.Setup, new RouletteStateSetup(this)); StateBehaviours.Add((int)ERouletteState.Start, new RouletteStateStart(this)); StateBehaviours.Add((int)ERouletteState.Spinner, new RouletteStateSpinner(this)); StateBehaviours.Add((int)ERouletteState.Result, new RouletteStateResult(this)); _iModel.SubscribeState(OnLoadingProgressChanged).AddTo(Disposables); }
public override void Initialize() { base.Initialize(); StateBehaviours.Add((int)GamePlayModel.EGamePlayState.Game, new GamePlayStateDefault(this)); foreach (ShaftRemoteDataModel shaft in _remoteDataModel.Shafts) { SetupShaft(shaft); } _remoteDataModel.Shafts.ObserveAdd().Subscribe(OnShaftAdd).AddTo(Disposables); _remoteDataModel.Warehouse.ReactiveWarehouse.Subscribe(_view.UpdateWarehouse).AddTo(Disposables); _remoteDataModel.Elevator.ReactiveElevator.Subscribe((e) => { _view.UpdateElevator(e, _remoteDataModel.Shafts.Count * Constants.ShaftDistance); }); _view.SubscribeUpgradeElevator(OnElevatorUpgradeRequest); _view.SubscribeUpgradeWareHouse(OnWareHouseUpgradeRequest); _gamePlayModel.GamePlayState.Subscribe(OnGamePlayStateChanged).AddTo(Disposables); }