|
| enum | TowerType { ARROW,
MAGIC,
UNIT
} |
| |
|
| | TowerPlacer (shared_ptr< TerrainTree > const &terrainTree, shared_ptr< ProjectileManager > const &projectileMgr, shared_ptr< Path > const &path, std::function< void(shared_ptr< Minion >)> const &unitSpawnCallback) |
| | Constructs an instance of TowerPlacer. More...
|
| |
|
shared_ptr< tower::Tower > | place () |
| | If location is valid for tower placement, puts a tower into the container.
|
| |
|
virtual void | update (sf::Vector2f const &mousePosition) |
| | Updates position to match mouse and calculates validity.
|
| |
| void | activate (TowerType type) |
| | Sets the TowerPlacer to be active. Must be called before update, draw or place do anything. More...
|
| |
|
void | setSticky (bool sticky) |
| | If true, placing a tower will not remove the tower placer form the cursor.
|
| |
| void | draw (sf::RenderTarget &renderTarget) const |
| | Draws the tower overlay to the render target. More...
|
| |
|
bool | isActive () const |
| |
|
|
virtual void | checkValidity () |
| | Checks if the current location is valid for placement.
|
| |
|
void | calculateColor () |
| | Sets the color of the overlay to red or green depending on validity.
|
| |
|
|
TowerType | mTowerType |
| | The type of tower that will be placed.
|
| |
|
bool | mIsActive |
| | If this is false, calls to methods other than activate() will do nothing.
|
| |
|
bool | mIsValid |
| | True if the current location is valid for tower placement.
|
| |
|
shared_ptr< TerrainTree > | mTerrainTree |
| | The Quadtree<unsigned char> that will be used to check points against terrain for validity.
|
| |
|
sf::Sprite | mOverlay |
| | A ghost tower that show where the tower would be placed and colored to show validity.
|
| |
|
sf::Shape * | mMask |
| | Shape used to test for validity with the terrain tree.
|
| |
|
bool | mIsSticky |
| | If true, placing a tower will not deactivate the placer.
|
| |
|
|
static const sf::Color | mValidColor |
| |
|
static const sf::Color | mInvalidColor |
| |
|
static const std::string | mArrowTowerDefPath |
| |
|
static const std::string | mMagicTowerDefPath |
| |
|
static const std::string | mUnitTowerDefPath |
| |
| TowerPlacer::TowerPlacer |
( |
shared_ptr< TerrainTree > const & |
terrainTree, |
|
|
shared_ptr< ProjectileManager > const & |
projectileMgr, |
|
|
shared_ptr< Path > const & |
path, |
|
|
std::function< void(shared_ptr< Minion >)> const & |
unitSpawnCallback |
|
) |
| |
Constructs an instance of TowerPlacer.
- Parameters
-
| terrainTree | Quadtree used to determine where is valid for tower placement. |
| projectileMgr | Shared pointer to a ProjectileManager. Created towers will add their projectiles to this. |
| path | Path onto which UnitTowers will send their spawned units. |
| unitSpawnCallback | Given to unit towers so that they can spawn units. |
| void TowerPlacer::activate |
( |
TowerType |
type | ) |
|
Sets the TowerPlacer to be active. Must be called before update, draw or place do anything.
- Parameters
-
| type | The type of tower to be placed. |
| void TowerPlacer::draw |
( |
sf::RenderTarget & |
renderTarget | ) |
const |
Draws the tower overlay to the render target.
The documentation for this class was generated from the following file: