GameWorld class. It contains all the player, npc, object and item instances.
More...
#include <GameWorld.hpp>
GameWorld class. It contains all the player, npc, object and item instances.
◆ GameWorld()
◆ ~GameWorld()
| GameWorld::~GameWorld |
( |
| ) |
|
|
default |
◆ addItem()
| void GameWorld::addItem |
( |
Coordinates |
location, |
|
|
std::shared_ptr< Item > |
item |
|
) |
| |
Add item to the game world.
- Parameters
-
◆ addNpc()
| void GameWorld::addNpc |
( |
Npc |
npc | ) |
|
Adds npc to the game world.
- Parameters
-
◆ addPlayer()
| void GameWorld::addPlayer |
( |
std::string |
playerName, |
|
|
unsigned int |
playerId, |
|
|
int |
baseDamage, |
|
|
int |
baseAccuracy, |
|
|
SpawnCoordinateBounds |
spawnCoordinateBounds, |
|
|
Coordinates |
location |
|
) |
| |
Adds player to the game world.
- Parameters
-
| playerName | |
| playerId | |
| baseDamage | |
| baseAccuracy | |
| spawnCoordinateBounds | Bounds within which the player can spawn |
| location | Coordinates |
◆ getEntity()
| std::shared_ptr< Entity > GameWorld::getEntity |
( |
unsigned int |
entityId | ) |
|
Get entity by id.
- Parameters
-
- Returns
- shared pointer to Entity
◆ getItems()
| std::map< Coordinates, std::vector< std::shared_ptr< Item > > > & GameWorld::getItems |
( |
| ) |
|
Get all items.
- Returns
- std::map<Coordinates, std::vector<std::shared_ptr<Item>>>&
◆ getItemsMutex()
| std::mutex & GameWorld::getItemsMutex |
( |
| ) |
|
◆ getMap()
| Map & GameWorld::getMap |
( |
| ) |
|
◆ getNpc()
| std::shared_ptr< Npc > GameWorld::getNpc |
( |
unsigned int |
npcId | ) |
|
Get npc by id.
- Parameters
-
- Returns
- std::shared_ptr<Npc>
◆ getNpcs()
| std::vector< std::shared_ptr< Npc > > & GameWorld::getNpcs |
( |
| ) |
|
Get all npcs.
- Returns
- std::vector<std::shared_ptr<Npc>>
◆ getObjects()
| std::map< std::string, std::shared_ptr< Object > > & GameWorld::getObjects |
( |
| ) |
|
Get all objects.
- Returns
- std::map<std::string, std::shared_ptr<Object>>&
◆ getPlayer()
| std::shared_ptr< PlayerCharacter > GameWorld::getPlayer |
( |
unsigned int |
playerId | ) |
|
◆ getPlayers()
| std::vector< std::shared_ptr< PlayerCharacter > > & GameWorld::getPlayers |
( |
| ) |
|
◆ getPlayersMutex()
| std::mutex & GameWorld::getPlayersMutex |
( |
| ) |
|
◆ initWorld()
| void GameWorld::initWorld |
( |
| ) |
|
Initializes the game world. Loads assets and map. Adds npcs and objects to the world.
◆ removeItem()
| std::shared_ptr< Item > GameWorld::removeItem |
( |
Coordinates |
location, |
|
|
int |
itemId |
|
) |
| |
Remove item from the game world.
- Parameters
-
| itemId | Instance id of item to be removed |
- Returns
- std::shared_ptr<Item>
◆ removePlayer()
| bool GameWorld::removePlayer |
( |
unsigned int |
playerId | ) |
|
Removes player from the game world.
- Parameters
-
- Returns
- true if successful
◆ updateGameWorld()
| void GameWorld::updateGameWorld |
( |
| ) |
|
Updates the game world. Updates all the npcs and players.
◆ itemsM
| std::map<Coordinates, std::vector<std::shared_ptr<Item> > > GameWorld::itemsM |
|
private |
◆ itemsMutexM
| std::mutex GameWorld::itemsMutexM |
|
private |
◆ mapM
◆ npcsM
| std::vector<std::shared_ptr<Npc> > GameWorld::npcsM |
|
private |
◆ objectsM
| std::map<std::string, std::shared_ptr<Object> > GameWorld::objectsM |
|
private |
◆ playersM
◆ playersMutexM
| std::mutex GameWorld::playersMutexM |
|
private |
The documentation for this class was generated from the following files: