|
|
|
|
|
|
|
|
|
|
void Start() |
|
|
|
{ |
|
|
|
foreach (var state in States) |
|
|
|
state.gameObject.SetActive(false); |
|
|
|
|
|
|
|
SetState(DefaultState.StateName); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
// Call Exit Actions
|
|
|
|
// Then finally disable old state
|
|
|
|
m_CurrentState.gameObject.SetActive(false); |
|
|
|
} |
|
|
|
|
|
|
|
// Switch Active new state
|
|
|
|
newState.gameObject.SetActive(true); |
|
|
|
// Then Set new current state
|
|
|
|
|
|
|
|
// Finally, call State enter
|
|
|
|
Callable.Call(m_CurrentState.OnStateEnter, gameObject); |
|
|
|
} |
|
|
|
} |
|
|
|