protected internal override void OnUpdate(IFSM <ProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
            Debug.Log("ProcedureC OnUpdate()");

            ProcedureManager.Instance.ChangeProcedure <ProcedureA>();
        }
        private void PopulateComboBoxes(IFSM <StructAtom <string>, StructAtom <string> > fsm)
        {
            cbxDestState.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            cbxOutput.Properties.TextEditStyle    = TextEditStyles.DisableTextEditor;
            cbxDestState.Properties.Items.AddRange(fsm.StateSet);
            cbxOutput.Properties.Items.AddRange(fsm.OutputSet);

            var selectedState  = fsm.StateSet.FirstOrDefault(s => s.KeyName == StateKey);
            var selectedOutput = fsm.OutputSet.FirstOrDefault(o => o.KeyName == OutputKey);

            if (selectedState != null)
            {
                cbxDestState.SelectedItem = selectedState;
            }
            else
            {
                cbxDestState.SelectedIndex = 0;
            }

            if (selectedOutput != null)
            {
                cbxOutput.SelectedItem = selectedOutput;
            }
            else
            {
                cbxOutput.SelectedIndex = 0;
            }
        }
Example #3
0
    protected internal override void OnUpdate(IFSM <GameManager> fsm, float elapseSeconds, float realElapseSeconds)
    {
        base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);

        m_StateTime -= elapseSeconds;
        if (m_StateTime <= 0)
        {
            if (waitcount > 0)
            {
                EnemyManager.m_Instance.AllDie();
                waitcount--;
            }
            else
            {
                EnemyManager.m_Instance.AllDieOver();
                Debug.Log("End Home");
                ChangeState <GameState_Running>(fsm);
            }
        }

        fsm.Owner.m_RunningTime += elapseSeconds;

        //临时这样写 应该融进整体架构 统一间隔时间
        PlayerManager.m_Instance.GameUpdate(elapseSeconds);
    }
Example #4
0
        protected internal override void OnUpdate(IFSM <ProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);

            //循环调用
            drillModule.GetCurrentGame().FixedUpdate(elapseSeconds, realElapseSeconds);
        }
Example #5
0
        protected internal override void OnLeave(IFSM <ProcedureManager> procedureOwner, bool isShutdown)
        {
            base.OnLeave(procedureOwner, isShutdown);

            //加载场景
            ScenesManager.Instance.LoadSceneAsync(SceneDef.HomeScene);
        }
Example #6
0
    protected internal override void OnExit(IFSM <GameManager> fsm, bool isShutdown)
    {
        base.OnExit(fsm, isShutdown);

        //Play Effect

        //Stop Sound
    }
Example #7
0
        public BFSMEmptyState(IFSM <TState, TTrigger> stateMachine, TState state) : base(stateMachine, state)
        {
            StateMachine = stateMachine;

            InnerState = state;

            behaviours = new List <IBFSMStateBehaviour <TState, TTrigger> >();
        }
Example #8
0
 protected override void ProcedureLoop(IFSM t_StateOwner)
 {
     UnityEngine.Debug.Log("ProcedureLuanch ProcedureLoop " + StateStayRealWorldTime + "    " + StateStayTotalRealWorldTime);
     if (5f < StateStayRealWorldTime)
     {
         ChangeProcedure <ProcedureMain>();
     }
 }
        public Boolean CallFSM(SafeID tID, String tReturnID, params Object[] tArgs)
        {
            if (!this.Available)
            {
                return(false);
            }
            else if (!this.IsActive)
            {
                return(false);
            }

            lock (m_Locker)
            {
                State tTarget = m_FreeStateSet.Find(tID);
                if (null != tTarget)
                {
                    if (!tTarget.Available)
                    {
                        return(false);
                    }


                    if (tTarget.IsFSM)
                    {
                        IFSM tFSM = tTarget as IFSM;
                        if (null == tFSM)
                        {
                            return(false);
                        }
                        m_FreeStateSet.Remove(tID);
                        m_ActiveFSMSet.Add(tTarget);
                        tFSM.Reset();
                        do
                        {
                            miniFSM tminiFSM = tFSM as miniFSM;
                            if (null == tminiFSM)
                            {
                                break;
                            }
                            tminiFSM.m_ReturnStateID = tReturnID;
                        }while (false);

                        tFSM.Start(tArgs);
                    }
                    else
                    {
                        m_FreeStateSet.Remove(tID);
                        m_ActiveStateSet.Add(tTarget);
                    }
                }
            }

            m_StateChanged = true;

            RefreshState();

            return(true);
        }
