CCmpBrain Class Reference

AI used to control Entities. More...

#include <cmpBrain.h>

Inheritance diagram for CCmpBrain:

CCmp

List of all members.

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.


Detailed Description

AI used to control Entities.

(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.

Author:
Doug Poston
Version:
1.3
Date:
12/28/2007

Member Enumeration Documentation

enum CCmpBrain::eState

Brain States.

Enumerator:
kNone  Running idle commands.
kDest  Heading to a dest point.
kFollow  Follow another entity.
kAvoid  Avoid another entity.
kAttack  Attack an entity.


Member Function Documentation

int CCmpBrain::set ( const EDIT_DATA editData  )  [virtual]

Set a value.

If we have data of this type, use editData to set its value.

Parameters:
editData Data type and value (see EDIT_DATA struct).
Returns:
Value less than zero on error, 0 if nothing found, positive otherwise.
See also:
EDIT_DATA


Handles the following EDIT_DATA:

Implements CCmp.

int CCmpBrain::get ( EDIT_DATA editData  )  const [virtual]

Get a value.

If we have data of this type, use editData to get its value.

Parameters:
editData Data type we are looking for, and memory to store value (see EDIT_DATA struct).
Returns:
Value less than zero on error, 0 if nothing found, positive otherwise.
See also:
EDIT_DATA


Handles the following EDIT_DATA:

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).

Parameters:
actData The data used to preform the action (see ACTION_DATA struct).
Returns:
Value less than zero on error, 0 if no action found, positive otherwise.
See also:
ACTION_DATA


Handles the following ACTION_DATA:

Implements CCmp.

bool CCmpBrain::get_goal (  ) 

Check other Cmps to see if we have a new goal

Returns:
true If we have a new goal (saved in m_eState)

bool CCmpBrain::move_to_dest ( CCmpControl pCmpCntl,
unit  fRange = 10.0 
)

Navigate GE to a position

Parameters:
pCmpCntl Pointer to control Cmp used to control parent GE
fRange If we are closer than this to the target, we've reached it
Returns:
true if we are at the target position

bool CCmpBrain::attack ( CCmpControl pCmpCntl  ) 

Try to attack a target

Parameters:
pCmpCntl Pointer to control Cmp used to control parent GE
Returns:
true if we have a target to attack


The documentation for this class was generated from the following files:
Generated on Fri Dec 28 12:55:07 2007 for template7 by  doxygen 1.5.4