Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
PUDynamicAttribute Class Referenceabstract

This class provides a uniform interface for retrieving the value of an attribute, while the calculation of this value may vary. More...

Inherits Ref.

Inherited by PUDynamicAttributeCurved, PUDynamicAttributeFixed, PUDynamicAttributeOscillate, and PUDynamicAttributeRandom.

Public Member Functions

 PUDynamicAttribute (void)
 Constructor.
 
virtual ~PUDynamicAttribute (void)
 Destructor.
 
virtual float getValue (float x=0)=0
 Virtual function that needs to be implemented by its childs. More...
 
var getValue ( var 0)
 Virtual function that needs to be implemented by its childs. More...
 
local getValue ( local 0)
 Virtual function that needs to be implemented by its childs. More...
 
DynamicAttributeType getType (void) const
 Get the type of dynamic attribute. More...
 
local getType ()
 Get the type of dynamic attribute. More...
 
void setType (DynamicAttributeType type)
 Set the type of dynamic attribute. More...
 
bool isValueChangedExternally (void) const
 Returns true if one of the attributes was changed by an external source. More...
 
virtual void copyAttributesTo (PUDynamicAttribute *dynamicAttribute)=0
 Copy attributes to another PUDynamicAttribute. More...
 
local copyAttributesTo ( local dynamicAttribute)
 Copy attributes to another PUDynamicAttribute. More...
 
virtual PUDynamicAttributeclone ()=0
 Clone this PUDynamicAttribute. More...
 
local clone ()
 Clone this PUDynamicAttribute. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

This class provides a uniform interface for retrieving the value of an attribute, while the calculation of this value may vary.

Each subclass provides its own implementation of the getValue() function and the calling application doesn't need to know about the underlying logic. A subclass could just return a value that has previously been set, but it can also return a value that is randomly generated by a pre-defined min/max interval. The DynamicAttribute class is used in situations where different behaviour of a certain attribute is needed, but where implementation of this behaviour may not be scattered or duplicated within the application that needs it.

Member Function Documentation

virtual float getValue ( float  x = 0)
pure virtual

Virtual function that needs to be implemented by its childs.

The Value.

Implemented in PUDynamicAttributeOscillate, PUDynamicAttributeCurved, PUDynamicAttributeRandom, and PUDynamicAttributeFixed.

var getValue ( var  x = 0)
pure virtual

Virtual function that needs to be implemented by its childs.

The Value.

Implemented in PUDynamicAttributeOscillate, PUDynamicAttributeCurved, PUDynamicAttributeRandom, and PUDynamicAttributeFixed.

local getValue ( local  x = 0)
pure virtual

Virtual function that needs to be implemented by its childs.

The Value.

Implemented in PUDynamicAttributeOscillate, PUDynamicAttributeCurved, PUDynamicAttributeRandom, and PUDynamicAttributeFixed.

DynamicAttributeType getType ( void  ) const

Get the type of dynamic attribute.

The Type.

var getType (   )

Get the type of dynamic attribute.

The Type.

local getType (   )

Get the type of dynamic attribute.

The Type.

void setType ( DynamicAttributeType  type)

Set the type of dynamic attribute.

The Type.

var setType ( var  type)

Set the type of dynamic attribute.

The Type.

local setType ( local  type)

Set the type of dynamic attribute.

The Type.

bool isValueChangedExternally ( void  ) const

Returns true if one of the attributes was changed by an external source.

Whether attributes changed.

var isValueChangedExternally (   )

Returns true if one of the attributes was changed by an external source.

Whether attributes changed.

local isValueChangedExternally (   )

Returns true if one of the attributes was changed by an external source.

Whether attributes changed.

virtual void copyAttributesTo ( PUDynamicAttribute dynamicAttribute)
pure virtual

Copy attributes to another PUDynamicAttribute.

Another dynamicAttribute.

Implemented in PUDynamicAttributeOscillate, PUDynamicAttributeCurved, PUDynamicAttributeRandom, and PUDynamicAttributeFixed.

var copyAttributesTo ( var  dynamicAttribute)
pure virtual

Copy attributes to another PUDynamicAttribute.

Another dynamicAttribute.

Implemented in PUDynamicAttributeOscillate, PUDynamicAttributeCurved, PUDynamicAttributeRandom, and PUDynamicAttributeFixed.

local copyAttributesTo ( local  dynamicAttribute)
pure virtual

Copy attributes to another PUDynamicAttribute.

Another dynamicAttribute.

Implemented in PUDynamicAttributeOscillate, PUDynamicAttributeCurved, PUDynamicAttributeRandom, and PUDynamicAttributeFixed.


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