public

Inheritance Graph

graph BT
	Behavior
	Behavior --> ReferenceCounter
	Behavior --> AttributeProvider
	AbstractBehaviour --> Behavior
	SimplePhysics2 --> Behavior
	click Behavior "classMinSG_1_1Behavior"
	click ReferenceCounter "classUtil_1_1ReferenceCounter"
	click AttributeProvider "classUtil_1_1AttributeProvider"
	click AbstractBehaviour "classMinSG_1_1AbstractBehaviour"
	click SimplePhysics2 "classMinSG_1_1SimplePhysics2"

Description

Behavior base class.

To start a behavior for an object (without BehaviorManager):

Util::Reference<Behavior> b = new SpecificBehavior; // Create Behavior object (can be used for several objects)
auto status = b->createBehaviorStatus();            // Prepare BehaviorStatus for animated object 
Util::requireObjectExtension<BehaviorMyObjectReference>(status)->setMyObject(myObject); // start behavior for the object

while(!status.isFinished()){ // execute until finished
        status->getBehavior()->execute( *status.get(), getCurrentTime() );
        // ...
}

Note: Use a BehaviorManager for managing behavior statuses.

Public Types

   
   
enum behaviourResult_t {CONTINUE, FINISHED}
   
typedef double timestamp_t

Public Functions

   
   
  Behavior()
(ctor)
   
  ~Behavior()
(dtor)
   
Util::Reference < BehaviorStatus > createBehaviorStatus()
   
behaviourResult_t execute( BehaviorStatus & state, timestamp_t currentTimeSec)
   
void finalize( BehaviorStatus & state)

Documentation

enum
MinSG::Behavior::behaviourResult_t

public
 
 
enum behaviourResult_t
Enumerator   Description
Enumerator   Description
CONTINUE    
FINISHED    

Defined in MinSG/Core/Behaviours/Behavior.h:47


typedef
MinSG::Behavior::timestamp_t

public
 
 
typedef double timestamp_t

Defined in MinSG/Core/Behaviours/Behavior.h:46


function
MinSG::Behavior::Behavior

public
   
   
Behavior( )

(ctor)

Defined in MinSG/Core/Behaviours/Behavior.h:50


function
MinSG::Behavior::~Behavior

public inline virtual
   
   
~Behavior( )

(dtor)

Defined in MinSG/Core/Behaviours/Behavior.h:53


function
MinSG::Behavior::createBehaviorStatus

public
   
   
Util::Reference < BehaviorStatus > createBehaviorStatus( )

Defined in MinSG/Core/Behaviours/Behavior.h:55


function
MinSG::Behavior::execute

public
     
     
behaviourResult_t execute( BehaviorStatus & state,
  timestamp_t currentTimeSec
)    

Defined in MinSG/Core/Behaviours/Behavior.h:56


function
MinSG::Behavior::finalize

public
     
     
void finalize( BehaviorStatus & state )

Finalize the given BehaviorState.

Note: An already finalized state is silently ignored.

Defined in MinSG/Core/Behaviours/Behavior.h:60