hoa_map::private_map::EnemyZone Class Reference

Class that represents an area where enemies spawn and roam in. More...

#include <map_zones.h>

Inheritance diagram for hoa_map::private_map::EnemyZone:

Inheritance graph
[legend]
Collaboration diagram for hoa_map::private_map::EnemyZone:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void AddEnemy (EnemySprite *new_enemy, MapMode *map, uint8 count=1)
 Adds a new enemy sprite to the zone.
void EnemyDead ()
 Decrements the number of active enemies by one.
 EnemyZone (uint32 regen_time, bool restrained)
void Update ()
 Gradually spawns enemy sprites in the zone.
virtual ~EnemyZone ()
Class Member Access Functions
bool IsRestraining () const

Private Attributes

uint8 _active_enemies
 The number of enemies that are currently not in the DEAD state.
std::vector< EnemySprite * > _enemies
 Contains all of the enemies that may exist in this zone.
uint32 _regen_time
 The amount of time that should elapse before spawning the next enemy sprite.
bool _restrained
 If true, enemies of this zone are not allowed to roam outside of the zone boundaries.
uint32 _spawn_timer
 A timer used for the respawning of enemies in the zone.

Detailed Description

Class that represents an area where enemies spawn and roam in.

****************************************************************************

This class makes a zone regenerate dead enemies after a certain amount of time. The enemies can be constrained in the zone area or be free to roam the whole map after spawning.

Definition at line 98 of file map_zones.h.


Constructor & Destructor Documentation

hoa_map::private_map::EnemyZone::EnemyZone ( uint32  regen_time,
bool  restrained 
)

Definition at line 70 of file map_zones.cpp.

virtual hoa_map::private_map::EnemyZone::~EnemyZone (  )  [inline, virtual]

Definition at line 102 of file map_zones.h.


Member Function Documentation

void hoa_map::private_map::EnemyZone::AddEnemy ( EnemySprite new_enemy,
MapMode map,
uint8  count = 1 
)

Adds a new enemy sprite to the zone.

Parameters:
new_enemy A pointer to the EnemySprite object instance to add
map A pointer to the MapMode instance to add the EnemySprite to
count The number of copies of this enemy to add

Definition at line 79 of file map_zones.cpp.

References hoa_map::MapMode::_AddGroundObject(), _enemies, hoa_map::MapMode::_GetGeneratedObjectID(), hoa_map::private_map::EnemySprite::GetTimeToChange(), hoa_map::MAP_DEBUG, hoa_video::RandomFloat(), hoa_map::private_map::EnemySprite::Reset(), hoa_map::private_map::MapObject::SetObjectID(), hoa_map::private_map::EnemySprite::SetTimeToChange(), and hoa_map::private_map::EnemySprite::SetZone().

Here is the call graph for this function:

void hoa_map::private_map::EnemyZone::EnemyDead (  ) 

Decrements the number of active enemies by one.

Definition at line 108 of file map_zones.cpp.

References _active_enemies.

Referenced by hoa_map::private_map::EnemySprite::ChangeStateDead().

bool hoa_map::private_map::EnemyZone::IsRestraining (  )  const [inline]

Definition at line 120 of file map_zones.h.

References _restrained.

Referenced by hoa_map::private_map::EnemySprite::Update().

void hoa_map::private_map::EnemyZone::Update (  )  [virtual]

Gradually spawns enemy sprites in the zone.

Reimplemented from hoa_map::private_map::MapZone.

Definition at line 114 of file map_zones.cpp.

References _active_enemies, hoa_map::MapMode::_current_map, hoa_map::MapMode::_DetectCollision(), _enemies, hoa_map::private_map::MapZone::_RandomPosition(), _regen_time, _spawn_timer, and hoa_system::SystemManager.

Here is the call graph for this function:


Member Data Documentation

uint8 hoa_map::private_map::EnemyZone::_active_enemies [private]

The number of enemies that are currently not in the DEAD state.

Definition at line 132 of file map_zones.h.

Referenced by EnemyDead(), and Update().

std::vector<EnemySprite*> hoa_map::private_map::EnemyZone::_enemies [private]

Contains all of the enemies that may exist in this zone.

Definition at line 138 of file map_zones.h.

Referenced by AddEnemy(), and Update().

uint32 hoa_map::private_map::EnemyZone::_regen_time [private]

The amount of time that should elapse before spawning the next enemy sprite.

Definition at line 126 of file map_zones.h.

Referenced by Update().

bool hoa_map::private_map::EnemyZone::_restrained [private]

If true, enemies of this zone are not allowed to roam outside of the zone boundaries.

Definition at line 135 of file map_zones.h.

Referenced by IsRestraining().

uint32 hoa_map::private_map::EnemyZone::_spawn_timer [private]

A timer used for the respawning of enemies in the zone.

Definition at line 129 of file map_zones.h.

Referenced by Update().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:50 2007 for Hero of Allacrost by  doxygen 1.5.1