On Monday, 20 October 2014 at 06:17:42 UTC, Jacob Carlborg wrote:
You can always make Scene a template class:
abstract class Scene (T)
{
private StateMachine!T _stateMachine;
}
class MainMenu : Scene!(MainMenu) {}
But I'm guessing you like to avoid that if possible.
I would, as I need to keep track of the current scene in a
variable somewhere:
Scene _currentScene; // problematic if Scene is a template
I could just declare the StateMachine separately in every Scene,
but that seems like a lot of duplicate code (I then repeat the
same code for updating the state machine, ect.)