Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class Subject>
- bt1::Status bt1::ActionFindPathAndGo<Subject>::update()
- {
- if (BB->GetGameWorldTankSearching())
- {
- return bt1::BH_RUNNING;
- }
- sf::Vector2f goal = BB->GetGameWorldTilePosition(BB->GetGoalPosition());
- sf::Vector2f start = BB->GetGameWorldTilePosition(BB->GetGameWorldTankPosition());
- bool succeed = BB->GameWorldPathObjectFindPath(start, goal);
- if (succeed == true)
- {
- std::cout << "Agent: " << BB->GetGameWorldTankID() << " Reporting to have found a path" << std::endl;
- BB->SetGameWorldTankSearching(true);
- for (int i = BB->GameWorldPathObjectPathListSize() - 1; i > -1; i--)
- {
- sf::Vector2f position = BB->GetGameWorldPathObjectPathListIndexPosition(i);
- BB->GameWorldTankPathAttach(position);
- }
- return bt1::BH_SUCCESS;
- }
- return bt1::BH_FAILURE;
- }
Advertisement
Add Comment
Please, Sign In to add comment