本文整理汇总了C#中FSM.ChangeState方法的典型用法代码示例。如果您正苦于以下问题:C# FSM.ChangeState方法的具体用法?C# FSM.ChangeState怎么用?C# FSM.ChangeState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSM
的用法示例。
在下文中一共展示了FSM.ChangeState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
private void Awake()
{
Input.multiTouchEnabled = true;
ControllerFSM = new FSM<MasterController, ControllerState>(this);
ControllerFSM.RegisterState(null);
// ControllerFSM.RegisterState(GetComponent<DoorController>());
// ControllerFSM.RegisterState(GetComponent<PickUpController>());
ControllerFSM.ChangeState(ControllerState.None);
TargetFSM = new FSM<MasterController, TargetState>(this);
TargetFSM.RegisterState(new ControllerIdleState());
TargetFSM.RegisterState(new ControllerTargetState());
TargetFSM.RegisterState(new ControllerActiveState());
TargetFSM.ChangeState(TargetState.Idle);
}
示例2: Reset
public void Reset()
{
// Set x position to middle
var pos = transform.localPosition;
pos.x = 0.0f;
transform.localPosition = pos;
// Reset current speed
currentSpeed = NormalSpeed;
// Reset FSM
fsm = GetComponent<FSM>();
var idleState = ScriptableObject.CreateInstance<IdleState>();
idleState.Init(fsm);
fsm.ChangeState(idleState);
lastDir = null;
lives = MaxLives;
bombs = DefaultBombs;
}
示例3: Awake
private void Awake()
{
ActionFSM = new FSM<Door, DoorState>(this);
ActionFSM.RegisterState(new DoorIdleState());
ActionFSM.RegisterState(new DoorOpenState());
ActionFSM.RegisterState(new DoorGhostState());
ActionFSM.ChangeState(DoorState.Idle);
TargetCollider.enabled = false;
}
示例4: Start
// Use this for initialization
void Start()
{
// Set up shoot timer
if (!shootTimer)
{
shootTimer = ScriptableObject.CreateInstance<Timer>();
}
shootTimer.Init(ShootInterval, false);
// Set up horizontal bound to clamp player's movement
horizontalBoundSize = ScreenScript.GetScreenSize().x;
// Set up current speed
currentSpeed = NormalSpeed;
// Set up FSM
fsm = GetComponent<FSM>();
var idleState = ScriptableObject.CreateInstance<IdleState>();
idleState.Init(fsm);
fsm.ChangeState(idleState);
lastDir = null;
lives = MaxLives;
bombs = DefaultBombs = Mathf.Clamp(DefaultBombs, 0, MaxBombs);
}