Example #10
0
        public bool DestroyFSM <T>(IFSM <T> fsm) where T : class
        {
            if (fsm == null)
            {
                throw new Exception("FSM is invalid.");
            }

            return(InternalDestroyFSM(typeof(T).FullName));
        }
Example #11
0
 protected internal override void OnUpdate(IFSM <GameManager> fsm, float elapseSeconds, float realElapseSeconds)
 {
     base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);
     m_waittime -= elapseSeconds;
     if (m_waittime <= 0)
     {
         SceneManager.LoadScene("EndScene");
     }
 }
Example #12
0
        /// <summary>
        /// 销毁有限状态机。
        /// </summary>
        /// <typeparam name="T">有限状态机持有者类型。</typeparam>
        /// <param name="fsm">要销毁的有限状态机。</param>
        /// <returns>是否销毁有限状态机成功。</returns>
        public bool DestroyFsm <T>(IFSM <T> fsm) where T : class
        {
            if (fsm == null)
            {
                throw new Exception("FSM is invalid.");
            }

            return(DestroyFsm <T>(fsm.Name));
        }
Example #13
0
    protected internal override void OnEnter(IFSM <GameManager> fsm)
    {
        base.OnEnter(fsm);

        m_HomeCoolDownTime = GameConfig.BecameHomeCooldown;
        //SoundManager
        MusicManager.GetInstance().BGMCtrl_High.StopBGM();
        MusicManager.GetInstance().BGMCtrl.PlayBGM("battle");
        MusicManager.GetInstance().BGMCtrl.ResumeBGM();
    }
Example #14
0
        /// <summary>
        /// 条件轮询
        /// </summary>
        /// <param name="t_StateOwner">条件的持有者-状态机</param>
        /// <returns>返回条件结果</returns>
        protected internal override bool OnConditionLoop(IFSM t_ConditionOwner)
        {
            bool t_ConditionState = ConditionLoop(t_ConditionOwner);

            if (null != ConditionUpdateEventHandler)
            {
                ConditionUpdateEventHandler(t_ConditionState);
            }
            return(t_ConditionState);
        }
Example #15
0
        protected internal override void OnEnter(IFSM <ProcedureManager> procedureOwner)
        {
            base.OnEnter(procedureOwner);

            //加载UI
            UIManager.Instance.OpenPage(UIDef.MainPage);

            //加载BGM
            AudioManager.Instance.PlayBGM(AudioDef.BGM_MainBGM, 0.2f);
        }
Example #16
0
    protected internal override void OnEnter(IFSM <GameManager> fsm)
    {
        base.OnEnter(fsm);

        GameDataMgr.instance.m_CurTime  = fsm.Owner.m_RunningTime;
        GameDataMgr.instance.m_CurScore = fsm.Owner.m_Score;
        m_waittime = 2.0f;

        GameConfig.s_BulletBeginSpeed = GameConfig.BulletBeginSpeed;
        //Play UI
    }
        public override async void OnEnter(IFSM <Launcher> fsm)
        {
            ModuleManager.Instance.GetModule <IResourceManager>();
            ModuleManager.Instance.GetModule <IAudioManager>();

            scriptManager = ScriptManager.Instance;
            scriptManager.SetReginster(new AdaptorReginster(), new CLRBinderReginster(), new ValueTypeBinderReginster(), new DelegateConvertor());
            await scriptManager.Load("Code");

            scriptManager.InvokeMethod("Game.Hotfix.Main", "Initialize");
        }
