本文整理汇总了C#中FiniteStateMachine.AddState方法的典型用法代码示例。如果您正苦于以下问题:C# FiniteStateMachine.AddState方法的具体用法?C# FiniteStateMachine.AddState怎么用?C# FiniteStateMachine.AddState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FiniteStateMachine
的用法示例。
在下文中一共展示了FiniteStateMachine.AddState方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
stateMachine = GetComponent<FiniteStateMachine>();
stateMachine.InitializeStateMachine();
stateMachine.AddState(new BomberReachedScreenEdge(this.transform));
stateMachine.AddState(new BomberAttackingPlayer(this.transform, GameManager.instance.GetPlayer()));
stateMachine.AddState(new BomberMovingToPosition(this.transform));
stateMachine.AddState(new BomberDead(this.transform));
}
示例2: Awake
protected void Awake()
{
_fsm = new FiniteStateMachine();
_fsm.AddState(new HeroSeekState(gameObject));
_fsm.AddState(new HeroWalkState(gameObject));
_fsm.AddState(new HeroWaitState(gameObject));
//_fsm.ChangeState(new FSMTransition(HeroState.Seek));
}
示例3: Start
// Use this for initialization
void Start()
{
stateMachine = GetComponent<FiniteStateMachine>();
stateMachine.InitializeStateMachine();
stateMachine.AddState(new GunnerReachedScreenEdge(this.transform));
stateMachine.AddState(new GunnerAttackingPlayer(this.transform));
stateMachine.AddState(new GunnerMovingToPosition(this.transform));
stateMachine.AddState(new GunnerInFormation(this.transform));
stateMachine.AddState(new GunnerDead(this.transform));
}
示例4: Awake
protected void Awake() {
_fsm = new FiniteStateMachine();
_fsm.AddState(new GameCreateState());
_fsm.AddState(new GameResetState());
_fsm.AddState(new GamePlayState());
_fsm.AddState(new GameWinState());
_fsm.AddState(new GameLoseState());
_fsm.ChangeState(new FSMTransition(GameState.GameCreate));
}
示例5: Start
// Use this for initialization
void Start()
{
transform.rotation = Quaternion.LookRotation(GameManager.instance.GetPlayer().position - transform.position, new Vector3(0, 0, -1));
stateMachine = GetComponent<FiniteStateMachine>();
stateMachine.InitializeStateMachine();
stateMachine.AddState(new FighterAttackingPlayer(transform, gameMng.GetPlayer()));
stateMachine.AddState(new FighterReachedScreenEdge(transform, gameMng.GetPlayer()));
stateMachine.AddState(new FighterDead(transform));
partners = new FighterController[2];
}
示例6: AIProperty
public AIProperty()
{
IsActive = true;
StateMachine = new FiniteStateMachine();
// basic behaviors!
StateMachine.AddState("idle", 2, 3);
StateMachine.AddState("move", 2, 2);
StateMachine.AddTransition("idle", "move", .5);
StateMachine.AddTransition("move", "idle", .5);
// Pick our first state.
StateMachine.SetState("idle");
}
示例7: Awake
protected void Awake()
{
_fsm = new FiniteStateMachine();
_fsm.AddState(new MonsterWanderState(gameObject));
_fsm.ChangeState(new FSMTransition(MonsterState.Wander));
}
示例8: Start
void Start()
{
_myTransform = transform;
Text.renderer.enabled = false;
_fsm = new FiniteStateMachine("start state", StartState);
_fsm.AddState("say hello", SayHello);
_fsm.AddEvent("go and say hello", "start state", "say hello");
_fsm.AddEvent("say goodbye and go away", "say hello", "start state");
_fsm.AddTransition("start state", "say hello", ()=> MoveTo(Target));
_fsm.AddTransition("say hello", "start state", ()=> MoveTo(End));
}
示例9: InitializeStateMachine
protected virtual void InitializeStateMachine()
{
Idle idleState = new Idle(this);
idleState.AddTransition(Transition.E_FAILGESTURE, StateID.E_ATTACK);
idleState.AddTransition(Transition.E_LOSTHP, StateID.E_DAMAGED);
idleState.AddTransition(Transition.E_NOHP, StateID.E_DEATH);
Attack atkState = new Attack(this);
atkState.AddTransition(Transition.E_FINISHATTACK, StateID.E_IDLE);
atkState.AddTransition(Transition.E_LOSTHP, StateID.E_DAMAGED);
Damaged dmgState = new Damaged(this);
dmgState.AddTransition(Transition.E_NOHP, StateID.E_DEATH);
dmgState.AddTransition(Transition.E_FINISHATTACK, StateID.E_IDLE);
dmgState.AddTransition(Transition.E_LOSTHP, StateID.E_DAMAGED);
Death deathState = new Death(this);
enemyState = new FiniteStateMachine();
enemyState.AddState(idleState);
enemyState.AddState(atkState);
enemyState.AddState(dmgState);
enemyState.AddState(deathState);
}
示例10: MakeFSM
protected override void MakeFSM()
{
base.MakeFSM();
EnemyRandomWalk randomWalk = new EnemyRandomWalk(StateID.RandomWalk, this);
randomWalk.AddTransition(Transition.FoundBreadcrumb, StateID.BreadcrumbWalk);
randomWalk.AddTransition(Transition.FoundPlayer, StateID.Finished);
EnemyBreadcrumbWalk breadcrumbWalk = new EnemyBreadcrumbWalk(StateID.BreadcrumbWalk, this);
breadcrumbWalk.AddTransition(Transition.LostBreadcrumb, StateID.RandomWalk);
breadcrumbWalk.AddTransition(Transition.FoundPlayer, StateID.Finished);
PlayerFinished finished = new PlayerFinished(StateID.Finished, this.gameObject);
fsm = new FiniteStateMachine();
fsm.AddState(randomWalk);
fsm.AddState(breadcrumbWalk);
fsm.AddState(finished);
}