Abstract representation of all the current elements in an instance of a game A Map is a collection of MapElement as well as helper data structures. More...
#include <Map.h>
Public Member Functions | |
bool | add (shared_ptr< VisibleEntity > e, int type, int x, int y, int z) |
Wrapper for calling add(shared_ptr<VisibleEntity> e, int type, int creatureType, int x, int y, intz) to support old code. More... | |
bool | add (shared_ptr< VisibleEntity > e, int type, int creatureType, int x, int y, int z, float HPFactor) |
Add a MapElement to the map. More... | |
bool | addBullet (int x, int y, int z, Vector3 velocity) |
bool | canAdd (int type, int creatureType) |
bool | canAddBox (int x, int y, int z) |
Checks if we can add a box at the given location. More... | |
bool | canSpawnCreature (int x, int y, int z, int occupancy) |
Checks if we can spawn a creature at the given location. More... | |
std::vector< shared_ptr< Change > > | getChange () |
Called by App. More... | |
shared_ptr< MapElement > | getClosestLOSEntity (Vector3 pos, float maxDist, int type) |
IntVec3 | getSelectedBuildPos (Ray ray) |
shared_ptr< MapElement > | getSelectedEntity (Ray ray, int type) |
Map (shared_ptr< DemoScene > scene) | |
Constructor. More... | |
bool | remove (shared_ptr< VisibleEntity > e) |
Remove an element with the corresponding VisibleEntity. More... | |
Public Attributes | |
shared_ptr< AABoxManager > | aaBoxManager |
Manages the AABox for all the objects in the map. More... | |
int | attackDamage [15][15][15] |
Area damage on each grid towards the Cube (defenders). More... | |
int | defendDamage [15][15][15] |
Area damage on each grid towards the Creature (attackers). More... | |
int | discoBallHP |
HP left for Disco Ball. More... | |
const IntVec3 | discoBallLoc = IntVec3(7,1,7) |
Location of Disco Ball. More... | |
std::vector< shared_ptr < MapElement > > | elements |
Array of MapElement that is in the map. More... | |
int | gold |
Gold left. More... | |
int | gridOccupancy [15][15][15] |
Keeps track of the occupancy of each grid. More... | |
bool | hasBox [15][15][15] |
Keeps track of if there is a box in the current grid. More... | |
int | m_bulletCount = 0 |
counts bullet for playing gun sound (can't play every turn other wise too noisy More... | |
shared_ptr< DemoScene > | m_scene |
Pointer to the scene. More... | |
Static Public Attributes | |
static const bool | debugMap = false |
Prints debug information if sets to true. More... | |
static const int | dimX = 15 |
X dimension of the map, currently hardcoded as 15 in many places. More... | |
static const int | dimY = 15 |
Y dimension of the map, currently hardcoded as 15 in many places. More... | |
static const int | dimZ = 15 |
Z dimension of the map, currently hardcoded as 15 in many places. More... | |
Protected Member Functions | |
void | foo () |
Abstract representation of all the current elements in an instance of a game A Map is a collection of MapElement as well as helper data structures.
It stores all the information about a game. App provides with specific information about a game i.e. the creature to spawn, the default terrain, used inputs and etc. VisualControl comminucates with it to update the graphics.
Information is stored in a 3D-grid. Currently this is a 15*15*15 Map
Map::Map | ( | shared_ptr< DemoScene > | scene | ) |
Constructor.
scene | the scene the relates to the map |
bool Map::add | ( | shared_ptr< VisibleEntity > | e, |
int | type, | ||
int | x, | ||
int | y, | ||
int | z | ||
) |
Wrapper for calling add(shared_ptr<VisibleEntity> e, int type, int creatureType, int x, int y, intz) to support old code.
creatureType is set to 0
bool Map::add | ( | shared_ptr< VisibleEntity > | e, |
int | type, | ||
int | creatureType, | ||
int | x, | ||
int | y, | ||
int | z, | ||
float | HPFactor | ||
) |
Add a MapElement to the map.
e | corresponding VisibleEntity |
type | type of MapElement |
creatureType | subtype |
x,y,z | initial location |
bool Map::addBullet | ( | int | x, |
int | y, | ||
int | z, | ||
Vector3 | velocity | ||
) |
bool Map::canAdd | ( | int | type, |
int | creatureType | ||
) |
bool Map::canAddBox | ( | int | x, |
int | y, | ||
int | z | ||
) |
Checks if we can add a box at the given location.
Checks if there is any element in the grid already and if there is proper support for the box.
x,y,z | location to check |
bool Map::canSpawnCreature | ( | int | x, |
int | y, | ||
int | z, | ||
int | occupancy | ||
) |
Checks if we can spawn a creature at the given location.
x,y,z | location to check |
occupancy | occupancy of the Creature to be spawned |
|
protected |
std::vector< shared_ptr< Change > > Map::getChange | ( | ) |
Called by App.
Computes and returns an array of changes to the VisibleEntity MapElement::run() and MapElement::updateHP() is called for every MapElement in elements. Any elements with HP below zero gets removed. Any elements that changed is included in the array of changes.
shared_ptr< MapElement > Map::getClosestLOSEntity | ( | Vector3 | pos, |
float | maxDist, | ||
int | type | ||
) |
IntVec3 Map::getSelectedBuildPos | ( | Ray | ray | ) |
shared_ptr< MapElement > Map::getSelectedEntity | ( | Ray | ray, |
int | type | ||
) |
bool Map::remove | ( | shared_ptr< VisibleEntity > | e | ) |
Remove an element with the corresponding VisibleEntity.
e | VisibleEntity to be removed |
shared_ptr<AABoxManager> Map::aaBoxManager |
Manages the AABox for all the objects in the map.
int Map::attackDamage[15][15][15] |
Area damage on each grid towards the Cube (defenders).
Reset every turn. Single-target damage is dealted directly in MapElement::run()
|
static |
Prints debug information if sets to true.
int Map::defendDamage[15][15][15] |
Area damage on each grid towards the Creature (attackers).
Reset every turn. Single-target damage is dealted directly in MapElement::run()
|
static |
X dimension of the map, currently hardcoded as 15 in many places.
|
static |
Y dimension of the map, currently hardcoded as 15 in many places.
|
static |
Z dimension of the map, currently hardcoded as 15 in many places.
int Map::discoBallHP |
HP left for Disco Ball.
std::vector<shared_ptr<MapElement> > Map::elements |
Array of MapElement that is in the map.
int Map::gold |
Gold left.
Used to construct Cube. Can't construct without gold
int Map::gridOccupancy[15][15][15] |
Keeps track of the occupancy of each grid.
If it exceeds 100, no more MapElement can be added
bool Map::hasBox[15][15][15] |
Keeps track of if there is a box in the current grid.
Used for implementing basic gravity on boxes
int Map::m_bulletCount = 0 |
counts bullet for playing gun sound (can't play every turn other wise too noisy
shared_ptr<DemoScene> Map::m_scene |
Pointer to the scene.