Game Development Reference
In-Depth Information
break;
case BattleState.Player_Attack:
break;
case BattleState.Change_Control:
break;
case BattleState.Enemy_Attack:
break;
case BattleState.Battle_Result:
break;
case BattleState.Battle_End:
break;
default:
break;
}
}
This code gets the current state from the animator state machine once per frame and then
sets up a choice ( switch statement) for what can happen based on the current state. (Re-
member, it is the state machine that decides which state follows which in the Mecanim en-
gine, not nasty nested if statements everywhere in code.)
Next, replace/add the OnGUI function with the same pattern to control which GUI ele-
ments would be displayed, as follows:
void OnGUI()
{
switch (currentBattleState)
{
case BattleState.Begin_Battle:
break;
case BattleState.Intro:
break;
case BattleState.Player_Move:
break;
case BattleState.Player_Attack:
break;
case BattleState.Change_Control:
break;
case BattleState.Enemy_Attack:
Search WWH ::




Custom Search