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 ...
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.