void TestGameState::demonstration() { Game game ; GameState* state = game.addState(new GameState("TestPilot")) ; state->load("TestPilot") ; state->activate() ; game.run() ; }
void TestGameState::twoStateGame() { TestGameStateViewPoint::m_activated_states.clear() ; /* A game with two states : a welcome during 2 seconds a goodbye during 2 seconds */ Game game ; GameState* welcome = game.addState(new GameState("welcome")) ; Kernel::Object* welcome_model = welcome->getRoot() ; welcome_model->addTrait(new Model::WithLifetime(Model::Duration::Second(2))) ; GameState* goodbye = game.addState(new GameState("goodbye")) ; Kernel::Object* goodbye_model = goodbye->getRoot() ; goodbye_model->addTrait(new Model::WithLifetime(Model::Duration::Second(2))) ; welcome->setNextState(goodbye) ; welcome->activate() ; game.run() ; CPPUNIT_ASSERT(TestGameStateViewPoint::m_activated_states.size()==2) ; }