Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Scenery.ECBehaviorRandomizeCreation Class Reference

Behavior adding support to randomize creation. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorRandomizeCreation:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.BehaviorPreventCreation Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Factory
 Behavior factory. More...

Public Member Functions

ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance.
ECPFloat getProbability ()
 Probability property.
ECBehaviorRandomizeCreation new (BehaviorElementClass eclass)
 Create behavior.
bool preventCreation (StubElement stub, GameWorld gameWorld)
 Prevent creation of element.
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index.
void dispose ()
 Dispose of behavior.
String getBehaviorID ()
 Unique identifier of behavior.
String getID ()
 Identifier.
int getInstanceIndex ()
 Instance index.
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior.
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior.

Public Attributes

ECPFloat pProbability

Additional Inherited Members

Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
DefaultECBehavior new (BehaviorElementClass eclass, String id)
 Create default composeable behavior.
void setBehaviorID (String identifier)
 Set behavior identifier.
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>".
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>".

Detailed Description

Behavior adding support to randomize creation.

Version
1.23

This behavior is typically used to add variation to game worlds by randomly creating or not creating element. This affects only elements added to a game world. Loading a game world does not trigger randomization.

This behavior uses BehaviorPreventCreation to randomly prevent the element to be created and added to the game world. This check is done after BehaviorPrepareStub supporting behaviors have potentially modified the StubElement.

Default property prefix is "randomizeCreation."

See also
https://developer.dragondreams.ch/wiki/doku.php/dragengine:modules:dragonscript:behavior_randomizecreation

Member Function Documentation

◆ createInstance()

ECBehaviorInstance Dragengine.Scenery.ECBehaviorRandomizeCreation.createInstance ( BehaviorElement element)

Create Behavior instance.

Implements Dragengine.Scenery.ECBehavior.

References createInstance(), getProbability(), new(), pProbability, and preventCreation().

Referenced by createInstance().

◆ getProbability()

ECPFloat Dragengine.Scenery.ECBehaviorRandomizeCreation.getProbability ( )

Probability property.

Probability the element is created. Property name is "probability". Default value is 1. Minimum value is 0. Minimum value is 1.

References new(), and pProbability.

Referenced by createInstance().

◆ new()

ECBehaviorRandomizeCreation Dragengine.Scenery.ECBehaviorRandomizeCreation.new ( BehaviorElementClass eclass)

Create behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

References new(), and pProbability.

Referenced by createInstance(), getProbability(), and new().

◆ preventCreation()

bool Dragengine.Scenery.ECBehaviorRandomizeCreation.preventCreation ( StubElement stub,
GameWorld gameWorld )

Prevent creation of element.

Called by BehaviorElementClass.createAndAddElement(StubElement,GameWorld) after BehaviorPrepareStub interfaces have been processed. If true is returned the element is not created and added to the game world.

Implements Dragengine.Scenery.BehaviorPreventCreation.

Referenced by createInstance().

Member Data Documentation

◆ pProbability

ECPFloat Dragengine.Scenery.ECBehaviorRandomizeCreation.pProbability

Referenced by createInstance(), getProbability(), and new().


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