public void Start <T>() where T : OperateStateBase { if (fsm == null) { return; } fsm.Start <T>(); }
public void StartAction <T>() where T : ActionBase { if (null == m_ActionFsm) { throw new GameFrameworkException("You must initialize action first."); } m_ActionFsm.Start <T>(); }
/// <summary> /// 开始状态 /// </summary> /// <typeparam name="T">要开始的状态类型.</typeparam> public void StartState <T>() where T : CharacterStateBase { if (m_StateFsm == null) { throw new GameFrameworkException("You must initialize states first."); } m_StateFsm.Start <T> (); }
/// <summary> /// 开始流程。 /// </summary> /// <typeparam name="T">要开始的流程类型。</typeparam> public void Start <T>() where T : StageBase { if (_stageFsm == null) { throw new GameException("You must initialize procedure first."); } _stageFsm.Start <T>(); }
/// <summary> /// 开始流程。 /// </summary> /// <typeparam name="T">要开始的流程类型。</typeparam> public void StartProcedure <T>() where T : ProcedureBase { if (m_ProcedureFsm == null) { throw new GameFrameworkException("You must initialize procedure first."); } m_ProcedureFsm.Start <T>(); }
/// <summary> /// 开始流程。 /// </summary> /// <typeparam name="T">要开始的流程类型。</typeparam> public void StartProcedure <T>() where T : ProcedureBase { if (m_ProcedureFsm == null) { throw new GameFrameworkException("You must initialize procedure first."); } m_ProcedureFsm.Start <T>(); EditorProcedureMgr.nowHotfixProcedure = typeof(T).Name; }
private void Awake() { Framework.Debug.SetLogger(new Logger()); GameFramework.Register(new FsmManager()); mFsm = FsmManager.Instance.CreateFsm <FsmTest>("FsmTest", this, new NormalState(), new TiredState(), new DeadState()); mFsm.Start <NormalState>(); }
protected void InitFsm() { FsmState <ActorBase>[] states = { new ActorEmptyFsm(ActorFsmStateType.FSM_EMPTY), new ActorIdleFsm(ActorFsmStateType.FSM_IDLE), new ActorRunFsm(ActorFsmStateType.FSM_RUN), new ActorWalkFsm(ActorFsmStateType.FSM_WALK), new ActorTurnFsm(ActorFsmStateType.FSM_TURN), new ActorDeadFsm(ActorFsmStateType.FSM_DEAD), new ActorSkillFsm(ActorFsmStateType.FSM_SKILL), new ActorBeatFlyFsm(ActorFsmStateType.FSM_BEATFLY), new ActorBeatBackFsm(ActorFsmStateType.FSM_BEATBACK), new ActorBeatDownFsm(ActorFsmStateType.FSM_BEATDOWN), new ActorWoundFsm(ActorFsmStateType.FSM_WOUND), new ActorStunFsm(ActorFsmStateType.FSM_STUN), new ActorFrostFsm(ActorFsmStateType.FSM_FROST), new ActorFixBodyFsm(ActorFsmStateType.FSM_FIXBODY), new ActorFearFsm(ActorFsmStateType.FSM_FEAR), new ActorVariationFsm(ActorFsmStateType.FSM_VARIATION), new ActorJumpFsm(ActorFsmStateType.FSM_JUMP), new ActorRebornFsm(ActorFsmStateType.FSM_REBORN), new ActorCollectMineFsm(ActorFsmStateType.FSM_MINE), new ActorInteractiveFsm(ActorFsmStateType.FSM_INTERACTIVE), }; m_FsmName = GlobalTools.Format("ActorFsm[{0}][{1}]", Id, EntityId); m_ActorFsm = GameEntry.Fsm.CreateFsm(m_FsmName, this, states); m_ActorFsm.Start <ActorIdleFsm>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { State_01 s1 = new State_01(); fsm.Start(s1.GetType()); } }
/// <summary> /// 开始流程。 /// </summary> /// <param name="procedureType">要开始的流程类型。</param> public void StartProcedure(Type procedureType) { if (m_ProcedureFsm == null) { throw new LufyException("You must initialize procedure first."); } m_ProcedureFsm.Start(procedureType); }
private void InitFsm() { m_fsm = GameEntry.Fsm.CreateFsm(Utility.Text.GetFullName(GetType(), Id.ToString()) , this, GameEntry.fsmMgr.GetAllFsmState <Avatar>()); m_fsm.Start <StateIdle>(); m_fsm.SetData(fsmNextData, null); m_flag = new StateFlag(); m_changeFlag = false; }
/// <summary> /// 开始流程。 /// </summary> /// <typeparam name="T">要开始的流程类型。</typeparam> public void StartProcedure <T>() where T : ProcedureBase { if (m_ProcedureFsm == null) { Logger.LogError("You must initialize procedure first."); } m_ProcedureFsm.Start <T>(); }
// Start is called before the first frame update void Start() { m_FsmManager = GetComponent <FsmManager>(); FsmState <FsmTest>[] states = new FsmState <FsmTest> [3]; states[0] = new HeroRun(); states[1] = new HeroIdle(); states[2] = new HeroAttack(); m_HeroFsm = m_FsmManager.CreateFsm(this, states); m_HeroFsm.Start(typeof(HeroRun)); }
public void StartProcess(Type processType) { if (processType == null) { throw new Exception("开始流程类不存在:" + processType); } if (m_ProcessFsm == null) { throw new Exception("流程状态机不存在"); } m_ProcessFsm.Start(processType); }
protected internal override void OnInit(object userData) { base.OnInit(userData); //初始化该实体拥有的状态机 FsmState <EntityDemo>[] states = new FsmState <EntityDemo>[] { new State_Horizontal(), new State_Vertical(), }; Log.Error("按 C 切换状态"); m_EntityFsm = GameEntry.Fsm.CreateFsm <EntityDemo>(this, states); m_EntityFsm.Start <State_Horizontal>(); }
protected void InitFsm() { FsmState <ActorBase>[] states = { new ActorEmptyFsm(), new ActorIdleFsm(), new ActorRunFsm(), new ActorWalkFsm(), new ActorTurnFsm(), new ActorSkillFsm(), new ActorDeadFsm(), }; m_ActorFsm = GameEntry.Fsm.CreateFsm(this, states); m_ActorFsm.Start <ActorIdleFsm>(); }
protected override void OnInit(object userData) { base.OnInit(userData); data = userData as PlayerData; if (data == null) { Log.Error(" player data is not valide"); return; } character = gameObject.GetOrAddComponent <CharacterController>(); ani = GetComponent <Animator>(); fsm = GameEntry.Fsm.CreateFsm <IPlayer>(this, new FsmState <IPlayer>[] { new IdleState(), new RunState(), new AttactState() }); fsm.Start <IdleState>(); }
public override void Start() { if (AIMode == AIModeType.Hand || Owner.IsDead) { return; } if (m_AIFsm.IsRunning) { ChangeAIState(AIStateType.Idle); return; } m_AIFsm.Start <AIIdleState>(); this.AIStateType = AIStateType.Idle; }
// public override void ApplyDamage(Entity attacker, int damage) // { // base.ApplyDamage(attacker, damage); // GameEntry.Widget.ShowHPBar(this,_enemyData.currentHP,_enemyData.MaxHP,0); // } // public override void HealthHp(Entity healther, int hp) // { // base.HealthHp(healther, hp); // GameEntry.Widget.ShowHPBar(this,_enemyData.currentHP,_enemyData.MaxHP,0); // } // public override void GainShield(Entity entity,TargetableObjectData.Shield shield) // { // base.GainShield(entity, shield); // GameEntry.Widget.ShowHPBar(this,_enemyData.currentHP,_enemyData.MaxHP,shieldValue); // } protected override void OnShow(object userData) { base.OnShow(userData); _enemyData = userData as EnemyData; if (_enemyData == null) { Log.Error("EnemyData is invalid."); return; } FsmState <EnemyLogic>[] enemyStates = { new EnemyResetState(), new EnemyThinkState(), new EnemyAttackState(), }; enemyFsm = GameEntry.Fsm.CreateFsm(Id.ToString(), this, enemyStates); enemyFsm.Start <EnemyThinkState>(); // GameEntry.Widget.ShowHPBar(this,_enemyData.currentHP,_enemyData.MaxHP,0); }
public FsmExample() { //Create the FSM and some Data class to be refrenced in states _stateMachine = new Fsm <ConcreteClass, ExampleTransitions>(); var data = new StateData(); //Add States _stateMachine.AddState(new IdleState(data)); _stateMachine.AddState(new ActionState(data)); //AddTransitions _stateMachine.AddTransition <IdleState, ActionState>(ExampleTransitions.ReadyToAction); _stateMachine.AddTransition <ActionState, IdleState>(ExampleTransitions.Stop); //Start the Machine _stateMachine.SetInitialState <IdleState>(); _stateMachine.Start(); }
// Start is called before the first frame update void Start() { State_01 s1 = new State_01(); State_02 s2 = new State_02(); FsmState <FsmDemo>[] fsmStates = new FsmState <FsmDemo>[2] { s1, s2 }; fsm = GameEntry.Fsm.CreateFsm <FsmDemo>("FSMtest", this, null); var states = fsm.GetAllStates(); foreach (var item in states) { Debug.LogError(">>> " + item); } fsm.Start(s1.GetType()); Debug.LogError("CURRENT : " + fsm.IsRunning + " NAME: " + fsm.CurrentState); }
protected override void OnEnter(IFsm <ProcedureGame> procedureOwner) { base.OnEnter(procedureOwner); Log.Info("StateBuild OnEnter"); GameEntry.Event.Subscribe(EvtEditRotation.EventId, OnEvtEditRotation); GameEntry.Event.Subscribe(EvtEditRestore.EventId, OnEvtEditRestore); GameEntry.Event.Subscribe(EvtClickScene.EventId, OnEvtClickScene); GameEntry.Event.Subscribe(EvtChangeTouchState.EventId, OnEvtChangeTouchState); ZooController.Inst.SwipeGesture.onMove.Add(OnSwipeMove); ZooController.Inst.SwipeGesture.onBegin.Add(OnSwipeBegin); ZooController.Inst.SwipeGesture.onEnd.Add(OnSwipeEnd); m_Fsm = GameEntry.Fsm.CreateFsm(this, new StateBuildInEditModeUnSel(), new StateBuildInEditModeSel(), new StateBuildInBuildMode()); m_Fsm.Start <StateBuildInBuildMode>(); procedureOwner.SetData <VarInt>("EditState", ProcedureGame.Editing); UIZooView.Inst.UI.m_BtnHand.visible = true; GameEntry.TempData.ObjectScene.DirtyList.Clear(); }
protected override void OnEnter(IFsm <ProcedureGame> procedureOwner) { base.OnEnter(procedureOwner); Log.Info("StateEdit OnEnter"); GameEntry.Event.Subscribe(EvtChangeLookState.EventId, OnEvtChangeLookState); GameEntry.Event.Subscribe(EvtChangeTouchState.EventId, OnEvtChangeTouchState); GameEntry.Event.Subscribe(EvtClickScene.EventId, OnEvtClickScene); GameEntry.Event.Subscribe(EvtEditRotation.EventId, OnEvtEditRotation); GameEntry.Event.Subscribe(EvtEditRestore.EventId, OnEvtEditRestore); GameEntry.Event.Subscribe(EvtConfirmEdit.EventId, OnEvtConfirmEdit); ZooController.Inst.SwipeGesture.onMove.Add(OnSwipeMove); ZooController.Inst.SwipeGesture.onBegin.Add(OnSwipeBegin); m_Fsm = GameEntry.Fsm.CreateFsm(this, new StateEditInBatchModeUnLock(), new StateEditInBatchModeLock(), new StateEditInUnbatchModeUnSel(), new StateEditInUnbatchModeSel()); m_Fsm.Start <StateEditInUnbatchModeUnSel>(); procedureOwner.SetData <VarInt>("EditState", ProcedureGame.Editing); GameEntry.TempData.ObjectScene.DirtyList.Clear(); }
public IEnumerator FsmTestWithEnumeratorPasses() { // Use the Assert class to test conditions. // yield to skip a frame AshUnityEntry.New(); IFsmManager fsmManager = AshEntry.GetModule <IFsmManager>(); FsmOwer fsmOwer = new FsmOwer(); Status1 status1 = new Status1(); Status2 status2 = new Status2(); //fsmManager.CreateFsm<FsmOwer>( fsmOwer, status1, status2); fsmManager.CreateFsm <FsmOwer>("Test", fsmOwer, status1, status2); Log.Debug("有限状态机的数量时{0}", fsmManager.Count); IFsm <FsmOwer> fsm = fsmManager.GetFsm <FsmOwer> ("Test"); Assert.IsNotNull(fsm); VarString v = new VarString(); v.SetValue("Variable data"); // v.Value = "Variable data"; fsm.SetData("data", v); fsm.Start <Status1> (); Assert.AreEqual(fsm.CurrentState, status1); yield return(new WaitForSeconds(1)); fsm.FireEvent(this, 1, "userData"); // Assert.AreEqual (fsm.CurrentState, status2); yield return(null); }
private void Start() { birthPos = this.transform.position; npcAnimator = this.GetComponent <Animator>(); npcCharacterController = this.GetComponent <CharacterController>(); originalPos = transform.position; defendCollider.OnTriggerEnterEvent += (collider) => { if (collider.transform.tag == "Player") { attackHero = collider.transform; fsm.ChangeState <NPCAttackState>(); } }; defendCollider.OnTriggerExitEvent += (collider) => { if (collider.transform.tag == "Player") { attackHero = null; fsm.ChangeState <NPCDefendState>(); } }; hPComponent = NPCManager.Instance.AddNPCHPUI(this); hPComponent.SetEnable(true); hPComponent.DeadEvent += () => { PlayDeath(); }; fsm = GameEntry.Fsm.CreateFsm(this.GetHashCode().ToString(), this, new NPCDefendState(), new NPCAttackState()); fsm.Start <NPCDefendState>(); }
protected virtual void StartFsm() { fsm.Start <EnemyMoveState>(); }
private void OnEvtMainUIShown(object sender, GameEventArgs e) { m_Fsm.Start <StateNormal>(); }
/// <summary> /// 开始流程。 /// </summary> /// <typeparam name="T">要开始的流程类型。</typeparam> public void StartProcedure <T>() where T : ProcedureBase { fsm.Start <T>(); }
protected override void OnShow(object userdata) { base.OnShow(userdata); transform.position += new Vector3(0, 0, -1); m_CharacterFsm.Start <UnitNormalState>(); }
protected override void OnShow(object userdata) { base.OnShow(userdata); m_CellFsm.Start <CellNormalState>(); }