#include <cmpSenses.h>
Public Types | |
enum | eFlags { kEnemyVisible = 0, kEnemyAware } |
Level of awareness. More... | |
Public Member Functions | |
Create methods | |
CCmpSenses (CGameEntity *pGE) | |
Create with default values. | |
~CCmpSenses () | |
Virtual methods | |
virtual int | set (const EDIT_DATA &editData) |
Set a value. | |
virtual int | get (EDIT_DATA &editData) const |
Get a value. | |
virtual int | act (const ACTION_DATA &actData) |
Preform an action. | |
virtual void | update () |
Update this Cmp for a single frame. | |
Sight methods | |
bool | inFOV (CVector3D &vUnit, unit halfFOVRad) |
In the GE's field-of-view? | |
bool | inLOS (CGameEntity *pTarget) |
In the GE's line-of-sight? | |
Memory methods | |
void | memory_update (const OBJTYPE_DATA *pData, CVector3D &vPos, CVector3D &vUnit, unit dist, bool bInFOV) |
Add/update a memory record. | |
void | memory_prune (unit timeTotal) |
Prune old records out of current list. | |
bool | memory_remove (long id) |
Remove a memory record. | |
SENSEMEMORY_DATA * | memory_closest () |
Who's closest? | |
Info methods | |
bool | isAware () const |
| |
bool | isVisible () const |
|
(c) 2007-2008 oP group Germany GbR. All rights reserved.
This source code is provided "as is" with no warranty and must not be distributed without written permission.
enum CCmpSenses::eFlags |
int CCmpSenses::set | ( | const EDIT_DATA & | editData | ) | [virtual] |
Set a value.
If we have data of this type, use editData to set its value.
editData | Data type and value (see EDIT_DATA struct). |
Implements CCmp.
int CCmpSenses::get | ( | EDIT_DATA & | editData | ) | const [virtual] |
Get a value.
If we have data of this type, use editData to get its value.
editData | Data type we are looking for, and memory to store value (see EDIT_DATA struct). |
Implements CCmp.
int CCmpSenses::act | ( | const ACTION_DATA & | actData | ) | [virtual] |
Preform an action.
Handle the action passed in (ignore if we do not handle the action type).
actData | The data used to preform the action (see ACTION_DATA struct). |
Implements CCmp.
bool CCmpSenses::inFOV | ( | CVector3D & | vUnit, | |
unit | halfFOVRad | |||
) |
In the GE's field-of-view?
vUnit | Unit vector in the direction we are checking | |
halfFOVRad | Half the FOV ang (messured in radians) |
bool CCmpSenses::inLOS | ( | CGameEntity * | pTarget | ) |
In the GE's line-of-sight?
pTarget | Target object. |
void CCmpSenses::memory_update | ( | const OBJTYPE_DATA * | pData, | |
CVector3D & | vPos, | |||
CVector3D & | vUnit, | |||
unit | dist, | |||
bool | bInFOV | |||
) |
Add/update a memory record.
pData | Pointer to the OBJTYPE_DATA | |
vPos | Position of sensed object | |
vUnit | Unit vector pointing to sensed object | |
dist | Distance to sensed object | |
bInFOV | IS this object in our Field-of-View? |
void CCmpSenses::memory_prune | ( | unit | timeTotal | ) |
Prune old records out of current list.
timeTotal | Total number of ticks since the start of the game. |
bool CCmpSenses::memory_remove | ( | long | id | ) |
Remove a memory record.
id | Entity ID of record to be removed. |
SENSEMEMORY_DATA * CCmpSenses::memory_closest | ( | ) |
Who's closest?