Panda3D
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
AIWorld Class Reference

A class that implements the virtual AI world which keeps track of the AI characters active at any given time. More...

#include "aiWorld.h"

Public Types

typedef std::vector< Flock * > FlockPool
 

Public Member Functions

 AIWorld (NodePath render)
 
void add_ai_char (AICharacter *ai_ch)
 
void add_flock (Flock *flock)
 This function adds all the AI characters in the Flock object to the AICharPool.
 
void add_obstacle (NodePath obstacle)
 This function adds the nodepath as an obstacle that is needed by the obstacle avoidance behavior.
 
void flock_off (unsigned int flock_id)
 This function turns off the flock behavior temporarily.
 
void flock_on (unsigned int flock_id)
 This function turns on the flock behavior.
 
Flock get_flock (unsigned int flock_id)
 This function returns a handle to the Flock whose id is passed.
 
void print_list ()
 This function prints the names of the AI characters that have been added to the AIWorld.
 
void remove_ai_char (std::string name)
 
void remove_ai_char_from_flock (std::string name)
 
void remove_flock (unsigned int flock_id)
 This function removes the flock behavior completely.
 
void remove_obstacle (NodePath obstacle)
 This function removes the nodepath from the obstacles list that is needed by the obstacle avoidance behavior.
 
void update ()
 The AIWorld update function calls the update function of all the AI characters which have been added to the AIWorld.
 

Public Attributes

FlockPool _flock_pool
 
std::vector< NodePath_obstacles
 

Detailed Description

A class that implements the virtual AI world which keeps track of the AI characters active at any given time.

It contains a linked list of AI characters, obstactle data and unique name for each character. It also updates each characters state. The AI characters can also be added to the world as flocks.

Definition at line 31 of file aiWorld.h.

Member Typedef Documentation

◆ FlockPool

typedef std::vector<Flock*> AIWorld::FlockPool

Definition at line 38 of file aiWorld.h.

Constructor & Destructor Documentation

◆ AIWorld()

AIWorld::AIWorld ( NodePath render)

Definition at line 16 of file aiWorld.cxx.

◆ ~AIWorld()

AIWorld::~AIWorld ( )

Definition at line 20 of file aiWorld.cxx.

Member Function Documentation

◆ add_ai_char()

void AIWorld::add_ai_char ( AICharacter * ai_ch)

Definition at line 23 of file aiWorld.cxx.

◆ add_flock()

void AIWorld::add_flock ( Flock * flock)

This function adds all the AI characters in the Flock object to the AICharPool.

This function allows adding the AI characetrs as part of a flock.

Definition at line 84 of file aiWorld.cxx.

◆ add_obstacle()

void AIWorld::add_obstacle ( NodePath obstacle)

This function adds the nodepath as an obstacle that is needed by the obstacle avoidance behavior.

Definition at line 158 of file aiWorld.cxx.

◆ flock_off()

void AIWorld::flock_off ( unsigned int flock_id)

This function turns off the flock behavior temporarily.

Similar to pausing the behavior.

Definition at line 128 of file aiWorld.cxx.

◆ flock_on()

void AIWorld::flock_on ( unsigned int flock_id)

This function turns on the flock behavior.

Definition at line 143 of file aiWorld.cxx.

◆ get_flock()

Flock AIWorld::get_flock ( unsigned int flock_id)

This function returns a handle to the Flock whose id is passed.

Definition at line 96 of file aiWorld.cxx.

◆ print_list()

void AIWorld::print_list ( )

This function prints the names of the AI characters that have been added to the AIWorld.

Useful for debugging purposes.

Definition at line 63 of file aiWorld.cxx.

◆ remove_ai_char()

void AIWorld::remove_ai_char ( std::string name)

Definition at line 29 of file aiWorld.cxx.

◆ remove_ai_char_from_flock()

void AIWorld::remove_ai_char_from_flock ( std::string name)

Definition at line 44 of file aiWorld.cxx.

◆ remove_flock()

void AIWorld::remove_flock ( unsigned int flock_id)

This function removes the flock behavior completely.

Definition at line 110 of file aiWorld.cxx.

◆ remove_obstacle()

void AIWorld::remove_obstacle ( NodePath obstacle)

This function removes the nodepath from the obstacles list that is needed by the obstacle avoidance behavior.

Definition at line 166 of file aiWorld.cxx.

◆ update()

void AIWorld::update ( )

The AIWorld update function calls the update function of all the AI characters which have been added to the AIWorld.

Definition at line 73 of file aiWorld.cxx.

References AICharacter::update().

Member Data Documentation

◆ _flock_pool

FlockPool AIWorld::_flock_pool

Definition at line 39 of file aiWorld.h.

◆ _obstacles

std::vector<NodePath> AIWorld::_obstacles

Definition at line 37 of file aiWorld.h.


The documentation for this class was generated from the following files: