本文整理汇总了C#中State.Enter方法的典型用法代码示例。如果您正苦于以下问题:C# State.Enter方法的具体用法?C# State.Enter怎么用?C# State.Enter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State.Enter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeState
public void ChangeState(State newState)
{
lastState = currentState;
currentState.Exit(this.gameObject);
newState.Enter(this.gameObject);
currentState = newState;
}
示例2: ChangeGlobalState
public void ChangeGlobalState(State newState)
{
if (globalState != null)
{
globalState.Exit(owner);
}
globalState = newState;
globalState.Enter(owner);
}
示例3: SetState
public void SetState(StateID stateID)
{
if(!states.ContainsKey(stateID))
return;
if(currentState != null)
currentState.Leave();
currentState = states[stateID];
currentState.Enter();
}
示例4: ChangeState
public void ChangeState(State newState)
{
if (newState == null)
return;
mPreviousState = mCurrentState;
mCurrentState.Exit (mOwner);
mCurrentState = newState;
mCurrentState.Enter (mOwner);
}
示例5: MoveTo
public void MoveTo(State _state)
{
if(state != null) state.Exit();
state = _state;
if(state != null) {
state.sm = this;
state.Enter();
}
}
示例6: ChangeState
public void ChangeState(State newState)
{
if (currentState != null)
{
previousState = currentState;
currentState.Exit(owner);
}
currentState = newState;
currentState.Enter(owner);
}
示例7: Update
public void Update(GameObject gameObject)
{
State newState = mCurrState.Update(gameObject);
if (newState != null)
{
mCurrState.Exit();
mCurrState = newState;
mCurrState.Enter();
}
}
示例8: Start
void Start()
{
_anim = GetComponent<Animator>();
_fighterRef = this.gameObject.GetComponent<Fighter>();
_myRigidbody = GetComponent<Rigidbody2D>();
_currentState = new EnemyPatrolState(this);
_currentState.Enter();
GameController.Instance().GetEnemyList.Add(this.gameObject);
}
示例9: Push
public void Push(State state)
{
State old = Peek();
if (old != null)
{
old.Exit();
}
states.Push(state);
state.Enter();
}
示例10: SetState
public virtual void SetState(State state)
{
if(_currentState != null)
{
_currentState.Exit();
}
_currentState = state;
_currentState.StateMachine = this;
_currentState.Enter();
}
示例11: Transition
public void Transition(State fromState,State toState)
{
if (SwapState(fromState,toState))
{
toState.Enter();
}
else
{
throw new IllegalStateException("Illegal transition attempted from: " + fromState + " to " + toState);
}
}
示例12: ChangeState
/// <summary>
/// Change the Miner State.
/// </summary>
/// <param name="newState">Miner State to change to.</param>
public void ChangeState(State<Miner> newState)
{
//exit current state and change to new state.
currentState.Exit(this, Location);
//change the state.
Location = newState.GetLocation();
currentState = newState;
//enter new state.
currentState.Enter(this);
}
示例13: ChangeState
public void ChangeState(State newState)
{
if (currentState != null)
{
currentState.Exit();
}
currentState = newState;
if (newState != null)
{
currentState.Enter();
}
}
示例14: SwitchState
public void SwitchState( State newState )
{
if (currentState != null) {
currentState.Exit();
}
currentState = newState;
if (currentState != null) {
currentState.Enter();
}
Debug.Log ("Switching to state for: " + newState.entity.name);
}
示例15: SetState
/// <summary>
/// Method om de state te wijzigen
/// </summary>
public void SetState(StateID stateID) {
/** als we de stateID niet kennen als state: stop deze functie dan */
if(!states.ContainsKey(stateID))
return;
/** als we ons al in een state bevinden: geef de state de mogelijkheid zich op te ruimen */
if(currentState != null)
currentState.Leave();
/** we stellen de nieuwe currentState in */
currentState = states[stateID];
/** we geven de nieuwe state de mogelijkheid om zich zelf in te stellen */
currentState.Enter();
}