Esempio n. 1
0
        public void ChangeState(TState state)
        {
            if (EqualityComparer <TState> .Default.Equals(currentState, state))
            {
                return;
            }
            prevState    = currentState;
            currentState = state;

            if (changeStateEvent != null)
            {
                changeStateEvent.Invoke(currentState);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="animator"></param>
        /// <param name="stateInfo"></param>
        /// <param name="layerIndex"></param>
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            _animator = animator;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                controller.Initialize();
                controller.gs2MoneySetting.StartCoroutine(
                    InitializeTask()
                    );
            }
            if (stateInfo.IsName(State.GetWalletProcessing.ToString()))
            {
                controller.gs2MoneySetting.StartCoroutine(
                    GetWalletTask()
                    );
            }

            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    _state = state;
                    onChangeState.Invoke(animator, state);
                    break;
                }
            }
        }
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            State?newState = null;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                // 初期化処理
                controller.StartCoroutine(
                    Initialize(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.CreateGathering.ToString()))
            {
                //
                controller.StartCoroutine(
                    SimpleMatchmakingCreateGathering(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.JoinGathering.ToString()))
            {
                //
                controller.StartCoroutine(
                    SimpleMatchmakingJoinGathering(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.CancelMatchmaking.ToString()))
            {
                //
                controller.StartCoroutine(
                    CancelMatchmaking(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.MatchmakingComplete.ToString()))
            {
                //
                animator.SetTrigger(Trigger.ResultCallback.ToString());
            }
            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    newState = state;
                    break;
                }
            }

            // ステート変化を通知
            if (newState.HasValue)
            {
                onChangeState.Invoke(animator, newState.Value);
            }
        }
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            _animator = animator;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                moneyController.Initialize();
                staminaController.Initialize();
                GameObject.Find("Gs2StaminaInternalSetting").GetComponent <Gs2StaminaInternalSetting>().onOpenStatus.Invoke();
                GameObject.Find("Gs2MoneyInternalSetting").GetComponent <Gs2MoneyInternalSetting>().onOpenStatus.Invoke();
            }
            if (stateInfo.IsName(State.ConsumeProgress.ToString()))
            {
                staminaController.gs2StaminaSetting.StartCoroutine(
                    ConsumeStaminaTask(10)
                    );
            }

            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    _state = state;
                    onChangeState.Invoke(animator, state);
                    break;
                }
            }
        }
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            State?newState = null;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                controller.StartCoroutine(
                    Initialize(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.GetTakeOverSettingsProcessing.ToString()))
            {
                controller.StartCoroutine(
                    GetTakeOverSettings(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.SetTakeOverProcessing.ToString()))
            {
                controller.StartCoroutine(
                    SetTakeOverSetting(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.DoTakeOverProcessing.ToString()))
            {
                controller.StartCoroutine(
                    DoTakeOver(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.DeleteTakeOverProcessing.ToString()))
            {
                controller.StartCoroutine(
                    DeleteTakeOverSetting(
                        animator
                        )
                    );
            }
            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    newState = state;
                    break;
                }
            }

            // ステート変化を通知
            if (newState.HasValue)
            {
                onChangeState.Invoke(animator, newState.Value);
            }
        }
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            State?newState = null;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                // 初期化処理
                controller.StartCoroutine(
                    Initialize(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.GetRoom.ToString()))
            {
                //
                controller.StartCoroutine(
                    GetRoom(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.ConnectRoom.ToString()))
            {
                //
                controller.StartCoroutine(
                    ConnectRoom(
                        animator
                        )
                    );
            }
            else if (stateInfo.IsName(State.SyncPlayerProfiles.ToString()))
            {
                //
                controller.StartCoroutine(
                    SyncPlayerProfiles(
                        animator
                        )
                    );
            }
            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    newState = state;
                    break;
                }
            }

            // ステート変化を通知
            if (newState.HasValue)
            {
                onChangeState.Invoke(animator, newState.Value);
            }
        }
Esempio n. 7
0
        private void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var backendFinding = _brainstromingDalService.GetFinding(_context.CurrentFinding.Id);

            if (backendFinding?.CurrentRound != _context.CurrentFinding.CurrentRound)
            {
                _context.CurrentFinding = backendFinding;
                _logger.Info("Brainstorming has started, changing state to running");
                ChangeStateEvent?.Invoke(new RunningState(_logger, _brainstromingDalService, _context, _brainstormingModel));
            }
        }
Esempio n. 8
0
 public void ChangeState(T nowValue)
 {
     if (ChangeStateEvent != null)
     {
         ChangeStateEvent.Invoke(nowValue);
     }
     if (TmpChangeStateEvent != null)
     {
         TmpChangeStateEvent.Invoke(nowValue);
     }
     NowValue  = nowValue;
     IsSpecial = true;
 }