Example #18
0
        protected internal override void OnUpdate(IFSM <ProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);

            //播放Splash动画

            //检查版本

            //切换场景
            ProcedureManager.Instance.ChangeProcedure <ProcedureChageScene>();
        }
        public Boolean Deactive(params SafeID[] tIDs)
        {
            if (!this.Available)
            {
                return(false);
            }
            else if (!this.IsActive)
            {
                return(false);
            }
            else if (null == tIDs)
            {
                return(false);
            }
            else if (0 == tIDs.Length)
            {
                return(false);
            }

            lock (m_Locker)
            {
                foreach (SafeID tID in tIDs)
                {
                    State tTarget = m_ActiveFSMSet.Find(tID);
                    if (null != tTarget)
                    {
                        m_ActiveFSMSet.Remove(tID);
                        IFSM tFSM = tTarget as IFSM;
                        if (null != tFSM)
                        {
                            do
                            {
                                tFSM.RequestStop();
                            }while (tFSM.IsActive);
                            tFSM.Reset();
                        }
                        m_FreeStateSet.Add(tTarget);
                    }

                    tTarget = m_ActiveStateSet.Find(tID);
                    if (null != tTarget)
                    {
                        tTarget.StopSignal.Set();

                        m_ActiveStateSet.Remove(tID);
                        m_FreeStateSet.Add(tTarget);
                    }
                }
            }

            RefreshState();

            return(true);
        }
Example #20
0
        public void ChangeState <TState>(IFSM <T> fsm) where TState : IState <T>
        {
            IFSM <T> fsmImplement = (IFSM <T>)fsm;

            if (fsmImplement == null)
            {
                return;
            }

            fsmImplement.ChangeState <TState>();
        }
Example #21
0
 /// <summary>
 ///状态检测事件;
 /// </summary>
 public virtual void Reason(IFSM <T> fsm)
 {
     for (int i = 0; i < triggerList.Count; i++)
     {
         if (triggerList[i].Handler(fsm))
         {
             fsm.ChangeState(GetTriggeredState(triggerList[i]).GetType());
             return;
         }
     }
 }
Example #22
0
        /// <summary>
        /// 切换当前有限状态机状态。
        /// </summary>
        /// <typeparam name="TState">要切换到的有限状态机状态类型。</typeparam>
        /// <param name="fsm">有限状态机引用。</param>
        protected void ChangeState <TState>(IFSM <T> fsm) where TState : FSMState <T>
        {
            FSM <T> fsmImplement = (FSM <T>)fsm;

            if (fsmImplement == null)
            {
                //throw new GameFrameworkException("FSM is invalid.");
            }

            fsmImplement.ChangeState <TState>();
        }
Example #23
0
    protected internal override void OnExit(IFSM <GameManager> fsm, bool isShutdown)
    {
        base.OnExit(fsm, isShutdown);


        PlayerManager.m_Instance.CreatePlayers();

        EnemyManager.m_Instance.InitEnemyManager();

        //Close UI
    }
Example #24
0
    protected internal override void OnEnter(IFSM <GameManager> fsm)
    {
        base.OnEnter(fsm);

        MusicManager.GetInstance().FindController();

        m_Waittime = WaitTime;

        fsm.Owner.m_RunningTime = 0;
        //Show UI
    }
Example #25
0
    protected internal override void OnUpdate(IFSM <GameManager> fsm, float elapseSeconds, float realElapseSeconds)
    {
        base.OnUpdate(fsm, elapseSeconds, realElapseSeconds);

        m_Waittime -= elapseSeconds;

        if (m_Waittime <= 0)
        {
            ChangeState <GameState_Running>(fsm);
        }
    }
