Emergency 20 Dokumentation  4.2.0
qsf::ai::reactionrules::EntityInteraction Class Referenceabstract

#include <EntityInteractionRules.h>

Inheritance diagram for qsf::ai::reactionrules::EntityInteraction:
qsf::ai::reactionrules::StandardRule qsf::ai::ReactionRule

Classes

struct  PreviousInteraction
 

Public Member Functions

 EntityInteraction (bool expectAcknowledgeFromParticipant)
 
virtual void serialize (BinarySerializer &serializer) override
 
virtual bool handle (const EvaluationParameters &parameters) override
 
virtual bool wantsHandlingDespiteOfLowerPriority () const
 
- Public Member Functions inherited from qsf::ai::reactionrules::StandardRule
 StandardRule (EvaluationParameters::PerceptionEventSource eventSource)
 
virtual const char * getRegistrationName () const =0
 
virtual void deserialize (const boost::property_tree::ptree &tree)
 
virtual void serialize (boost::property_tree::ptree &tree) const
 
- Public Member Functions inherited from qsf::ai::ReactionRule
 ReactionRule ()
 
 ReactionRule (const ReactionRule &src)
 
virtual ~ReactionRule ()
 
virtual ReactionRuleclone () const =0
 
const std::string & getName () const
 
uint32 getId () const
 
Percentage getProbability () const
 
void setProbability (Percentage probability)
 
action::Priority getPriority () const
 

Protected Types

enum  InteractionStatus { NO_INTERACTION =0, INTERACTION_STARTED, STILL_INTERACTING, INTERACTION_ENDED }
 

Protected Member Functions

InteractionStatus checkAndHandleEvents (const EvaluationParameters &parameters, PerceptionEvent &event)
 
bool triggerCallbacks (InteractionStatus status, const EvaluationParameters &parameters, PerceptionEvent &event)
 
void sendCancelEventTo (const EvaluationParameters &parameters, uint64 targetEntityId) const
 
bool cancelInteraction (const EvaluationParameters &parameters, bool notifyParticipant)
 
void updatePreviousInteractionsRecords (const EvaluationParameters &parameters)
 
bool hasBeenInteractionWith (uint64 entityId) const
 
void recordInteraction (const EvaluationParameters &parameters)
 
EntitygetParticipant () const
 
virtual bool isValidParticipant (const EvaluationParameters &parameters, const PerceptionEvent &event, Entity &entity)
 
virtual bool onBeginInteration (const EvaluationParameters &parameters, const PerceptionEvent &event)=0
 
virtual bool onStillInterating (const EvaluationParameters &parameters, const PerceptionEvent &event)
 
virtual void onEndInteration (const EvaluationParameters &parameters, const PerceptionEvent &event)
 
- Protected Member Functions inherited from qsf::ai::reactionrules::StandardRule
EvaluationParameters::PerceptionEventIterator checkForEvent (const EvaluationParameters &parameters) const
 
- Protected Member Functions inherited from qsf::ai::ReactionRule
bool pushEventToEntity (const PerceptionEvent &perceptionEvent) const
 

Protected Attributes

float mNoInteractionWithSameParticipantFor
 
RingBuffer< PreviousInteraction, size_t, 4 > mPreviousInteractions
 
- Protected Attributes inherited from qsf::ai::reactionrules::StandardRule
NamedIdentifier mEventId
 
EvaluationParameters::PerceptionEventSource mEventSource
 

Additional Inherited Members

- Static Public Member Functions inherited from qsf::ai::ReactionRule
static bool compareByPriority (const ReactionRule *a, const ReactionRule *b)
 

Detailed Description

Base class for entity-interaction (for example social-behaviour). It handles notification of the respective social participant by forwarding the event to it. A derived class has to override the isValidParticipant-method for any additional checks beforehand (for example: is it a civilian, is it going by foot, etc.). To actually trigger an action onBeginInteration has to be overridden. onEndInteration is called when the participant left.

Sensor-Configuration: The corresponding sensor has to be configured to

AutoPushEvents=true EventOnPerceptionStart=true EventOnPerceptionContinue=false EventOnPerceptionEnd=false

Note: the participant (!) entity doesn't strictly need a sensor. (example: prostitute vs. male civilian behaviour, only the prostitute needs a sensor)

Member Enumeration Documentation

Enumerator
NO_INTERACTION 
INTERACTION_STARTED 
STILL_INTERACTING 
INTERACTION_ENDED 

Constructor & Destructor Documentation

qsf::ai::reactionrules::EntityInteraction::EntityInteraction ( bool  expectAcknowledgeFromParticipant)

Member Function Documentation

bool qsf::ai::reactionrules::EntityInteraction::cancelInteraction ( const EvaluationParameters parameters,
bool  notifyParticipant 
)
protected
InteractionStatus qsf::ai::reactionrules::EntityInteraction::checkAndHandleEvents ( const EvaluationParameters parameters,
PerceptionEvent event 
)
protected
Entity* qsf::ai::reactionrules::EntityInteraction::getParticipant ( ) const
protected
virtual bool qsf::ai::reactionrules::EntityInteraction::handle ( const EvaluationParameters parameters)
overridevirtual

Implements qsf::ai::ReactionRule.

bool qsf::ai::reactionrules::EntityInteraction::hasBeenInteractionWith ( uint64  entityId) const
protected
virtual bool qsf::ai::reactionrules::EntityInteraction::isValidParticipant ( const EvaluationParameters parameters,
const PerceptionEvent event,
Entity entity 
)
protectedvirtual
virtual bool qsf::ai::reactionrules::EntityInteraction::onBeginInteration ( const EvaluationParameters parameters,
const PerceptionEvent event 
)
protectedpure virtual
virtual void qsf::ai::reactionrules::EntityInteraction::onEndInteration ( const EvaluationParameters parameters,
const PerceptionEvent event 
)
protectedvirtual
virtual bool qsf::ai::reactionrules::EntityInteraction::onStillInterating ( const EvaluationParameters parameters,
const PerceptionEvent event 
)
protectedvirtual
void qsf::ai::reactionrules::EntityInteraction::recordInteraction ( const EvaluationParameters parameters)
protected
void qsf::ai::reactionrules::EntityInteraction::sendCancelEventTo ( const EvaluationParameters parameters,
uint64  targetEntityId 
) const
protected
virtual void qsf::ai::reactionrules::EntityInteraction::serialize ( BinarySerializer serializer)
overridevirtual

Reimplemented from qsf::ai::ReactionRule.

bool qsf::ai::reactionrules::EntityInteraction::triggerCallbacks ( InteractionStatus  status,
const EvaluationParameters parameters,
PerceptionEvent event 
)
protected
void qsf::ai::reactionrules::EntityInteraction::updatePreviousInteractionsRecords ( const EvaluationParameters parameters)
protected
virtual bool qsf::ai::reactionrules::EntityInteraction::wantsHandlingDespiteOfLowerPriority ( ) const
virtual

Reimplemented from qsf::ai::ReactionRule.

Member Data Documentation

float qsf::ai::reactionrules::EntityInteraction::mNoInteractionWithSameParticipantFor
protected
RingBuffer<PreviousInteraction,size_t,4> qsf::ai::reactionrules::EntityInteraction::mPreviousInteractions
protected

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