Time for action – modifying BeginState and add three more States
Once we modify BeginState
, we'll essentially use it as a sort of template for creating all the other States, with just a few minor differences.
Note
I will explain code flow once we have the State Machine operating.
Using the next screenshot of BeginState
, make the following changes:
- Add line 8:
private StateManager manager;
. - Modify line 10:
public BeginState(StateManager managerRef).
- Add line 12:
manager = managerRef;
.
Follow these next steps three times to create the other State classes: PlayState
, WonState
, and LostState
.
In the Solution window of MonoDevelop, perform the following steps: ...
Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.