|
Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
|
#include <objectmanager.hpp>
Public Member Functions | |
| ObjectManager () | |
| ~ObjectManager () | |
| SpecificID | createObject (Object *object) |
| Creates a new object with the specified type. More... | |
| bool | removeObject (EntityID globalID) |
| Attempts to remove an object with the given EntityID. More... | |
| bool | removeObject (Object **object_dbl_ptr) |
| Attempts to remove an object pointed to by the pointer pointed to by the given Object double pointer. If successful, it will set the given Object pointer to nullptr. (use to avoid dangling Object pointers) More... | |
| bool | replaceObject (EntityID globalID, Object *object) |
| Replaces the object with the given EntityID with the given Object, if there currently exists an object with the given EntityID. The original object is deleted. More... | |
| Object * | getObject (EntityID globalID) |
| Attempts to retrieve the object with the given EntityID. More... | |
| Object * | getBaseObject (SpecificID base_objectID) |
| Attempts to retrieve the Object with the given SpecificID. More... | |
| Item * | getItem (SpecificID itemID) |
| Attempts to retrieve the Item with the given SpecificID. More... | |
| SolidSurface * | getSolidSurface (SpecificID surfaceID) |
| Attempts to retrieve the SolidSurface with the given SpecificID. More... | |
| Player * | getPlayer (SpecificID playerID) |
| Attempts to retrieve the Player with the given SpecificID. More... | |
| DungeonMaster * | getDM () |
| Get the Dungeon Master pointer. More... | |
| Enemy * | getEnemy (SpecificID enemyID) |
| Attempts to retrieve the Enemy with the given SpecificID. More... | |
| Torchlight * | getTorchlight (SpecificID torchlightID) |
| Attempts to retrieve the Torchlight with the given SpecificID. More... | |
| Trap * | getTrap (SpecificID trapID) |
| Attempts to retrieve the Trap with the given SpecificID. More... | |
| SmartVector< Object * > | getObjects () |
| Get a list of all objects in this game instance at the current timestep. More... | |
| SmartVector< Object * > | getMovableObjects () |
| Get a list of all objects in this game instance at the current timestep that are MOVABLE. More... | |
| SmartVector< Item * > | getItems () |
| Get a list of all items in this game instance at the current timestep. More... | |
| SmartVector< SolidSurface * > | getSolidSurfaces () |
| Get a list of all SolidSurfaces in this game instance at the current timestep. More... | |
| SmartVector< Player * > | getPlayers () |
| Get a list of all Players in this game instance at the current timestep. More... | |
| SmartVector< Enemy * > | getEnemies () |
| Get a list of all Enemies in this game instance at the current timestep. More... | |
| SmartVector< Trap * > | getTraps () |
| Get a list of all Traps in this game instance at the current timestep. More... | |
| SmartVector< Projectile * > | getProjectiles () |
| Get a list of all Projectiles in this game instance at the current timestep. More... | |
| SmartVector< Torchlight * > | getTorchlights () |
| Get a list of all Projectiles in this game instance at the current timestep. More... | |
| SmartVector< WeaponCollider * > | getWeaponColliders () |
| Get a list of all WeaponCollider in this game instance at the current timestep. More... | |
| SmartVector< Exit * > | getExits () |
| Get a list of all Exits in this game instance at the current timestep. More... | |
| bool | moveObject (Object *object, glm::vec3 newCornerPosition) |
| Attempts to move the given Object to the given corner position, updating its GridCell position vector and the cellToObjects hashmap. More... | |
| std::vector< glm::ivec2 > | objectGridCells (Object *object) |
| Given an object, his function will return a vector of positions of GridCells that are currently occupied by this object. More... | |
| std::vector< boost::optional< SharedObject > > | toShared () |
| Generates a list of SharedObjects that corresponds to all objects in the game instance. More... | |
Data Fields | |
| std::unordered_map< glm::ivec2, std::vector< Object * > > | cellToObjects |
| Hashmap that maps GridCell (x, y) positions to a vector of Objects that occupy / overlap that GridCell. More... | |
| ObjectManager::ObjectManager | ( | ) |
| ObjectManager::~ObjectManager | ( | ) |
| SpecificID ObjectManager::createObject | ( | Object * | object | ) |
Creates a new object with the specified type.
| object | pointer to the newly created object to add to the ObjectManager. |
| id | boost::optional<EntityID> which is by default boost::none. If given a value for a specific EntityID, the new object will be added with the given EntityID. Note that this may |
| Object * ObjectManager::getBaseObject | ( | SpecificID | base_objectID | ) |
| DungeonMaster * ObjectManager::getDM | ( | ) |
Get the Dungeon Master pointer.
| SmartVector< Enemy * > ObjectManager::getEnemies | ( | ) |
Get a list of all Enemies in this game instance at the current timestep.
| Enemy * ObjectManager::getEnemy | ( | SpecificID | enemyID | ) |
| SmartVector< Exit * > ObjectManager::getExits | ( | ) |
Get a list of all Exits in this game instance at the current timestep.
| Item * ObjectManager::getItem | ( | SpecificID | itemID | ) |
| SmartVector< Item * > ObjectManager::getItems | ( | ) |
Get a list of all items in this game instance at the current timestep.
| SmartVector< Object * > ObjectManager::getMovableObjects | ( | ) |
Get a list of all objects in this game instance at the current timestep that are MOVABLE.
Attempts to retrieve the object with the given EntityID.
| globalID | EntityID of the object to retrieve |
| SmartVector< Object * > ObjectManager::getObjects | ( | ) |
Get a list of all objects in this game instance at the current timestep.
| Player * ObjectManager::getPlayer | ( | SpecificID | playerID | ) |
| SmartVector< Player * > ObjectManager::getPlayers | ( | ) |
Get a list of all Players in this game instance at the current timestep.
| SmartVector< Projectile * > ObjectManager::getProjectiles | ( | ) |
Get a list of all Projectiles in this game instance at the current timestep.
| SolidSurface * ObjectManager::getSolidSurface | ( | SpecificID | surfaceID | ) |
Attempts to retrieve the SolidSurface with the given SpecificID.
| surfaceID | SpecificID of the SolidSurface to retrieve |
| SmartVector< SolidSurface * > ObjectManager::getSolidSurfaces | ( | ) |
Get a list of all SolidSurfaces in this game instance at the current timestep.
| Torchlight * ObjectManager::getTorchlight | ( | SpecificID | torchlightID | ) |
Attempts to retrieve the Torchlight with the given SpecificID.
| torchlightID | SpecificID of the Torchlight to retrieve |
| SmartVector< Torchlight * > ObjectManager::getTorchlights | ( | ) |
Get a list of all Projectiles in this game instance at the current timestep.
| Trap * ObjectManager::getTrap | ( | SpecificID | trapID | ) |
| SmartVector< Trap * > ObjectManager::getTraps | ( | ) |
Get a list of all Traps in this game instance at the current timestep.
| SmartVector< WeaponCollider * > ObjectManager::getWeaponColliders | ( | ) |
Get a list of all WeaponCollider in this game instance at the current timestep.
| bool ObjectManager::moveObject | ( | Object * | object, |
| glm::vec3 | newCornerPosition | ||
| ) |
Attempts to move the given Object to the given corner position, updating its GridCell position vector and the cellToObjects hashmap.
| object | Pointer to the Object to move. |
| newCornerPosition | The new corner position the Object to which the Object will be moved. |
| std::vector< glm::ivec2 > ObjectManager::objectGridCells | ( | Object * | object | ) |
Given an object, his function will return a vector of positions of GridCells that are currently occupied by this object.
| bool ObjectManager::removeObject | ( | EntityID | globalID | ) |
Attempts to remove an object with the given EntityID.
| globalID | EntityID of the object to remove. |
| bool ObjectManager::removeObject | ( | Object ** | object_dbl_ptr | ) |
Attempts to remove an object pointed to by the pointer pointed to by the given Object double pointer. If successful, it will set the given Object pointer to nullptr. (use to avoid dangling Object pointers)
| object_dbl_ptr | Double pointer to the object to remove |
Replaces the object with the given EntityID with the given Object, if there currently exists an object with the given EntityID. The original object is deleted.
| globalID | EntityID of object to replace. |
| object | Pointer to new object that will replace the existing one. |
| std::vector< boost::optional< SharedObject > > ObjectManager::toShared | ( | ) |
Generates a list of SharedObjects that corresponds to all objects in the game instance.
| std::unordered_map<glm::ivec2, std::vector<Object*> > ObjectManager::cellToObjects |