Time for action – implementing an interface
We're going to create a C# interface
and implement it in BeginState
, but incorrectly to see some errors. Then we'll implement the interface correctly. Perform the following steps:
In the MonoDevelop Solution window, right-click on the
Code
folder and select Add | New Folder.Name the folder
Interfaces
.Right-click on the
Interfaces
folder and select Add | New File.In the New File window, select General | Empty Interface.
In the Name field at the bottom, enter IStateBase.
Click on the New button to create the file.
In the MonoDevelop Solution window, your file structure will now look like the following screenshot:
Now edit IStateBase
file as follows:
Remove lines 1 and 2. As a result,
namespace
will move up to line 1.Modify line 1 to:
nam
espace Assets.Code.Interfaces.
In the
IStateBase
code block, add line 5:void StateUpdate();
.Then add line 6:
void ShowIt();
.
The IStateBase
file will now look like the following screenshot:
Now we're going to have the BeginState...