Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::BehaviorSequence Class Reference

The BehaviorSequence class - specialized Behavior executing sequence of provided subbehaviors one by one. More...

#include <BehaviorSequence.hh>

Inheritance diagram for grail::BehaviorSequence:
Collaboration diagram for grail::BehaviorSequence:

Public Member Functions

 BehaviorSequence (std::size_t expectedSequenceSize=3)
 BehaviorSequence. More...
 
 BehaviorSequence (const BehaviorSequence &other)=delete
 
 BehaviorSequence (BehaviorSequence &&other)=default
 
BehaviorSequenceoperator= (const BehaviorSequence &other)=delete
 
BehaviorSequenceoperator= (BehaviorSequence &&other)=delete
 
template<typename BehaviorType , typename... ConstructorArguments>
void AddBehavior (ConstructorArguments &&... constructorArguments)
 AddBehavior - method emplacing new behavior in the sequence. More...
 
virtual void Start (AIEntity &owner) override
 
virtual void Update (AIEntity &owner, float deltaTime) override
 
virtual void Finish (AIEntity &owner, const BehaviorStatus status) override
 
virtual bool IsFinished (const AIEntity &owner) const override
 
virtual bool IsLegal (const AIEntity &owner) const override
 IsLegal. More...
 
virtual bool IsInterruptible () const override
 IsInterruptible. More...
 
- Public Member Functions inherited from grail::Behavior
 Behavior (std::unique_ptr< Behavior > recoveryBehavior=nullptr)
 
 Behavior (Behavior &&)=default
 
Behavioroperator= (const Behavior &)=delete
 
Behavioroperator= (Behavior &&)=delete
 
BehaviorStatus GetStatus () const
 GetStatus. More...
 
virtual std::unique_ptr< BehaviorGetRecoveryBehavior ()
 
virtual std::string GetName () const
 

Additional Inherited Members

- Protected Attributes inherited from grail::Behavior
std::unique_ptr< BehaviorrecoveryBehavior {nullptr}
 

Detailed Description

The BehaviorSequence class - specialized Behavior executing sequence of provided subbehaviors one by one.

Constructor & Destructor Documentation

◆ BehaviorSequence()

grail::BehaviorSequence::BehaviorSequence ( std::size_t  expectedSequenceSize = 3)

BehaviorSequence.

Parameters
expectedSequenceSize- required to preallocate memory in container, by default 3

Member Function Documentation

◆ AddBehavior()

template<typename BehaviorType , typename... ConstructorArguments>
void grail::BehaviorSequence::AddBehavior ( ConstructorArguments &&...  constructorArguments)
inline

AddBehavior - method emplacing new behavior in the sequence.

Parameters
constructorArguments- forwarded BehaviorType constructor arguments

◆ Finish()

void grail::BehaviorSequence::Finish ( AIEntity owner,
const BehaviorStatus  status 
)
overridevirtual

Invoked after the behavior is finished or interrupted

Parameters
owner- the entity executing this behavior

Reimplemented from grail::Behavior.

◆ IsFinished()

bool grail::BehaviorSequence::IsFinished ( const AIEntity owner) const
overridevirtual
Parameters
owner- the entity executing this behavior

Reimplemented from grail::Behavior.

◆ IsInterruptible()

bool grail::BehaviorSequence::IsInterruptible ( ) const
overridevirtual

IsInterruptible.

Returns
true if current subbehavior is interruptible, false otherwise

Reimplemented from grail::Behavior.

◆ IsLegal()

bool grail::BehaviorSequence::IsLegal ( const AIEntity owner) const
overridevirtual

IsLegal.

Parameters
owner
Returns
true if current subbehavior is legal, false otherwise

Reimplemented from grail::Behavior.

◆ Start()

void grail::BehaviorSequence::Start ( AIEntity owner)
overridevirtual

Invoked after the behavior is assigned to AIEntity

Parameters
owner- the entity executing this behavior

Reimplemented from grail::Behavior.

◆ Update()

void grail::BehaviorSequence::Update ( AIEntity owner,
float  deltaTime 
)
overridevirtual

Invoked on each AIManager update

Parameters
owner- the entity executing this behavior

Reimplemented from grail::Behavior.


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