private void OnGamePlayStateChanged(GamePlayModel.EGamePlayState gamePlayState)
        {
            Type targetType = null;

            switch (gamePlayState)
            {
            case GamePlayModel.EGamePlayState.Load:
                targetType = typeof(GamePlayStateLoad);
                break;

            case GamePlayModel.EGamePlayState.Gathering:
                targetType = typeof(GamePlayStateGathering);
                break;

            case GamePlayModel.EGamePlayState.Unloading:
                targetType = typeof(GamePlayStateUnloading);
                break;

            case GamePlayModel.EGamePlayState.Pause:
                targetType = typeof(GamePlayStatePause);
                break;
            }

            if (targetType != null &&
                (CurrentStateBehaviour == null ||
                 targetType != CurrentStateBehaviour.GetType()))
            {
                GoToState(targetType);
            }
        }
        private void OnLoadingProgressChanged(BootstrapModel.ELoadingProgress loadingProgress)
        {
            _view.ProgressBar.value = (float)loadingProgress / 100;


            Type targetType = null;

            switch (loadingProgress)
            {
            case BootstrapModel.ELoadingProgress.Zero:
                targetType = typeof(BootstrapStateLoadPopup);
                break;

            case BootstrapModel.ELoadingProgress.PopupLoaded:
                targetType = typeof(BootstrapStateLoadStaticData);
                break;

            case BootstrapModel.ELoadingProgress.MetaNotFound:
                targetType = typeof(BootstrapStateCreateMetaData);
                break;

            case BootstrapModel.ELoadingProgress.StaticDataLoaded:
                targetType = typeof(BootstrapStateLoadUserData);
                break;

            case BootstrapModel.ELoadingProgress.UserNotFound:
                targetType = typeof(BootstrapStateCreateUserData);
                break;

            case BootstrapModel.ELoadingProgress.DataSeeded:
                targetType = typeof(BootstrapStateLoadHud);
                break;

            case BootstrapModel.ELoadingProgress.HudLoaded:
                targetType = typeof(BootstrapStateLoadMainHub);
                break;

            case BootstrapModel.ELoadingProgress.MainHub:
                targetType = typeof(BootstrapStateMainHub);
                break;

            case BootstrapModel.ELoadingProgress.GamePlay:
                targetType = typeof(BootstrapStateGamePlay);
                break;
            }

            if (targetType != null &&
                (CurrentStateBehaviour == null ||
                 targetType != CurrentStateBehaviour.GetType()))
            {
                GoToState(targetType);
            }
        }
Example #3
0
 public override void GoToState(Type stateType)
 {
     if (StateBehaviours.ContainsKey(stateType))
     {
         if (CurrentStateBehaviour != null)
         {
             CurrentStateBehaviour.OnStateExit();
         }
         CurrentStateBehaviour = StateBehaviours[stateType];
         CurrentStateBehaviour.OnStateEnter();
         _currentInputStateBehaviour = (InputStateBehaviour)CurrentStateBehaviour;
     }
     else
     {
         Debug.LogError(string.Format("{0} : GoToState( {1} ) type does not exist in state machine", this, stateType));
     }
 }
        private void OnMainHubStateChanged(MainHubModel.EMainHubState mainHubState)
        {
            Type targetType = null;

            switch (mainHubState)
            {
            case MainHubModel.EMainHubState.Default:
                targetType = typeof(MainHubStateDefault);
                break;

            default:
                Debug.LogError("Add the Missing State.");
                break;
            }

            if (targetType != null &&
                (CurrentStateBehaviour == null ||
                 targetType != CurrentStateBehaviour.GetType()))
            {
                GoToState(targetType);
            }
        }
Example #5
0
        private void OnHudStateChanged(HudModel.EHudState hudState)
        {
            Type targetType = null;

            switch (hudState)
            {
            case HudModel.EHudState.Hidden:
                targetType = typeof(HudStateHidden);
                break;

            case HudModel.EHudState.GamePlay:
                targetType = typeof(HudStateGamePlay);
                break;
            }

            if (targetType != null &&
                (CurrentStateBehaviour == null ||
                 targetType != CurrentStateBehaviour.GetType()))
            {
                GoToState(targetType);
            }
        }