#include <cmpBrain.h>
Public Types | |
enum | eState { kNone = 0, kDest = 1, kFollow, kAvoid, kAttack } |
Brain States. More... | |
Public Member Functions | |
CCmpBrain (CGameEntity *pGE) | |
Create with default values. | |
eState | state () const |
Get the current AI state. | |
bool | get_goal () |
bool | move_to_dest (CCmpControl *pCmpCntl, unit fRange=10.0) |
bool | attack (CCmpControl *pCmpCntl) |
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. |
(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 CCmpBrain::eState |
int CCmpBrain::set | ( | const EDIT_DATA & | editData | ) | [virtual] |
int CCmpBrain::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 CCmpBrain::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 CCmpBrain::get_goal | ( | ) |
Check other Cmps to see if we have a new goal
bool CCmpBrain::move_to_dest | ( | CCmpControl * | pCmpCntl, | |
unit | fRange = 10.0 | |||
) |
Navigate GE to a position
pCmpCntl | Pointer to control Cmp used to control parent GE | |
fRange | If we are closer than this to the target, we've reached it |
bool CCmpBrain::attack | ( | CCmpControl * | pCmpCntl | ) |
Try to attack a target
pCmpCntl | Pointer to control Cmp used to control parent GE |