![]() |
CUGL 1.2
Cornell University Game Library
|
#include <CUSelectorNode.h>
Public Member Functions | |
SelectorNode () | |
~SelectorNode () | |
virtual int | selectChild () const override |
![]() | |
CompositeNode () | |
~CompositeNode () | |
virtual void | dispose () override |
bool | isPreemptive () const |
void | setPreemptive (bool preemptive) |
const BehaviorNode * | getChildByPriorityIndex (Uint32 index) const |
template<typename T > | |
const T * | getChildByPriorityIndex (Uint32 index) const |
const BehaviorNode * | getActiveChild () const |
template<typename T > | |
const T * | getActiveChild () const |
virtual void | query (float dt) override |
BehaviorNode::State | update (float dt) override |
![]() | |
BehaviorNode () | |
~BehaviorNode () | |
bool | init (const std::string &name) |
const std::string & | getName () const |
float | getPriority () const |
BehaviorNode::State | getState () const |
virtual void | setState (BehaviorNode::State state) |
std::function< float()> | getPrioritizer () const |
void | setPrioritizer (const std::function< float()> &func) |
virtual std::string | toString (bool verbose=false) const |
operator std::string () const | |
const BehaviorNode * | getParent () const |
void | setParent (BehaviorNode *parent) |
void | removeFromParent () |
int | getParentalOffset () const |
size_t | getChildCount () const |
std::vector< const BehaviorNode * > | getChildren () const |
const BehaviorNode * | getChild (Uint32 pos) const |
template<typename T > | |
const T * | getChild (Uint32 pos) const |
const BehaviorNode * | getNodeByName (const std::string &name) const |
const BehaviorNode * | getNodeByName (const char *name) const |
template<typename T > | |
const T * | getNodeByName (const std::string &name) const |
template<typename T > | |
const T * | getNodeByName (const char *name) const |
virtual void | reset () |
virtual void | pause () |
virtual void | resume () |
virtual void | preempt () |
virtual void | start () |
void | setPriority (float priority) |
std::shared_ptr< BehaviorNode > | removeChild (Uint32 pos) |
void | addChild (const std::shared_ptr< BehaviorNode > child) |
Additional Inherited Members | |
![]() | |
enum | State : unsigned int { State::INACTIVE = 0, State::RUNNING = 1, State::PAUSED = 2, State::FINISHED = 3 } |
![]() | |
static bool | compareSiblings (const std::shared_ptr< BehaviorNode > &a, const std::shared_ptr< BehaviorNode > &b) |
![]() | |
bool | _preemptive |
![]() | |
std::string | _name |
std::string | _classname |
BehaviorNode * | _parent |
BehaviorNode::State | _state |
float | _priority |
std::function< float()> | _prioritizer |
std::vector< std::shared_ptr< BehaviorNode > > | _children |
int | _activeChild |
int | _childOffset |
A class providing a selector composite node for a behavior tree.
A selector node is a composite node that is designed to select and run the first child with a non-zero priority and run it. If the selector node is allowed to preempt, a child that is running may be overridden by an earlier child with a non-zero priority during the update function.
If the selector node is not assigned a priority function, its priority will be assigned as the priority of the running child if this node is currently running, or as the priority of first of its children with a non-zero priority.
A selector node's state is directly based upon the child node currently running or the child node that has finished running. Only one child node will finish running as part of the SelectorNode.
|
inline |
Creates an uninitialized selector node.
You should never call this constructor directly. Instead, you should allocate a node with the BehaviorManager instance.
|
inline |
Deletes this node, disposing all resources.
|
overridevirtual |
Returns a (possibly new) active child for this node.
This method is subclass dependent, and uses the rules of that subclass to select a child. If no child is selected, this method returns -1.
Implements cugl::ai::CompositeNode.