Panda3D
Loading...
Searching...
No Matches
aiWorld.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file aiWorld.h
10 * @author Deepak, John, Navin
11 * @date 2009-09-08
12 */
13
14#ifndef _AIWORLD_H
15#define _AIWORLD_H
16
17#include "aiGlobals.h"
18#include "aiCharacter.h"
19#include "flock.h"
20
21class AICharacter;
22class Flock;
23
24/**
25 * A class that implements the virtual AI world which keeps track of the AI
26 * characters active at any given time. It contains a linked list of AI
27 * characters, obstactle data and unique name for each character. It also
28 * updates each characters state. The AI characters can also be added to the
29 * world as flocks.
30 */
31class EXPCL_PANDAAI AIWorld {
32 private:
33 typedef std::vector<PT(AICharacter)> AICharPool;
34 AICharPool _ai_char_pool;
35 NodePath _render;
36 public:
37 std::vector<NodePath> _obstacles;
38 typedef std::vector<Flock*> FlockPool;
39 FlockPool _flock_pool;
40 void remove_ai_char_from_flock(std::string name);
41
42PUBLISHED:
43 AIWorld(NodePath render);
44 ~AIWorld();
45
46 void add_ai_char(AICharacter *ai_ch);
47 void remove_ai_char(std::string name);
48
49 void add_flock(Flock *flock);
50 void flock_off(unsigned int flock_id);
51 void flock_on(unsigned int flock_id);
52 void remove_flock(unsigned int flock_id);
53 Flock get_flock(unsigned int flock_id);
54
55 void add_obstacle(NodePath obstacle);
56 void remove_obstacle(NodePath obstacle);
57
58 void print_list();
59 void update();
60};
61
62#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void print_list()
This function prints the names of the AI characters that have been added to the AIWorld.
Definition aiWorld.cxx:63
void add_flock(Flock *flock)
This function adds all the AI characters in the Flock object to the AICharPool.
Definition aiWorld.cxx:84
void update()
The AIWorld update function calls the update function of all the AI characters which have been added ...
Definition aiWorld.cxx:73
void remove_flock(unsigned int flock_id)
This function removes the flock behavior completely.
Definition aiWorld.cxx:110
Flock get_flock(unsigned int flock_id)
This function returns a handle to the Flock whose id is passed.
Definition aiWorld.cxx:96
void flock_off(unsigned int flock_id)
This function turns off the flock behavior temporarily.
Definition aiWorld.cxx:128
void flock_on(unsigned int flock_id)
This function turns on the flock behavior.
Definition aiWorld.cxx:143
void add_obstacle(NodePath obstacle)
This function adds the nodepath as an obstacle that is needed by the obstacle avoidance behavior.
Definition aiWorld.cxx:158
void remove_obstacle(NodePath obstacle)
This function removes the nodepath from the obstacles list that is needed by the obstacle avoidance b...
Definition aiWorld.cxx:166
This class is used to define the flock attributes and the AI characters which are part of the flock.
Definition flock.h:26
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.