Esempio n. 9
0
        private void UpdateRound()
        {
            _nextCheckRoundTimer.Stop();
            var backendFinding = _brainstormingDalService.GetFinding(_context.CurrentFinding.Id);

            if (backendFinding?.CurrentRound == -1)
            {
                _context.CurrentFinding = backendFinding;
                ChangeStateEvent?.Invoke(new EndedState(_context, _brainstormingModel));
                return;
            }
            else if (backendFinding?.CurrentRound != _context.CurrentFinding.CurrentRound)
            {
                _context.CurrentFinding = backendFinding;
                _logger.Info("Round has changed, proceeding to next round");
                NextRound();
            }
            _nextCheckRoundTimer.Start();
        }
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            _animator = animator;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                controller.Initialize();
                GameObject.Find("Gs2MoneyInternalSetting").GetComponent <Gs2MoneyInternalSetting>().onOpenStatus.Invoke();
            }

            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    _state = state;
                    onChangeState.Invoke(animator, state);
                    break;
                }
            }
        }
Esempio n. 11
0
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            _animator = animator;

            if (stateInfo.IsName(State.StartProcessing.ToString()))
            {
                controller.Initialize();
                controller.gs2QuestSetting.StartCoroutine(
                    StartTask()
                    );
            }
            if (stateInfo.IsName(State.SendCompleteResult.ToString()))
            {
                controller.gs2QuestSetting.StartCoroutine(
                    EndTask(
                        _progress.Rewards,
                        true
                        )
                    );
            }
            if (stateInfo.IsName(State.SendFailedResult.ToString()))
            {
                controller.gs2QuestSetting.StartCoroutine(
                    EndTask(
                        _progress.Rewards,
                        false
                        )
                    );
            }

            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    _state = state;
                    onChangeState.Invoke(animator, state);
                    break;
                }
            }
        }
Esempio n. 12
0
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            _animator = animator;

            if (stateInfo.IsName(State.GetQuestGroupProcessing.ToString()))
            {
                staminaController.Initialize();
                questController.Initialize();
                questController.gs2QuestSetting.StartCoroutine(
                    GetQuestGroupsTask()
                    );
            }
            if (stateInfo.IsName(State.GetQuestProcessing.ToString()))
            {
                questController.gs2QuestSetting.StartCoroutine(
                    GetQuestsTask()
                    );
            }
            if (stateInfo.IsName(State.CheckStamina.ToString()))
            {
                questController.gs2QuestSetting.StartCoroutine(
                    CheckStaminaTask(
                        selectQuest
                        )
                    );
            }

            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    _state = state;
                    onChangeState.Invoke(animator, state);
                    break;
                }
            }
        }
Esempio n. 13
0
 public void OnChangeStateEvent(object sender, ChangeStateEventArgs e)
 {
     ChangeStateEvent?.Invoke(sender, e);
 }
Esempio n. 14
0
 void PublishChangeStateEvent()
 {
     ChangeStateEvent?.Invoke(this);
 }
Esempio n. 15
0
        /// <summary>
        /// ステートマシンのステートが変化したときのイベントハンドラ
        /// </summary>
        /// <param name="animator"></param>
        /// <param name="stateInfo"></param>
        /// <param name="layerIndex"></param>
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            State?newState = null;

            if (stateInfo.IsName(State.Initialize.ToString()))
            {
                // 初期化処理
                controller.StartCoroutine(
                    Initialize(animator)
                    );
            }
            else if (stateInfo.IsName(State.LoadAccount.ToString()))
            {
                // アカウント情報のロード
                controller.StartCoroutine(
                    LoadAccount(animator)
                    );
            }
            else if (stateInfo.IsName(State.CreateAccountProcessing.ToString()))
            {
                // アカウントの作成処理
                controller.StartCoroutine(
                    Registration(animator)
                    );
            }
            else if (stateInfo.IsName(State.SaveAccount.ToString()))
            {
                // アカウントの永続化処理
                controller.StartCoroutine(
                    SaveAccount(animator)
                    );
            }
            else if (stateInfo.IsName(State.LoginProcessing.ToString()))
            {
                // ログイン処理
                controller.StartCoroutine(
                    Login(animator)
                    );
            }
            else if (stateInfo.IsName(State.LoginComplete.ToString()))
            {
                // ログイン完了
                animator.SetTrigger(Trigger.ResultCallback.ToString());
            }
            else if (stateInfo.IsName(State.RemoveAccountProcessing.ToString()))
            {
                // アカウント削除処理
                controller.StartCoroutine(
                    RemoveAccount(animator)
                    );
            }
            foreach (State state in Enum.GetValues(typeof(State)))
            {
                if (stateInfo.IsName(state.ToString()))
                {
                    newState = state;
                    break;
                }
            }

            // ステート変化を通知
            if (newState.HasValue)
            {
                onChangeState.Invoke(animator, newState.Value);
            }
        }