Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool PrototypeState::Enter()
- {
- //Few things going on. ServiceLocator is giving and taking new pointers.
- //Game world, BlackBoard and the BehaviorTree are initialized.
- state_window = ServiceLocator<Window>::get_service(); //this gets a static pointer to my window class.
- // This class holds the sf::window
- game_world = GameWorld::create(); // get a pointer to game_world
- game_world->Initialize();
- game_world->CreateTankPTR(sf::Vector2f(HALFTILEWIDTH + 1 * TILEWIDTH, HALFTILEHEIGHT + 18 * TILEHEIGHT));
- ServiceLocator<GameWorld>::set_service(game_world);
- graph = ServiceLocator<Graph>::get_service();
- BlackBoard<GameWorld>* black = new BlackBoard<GameWorld>;
- black->Start();
- ServiceLocator<BlackBoard<GameWorld>>::set_service(black);
- BTree = new bt1::FirstBTFindBase;
- bt1::ConditionArrived<GameWorld>* condition1 = new bt1::ConditionArrived<GameWorld>;
- bt1::ConditionBaseWalkable<GameWorld>* condition2 = new bt1::ConditionBaseWalkable<GameWorld>;
- bt1::ActionFindPathAndGo<GameWorld>* action1 = new bt1::ActionFindPathAndGo<GameWorld>;
- bt1::ActionSetArrived<GameWorld>* action2 = new bt1::ActionSetArrived<GameWorld>;
- BTree->SearchBaseAndGo->addChild(condition1);
- BTree->SearchBaseAndGo->addChild(condition2);
- BTree->SearchBaseAndGo->addChild(action1);
- BTree->SearchBaseAndGo->addChild(action2);
- ServiceLocator<bt1::FirstBTFindBase>::set_service(BTree);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement