Game Development Reference
In-Depth Information
break;
case BattleState.Battle_Result:
break;
default:
break;
}
}
Tip
If you need a quick way to generate a
switch
statement code from an
enum
state (as
shown in the preceding code), there is a simple shortcut to do so using Visual Studio's
built-in snippets:
Just type
switch
and when the snippet prompt appears, tab it twice. Then, type in the
property name that has a type of an
enum
state (the c
urrentBattleState
property in
this case which is of the type,
BattleState
). Finally, hit the down arrow key and your
case statements will be automatically generated for you!
Neat, eh!
With these in place, we are ready to start adding in some battle logic.