Rasterization-DiscoBall
 All Classes Files Functions Variables Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
BasicTower Class Reference

#include <Map.h>

Inheritance diagram for BasicTower:
Cube MapElement

Public Member Functions

 BasicTower (shared_ptr< VisibleEntity > e, int x, int y, int z, Map *m)
 
virtual int getOccupancy ()
 
virtual int getType ()
 
virtual bool move ()
 Take a move This is the method that actually determines the behavior of the creature. More...
 
virtual void onDeath ()
 Update m_map when it dies. More...
 
virtual void onSpawn ()
 Update m_map when it spawns. More...
 
- Public Member Functions inherited from Cube
 Cube (shared_ptr< VisibleEntity > e, int x, int y, int z, Map *m)
 
- Public Member Functions inherited from MapElement
bool atDiscoBall (int x, int y, int z, int range)
 Helper for calling atDiscoBall(IntVec3 v, int range) More...
 
bool atDiscoBall (IntVec3 v, int range)
 
bool attack (int x, int y, int z, int damage)
 Attack the position on a grid Does attack damage if a Creature and defend Damage if a Cube. More...
 
bool attack (IntVec3 v, int damage)
 Helper for calling attack(int x,int y,int z,int damage) More...
 
bool attack (IntVec3 old, int x, int y, int z, int damage)
 Helper for calling attack(int x,int y,int z,int damage) More...
 
bool attackDiscoBall (int damage)
 Attack the Disco Ball!!!! More...
 
bool boundaryCheck (int x, int y, int z)
 Check if this position is in the Map grid in order to avoid bad access. More...
 
virtual AABox getAABox ()
 Get the AABox corresponding to the creature. More...
 
virtual int getBounty ()
 
bool hasBox (int x, int y, int z)
 Check if there is a box at the specified position. More...
 
bool hasBox (IntVec3 v)
 Helper for calling hasBox(int x, int y, int z);. More...
 
bool inMap ()
 Check if the MapElement is close to the Disco Ball. More...
 
bool isValidMove (int x, int y, int z)
 Check if can move to the position Can move if the occupancy of this MapElement sums the gridOccupancy of the destination grid is less than or equal to 100. More...
 
bool isValidMove (IntVec3 v)
 Helper for calling isValidMove(int x, int y, int z);. More...
 
bool isValidMove (IntVec3 old, int x, int y, int z)
 Helper for calling isValidMove(int x, int y, int z);. More...
 
 MapElement (shared_ptr< VisibleEntity > e, int x, int y, int z, Map *m)
 Constructor. More...
 
bool operator< (const MapElement &other) const
 Overloaded less than for sorting. More...
 
float randFloat ()
 Generates pseudo-random float between 0 and 1. More...
 
virtual void run ()
 Called every frame to update the MapElement A MapElement takes a certain number of turns(frames) to finish a move. More...
 
virtual void takeDamage ()
 Takes damage from the grid for both the oldPos and newPos. More...
 
void updateHP ()
 Called every frame to update the HP of the MapElement. More...
 

Public Attributes

shared_ptr< Sound > shot
 
- Public Attributes inherited from Cube
int color
 
- Public Attributes inherited from MapElement
AABox aaBox
 Used for raycasting. More...
 
bool change
 True if anything about it has changed in the past frame, vice versa. More...
 
Vector3 displacement
 Displacement per frame. More...
 
shared_ptr< VisibleEntity > entity
 Pointer to the VisibleEntity in the actual Scene. More...
 
Mapm_map
 Pointer to the map. More...
 
int maxHP
 Max HP of creature. More...
 
int newHP
 HP at this frame. More...
 
Vector3 newOffset
 Offset used for random placement within a Map grid. More...
 
IntVec3 newPos
 Destination of this after finishing the current move. More...
 
int oldHP
 HP before this frame. More...
 
Vector3 oldOffset
 Offset used for random placement within a Map grid. More...
 
IntVec3 oldPos
 Previous position of this before the current move. More...
 
int suicide = false
 If true, no bounty is given upon death. More...
 
int turnsLeft
 Number of frames left before the current move is finished. More...
 

Static Public Attributes

static const int cost = 5000
 
static const int creatureType = 1
 
static const int occupancy = 100
 
- Static Public Attributes inherited from Cube
static const int cost = 1000
 
static const int creatureType = 0
 
static const int occupancy = 100
 
static const int type = 1
 

Additional Inherited Members

- Protected Member Functions inherited from Cube
bool checkIfFall (int x, int y, int z)
 
bool checkSupport (int x, int y, int z)
 

Constructor & Destructor Documentation

BasicTower::BasicTower ( shared_ptr< VisibleEntity >  e,
int  x,
int  y,
int  z,
Map m 
)
inline

Member Function Documentation

int BasicTower::getOccupancy ( )
virtual
Returns
the occupancy of it

Reimplemented from Cube.

int BasicTower::getType ( )
virtual
Returns
the type of it

Reimplemented from Cube.

bool BasicTower::move ( )
virtual

Take a move This is the method that actually determines the behavior of the creature.

Called by run() everytime when turnsLeft = 0;

Must update turnsLeft. Must be overridden in sub classesA

Reimplemented from Cube.

void BasicTower::onDeath ( )
virtual

Update m_map when it dies.

Reimplemented from Cube.

void BasicTower::onSpawn ( )
virtual

Update m_map when it spawns.

Reimplemented from Cube.

Member Data Documentation

const int BasicTower::cost = 5000
static
const int BasicTower::creatureType = 1
static
const int BasicTower::occupancy = 100
static
shared_ptr<Sound> BasicTower::shot

The documentation for this class was generated from the following files: