|
Neo
0.5.0
Developer Documentation
|
The Behavior class is an abstraction for creating behaviors. More...
#include <Behavior.h>
Public Member Functions | |
| Behavior (Object3d *parentObject) | |
| Creates a new behavior as the child of the given object. More... | |
| virtual | ~Behavior (void) |
| virtual void | destroy (void)=0 |
| Object3d * | getParentObject (void) |
| Returns the parent object. More... | |
| virtual const char * | getName (void)=0 |
| Returns the behavior name. More... | |
| virtual Behavior * | getCopy (Object3d *parentObject)=0 |
| Copies one instance of a behavior to a new one and sets the new parent. More... | |
| virtual void | update (void)=0 |
| This method is used to update the game logic which is implemented here. More... | |
| virtual void | draw (void) |
| Draws behavior specific images to the screen. More... | |
| virtual void | runEvent (int param) |
| virtual unsigned int | getVariablesNumber (void)=0 |
| Returns the number of variables this behavior contains. This number is hardcoded in most behaviors. More... | |
| virtual NeoVariable | getVariable (unsigned int id)=0 |
| Returns the variable with the given ID. More... | |
The Behavior class is an abstraction for creating behaviors.
Behaviors can be attached to objects in a Maratis scene. They contain several methods for interacting with the engine and the parent object allowing them to be used as one of the main interfaces for programming game logic.
| Neo::Behavior::Behavior | ( | Object3d * | parentObject | ) |
Creates a new behavior as the child of the given object.
| parentObject | The parent of the new object. |
|
virtual |
|
pure virtual |
|
inlinevirtual |
Draws behavior specific images to the screen.
Draw is called as often as possible to allow maximum rendering performance.
ATTENTION: No game logics should be located here since this code is very performance relevant!
Copies one instance of a behavior to a new one and sets the new parent.
| parentObject | The parent object of the new behavior instance. |
|
pure virtual |
Returns the behavior name.
All behaviors need a static string with the name in it to identify it. This method has to be overwritten by any child class!
|
inline |
Returns the parent object.
|
pure virtual |
Returns the variable with the given ID.
Most behaviors give hardcoded variables back.
Example:
| id | The ID of the variable. All values are smaller than the one returned by MBehavior::getVariablesNumber |
|
pure virtual |
Returns the number of variables this behavior contains. This number is hardcoded in most behaviors.
|
inlinevirtual |
|
pure virtual |
This method is used to update the game logic which is implemented here.
Update is called every 16,6ms (60FPS) and has to be overwritten by any child class.
ATTENTION: No rendering can be done in here! Use MBehavior::draw instead!