Example #26
0
        protected internal override void OnEnter(IFSM <ProcedureManager> procedureOwner)
        {
            base.OnEnter(procedureOwner);

            splashOver = false;

            //加载Splash动画
            UIManager.Instance.OpenPage(UIDef.SplashPage);

            //加载场景
            //ScenesManager.Instance.LoadSceneAsync(SceneDef.HomeScene,false, () => { sceneLoadOver = true; });
        }
Example #27
0
        /// <summary>
        /// 响应有限状态机事件时调用。
        /// </summary>
        /// <param name="fsm">有限状态机引用。</param>
        /// <param name="sender">事件源。</param>
        /// <param name="eventId">事件编号。</param>
        /// <param name="userData">用户自定义数据。</param>
        internal void OnEvent(IFSM <T> fsm, object sender, int eventId, object userData)
        {
            FsmEventHandler <T> eventHandlers = null;

            if (m_EventHandlers.TryGetValue(eventId, out eventHandlers))
            {
                if (eventHandlers != null)
                {
                    eventHandlers(fsm, sender, userData);
                }
            }
        }
        protected internal override void OnEnter(IFSM <ProcedureManager> procedureOwner)
        {
            base.OnEnter(procedureOwner);

            //停止所有声音

            //隐藏所有实体

            //卸载所有场景

            //还原游戏速度
        }
Example #29
0
        private void Start()
        {
            //  yield return new WaitForSeconds(2f);

            m_FSMManager = GameBox.GetComponent <FSMComponent>(); //获取状态机管家组件
            m_IFSM       = m_FSMManager.CreateFSM("Demo");        //创建一个状态机
            m_IFSM.AddState <StateOne>();
            m_IFSM.AddState(typeof(StateTwo));
            m_IFSM.AddCondition <ConditionOne>();
            m_IFSM.AddCondition <ConditionTwo>();
            m_IFSM.ChangeState <StateOne>(); //初始状态
        }
Example #30
0
        // Use this for initialization
        void Start()
        {
            ModuleManager.Instance.Init("LarkFramework.FSM.Example");

            TickManager.Instance.Init();

            FSMManager.Instance.Init();

            fsm = FSMManager.Instance.CreateFsm("Testfsm", this, new FSMA(), new FSMB());

            fsm.Start <FSMA>();
        }
 public ProcessingState(IFSM fsm)
     : base(fsm)
 {
 }
 public MainPhaseState(IFSM fsm)
     : base(fsm)
 {
     this.initStates();
 }
 public MainPhaseSummonUnitState(IFSM fsm)
     : base(fsm)
 {
     this._summoningPosList = new int[BattleConsts.MapMaxRow * BattleConsts.MapMaxCol];
 }
 public MainPhaseIdleState(IFSM fsm)
     : base(fsm)
 {
 }
 public MainPhaseSelectUnitActionState(IFSM fsm)
     : base(fsm)
 {
     this._isInit = false;
     this._isPopUp = false;
 }
 public StandbyPhaseState(IFSM fsm)
     : base(fsm)
 {
 }
 public MainPhaseSelectMovePathState(IFSM fsm)
     : base(fsm)
 {
     this._pathList = new List<Cell>();
 }
 public TurnStartPhaseState(IFSM fsm)
     : base(fsm)
 {
 }
 public MainPhaseUnitAttackState(IFSM fsm)
     : base(fsm)
 {
 }
 public MainPhaseSelectAttackTargetState(IFSM fsm)
     : base(fsm)
 {
     this._fsm = fsm;
 }
 public MainPhaseMoveUnitState(IFSM fsm)
     : base(fsm)
 {
 }
 public BattleStateBase(IFSM fsm)
 {
     this._fsm = fsm;
 }
 public InitGameState(IFSM fsm)
     : base(fsm)
 {
 }
 public MainPhaseCounterAttackState(IFSM fsm)
     : base(fsm)
 {
     this._fsm = fsm;
 }