#pragma once #include "../theArchanist/map/gameMap.h" #include "Attacks/Projectile.h" #include "BasicEntity.h" #include "EntityFunctionTemplates.h" #include "MovingEntity.h" #include "Utils/WallIntersectionTests.h" #include "Vehicle.h" #include "WallType.h" #include #include #include #include "../../glIncludes.h" #include "ArcanistLevel.h" // for computing wall intersections for wall avoidance #include class Vehicle; class ArcanistLevel; class Projectile; // typedef GLfloat point2[2]; /** * @class GameWorld * @brief This is the main world object for AI in the project * * @author Michael John * @version 0.01 * @date 21/08/2021 * * @todo get projects typedefs into this project * @todo isLOSOkay completion * @todo isPathObstructed completion * @todo GetAllBotsInFOV completion * @todo isSecondVisibleToFirst completion * * @bug */ class GameWorld { public: GameWorld() = default; virtual ~GameWorld(); void init(gameMap& map); void Update(float elapsedTime); MovingEntity* player; const std::list getAllBots() const { return m_Vehicles; } std::list m_Vehicles; // std::list m_Obstacles; std::list m_Projectiles; std::vector> m_deadProjectiles; std::vector m_deadVehicles; void flagVehiclesWithinViewRange(BasicEntity* vehicle, float range); void flagObstaclesWithinViewRange(BasicEntity* vehicle, float range); glm::vec2 getClosestWallIntersection(glm::vec2 origin, glm::vec2 direction, float& distance); ArcanistLevel currentLevel; bool playerMoveCheck(glm::vec2& position); bool isPathObstructed(glm::vec2 A, glm::vec2 B, float BoundingRadius = 0) const; // returns a vector of pointers to bots in the FOV of the given bot std::vector GetAllBotsInFOV(const Vehicle* Bot) const; // returns true if the second bot is unobstructed by walls and in the field // of view of the first. bool isSecondVisibleToFirst(const Vehicle* pFirst, const Vehicle* pSecond) const; // returns true if the ray between A and B is unobstructed. bool isLOSOkay(glm::vec2 A, glm::vec2 B) const; bool isSecondInFOVOfFirst(glm::vec2 posFirst, glm::vec2 facingFirst, glm::vec2 posSecond, float fov, float viewRange) const; protected: private: };