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:
Right-click on the
States
folder, and select Add | New File.In the New File window, navigate to General | Empty Class,
At the bottom of the window, enter the class name.
Click on the New button.
In each of the three new files, make them almost identical to the code of BeginState
except for the class name, the constructor method name, and the text...