My game so far works just fine, but most of my serverside code is in one class, the "Game.cs" class I started with It's getting long and unweildy, so I want to refactor my code and split it up into seperate classes. Like "BattleSystem.cs" for example, which will have it's own GotMessage function to recieve messages related to the battle system (attacks and so forth).
So I tried to create this class like so, extending from my GameCode class to pass in all the protected variables I had already made...
- Code: Select all
namespace MyGameTitle
{
[RoomType("Battle")]
public class BattleSystem : GameCode // GameCode is the name of my base class
{
}
}
and then create an instance of it from my Game.cs class when I need it.
- Code: Select all
battleSystem = new BattleSystem ();
This is working, and the constructor for battleSystem is firing. But the GotMessage function inside doesn't work, it doesn't seem to be receiving any messages. Am I going about this the wrong way?