Ejemplo n.º 1
0
bool ActorStateMachine::onEvent(const Event& e)
{
    // forward event upstream if it is going upstream
    if (currentState && e.getSender() == currentState)
    {
        // give specific implementation a chance to handle it.
        if (onPreUpstreamEvent(e))
        {
            return true;
        }
        else
        {
            return distributeEvent(e);
        }
    }
    // otherwise forward downstream
    else if (currentState)
    {
        // give specific implementation a chance to handle it.
        if (onPreDownstreamEvent(e))
        {
            return true;
        }
        else
        {
            return currentState->onEvent(e);
        }
    }
    // not handled because no current state
    else
    {
        return false;
    }
}
Ejemplo n.º 2
0
bool MainMenuScene::onEvent(const Event& e)
{
	return distributeEvent(e);
}