Tramway SDK
|
AudioComponent wrapper. More...
#include <entities/sound.h>
Public Member Functions | |
Sound (const SharedEntityData &, const ValueArray &) | |
Sound (name_t sound, float volume, vec3 position) | |
PLays a sound, then removes itself. More... | |
void | UpdateParameters () |
Called when Entity::UpdateTransform is called. More... | |
void | SetParameters () |
Called when either Entity::SetLocation or Entity::SetRotation is called. More... | |
void | Load () |
Loads an entity. More... | |
void | Unload () |
Unloads an entity. More... | |
void | Serialize () |
void | MessageHandler (Message &msg) |
Allows entities to receive messages. More... | |
name_t | GetType () |
Returns the type of the entity. More... | |
![]() | |
Entity () | |
Creates an unnamed entity with a random ID. More... | |
Entity (name_t name) | |
Creates a named entity with a random ID. More... | |
Entity (const SharedEntityData &) | |
Creates an entity from a SharedEntityData. More... | |
virtual | ~Entity () |
Destructs the entity. More... | |
name_t | GetName () const |
id_t | GetID () const |
WorldCell * | GetCell () |
Returns the entity's parent cell. More... | |
bool | IsLoaded () const |
Returns the entity load status. More... | |
bool | IsAutoLoad () const |
Returns the auto load flag status. More... | |
bool | IsPersistent () const |
Returns the persistence status of an entity. More... | |
bool | IsChanged () const |
bool | IsDeleted () const |
Returns the entity deletion status. More... | |
bool | IsLoadedFromDisk () const |
void | Yeet () |
Purges the entity. More... | |
void | SetAutoLoad (bool is) |
void | SetPersistent (bool is) |
void | SetLocation (vec3 loc) |
void | SetRotation (quat rot) |
void | UpdateTransform (const vec3 &loc, const quat &rot) |
const vec3 & | GetLocation () |
const quat & | GetRotation () |
virtual void | EventHandler (Event &event) |
Allows entities to receive events. More... | |
void | CheckTransition () |
Check whether an entity has entered a different cell. More... | |
SignalTable * | GetSignalTable () |
Static Public Member Functions | |
static void | Register () |
![]() | |
static void | Update () |
Updates entities. More... | |
static void | RegisterType (name_t name, entity_make, entity_clear, const Type *fields, size_t fieldcount) |
Registers a new entity type. More... | |
static void | RegisterType (name_t name, entity_make, entity_clear, const FieldInfo *fields, size_t fieldcount) |
Registers a new entity type. More... | |
static void | RegisterType (name_t name, entity_make, entity_clear, std::initializer_list< FieldInfo > fields) |
Registers a new entity type. More... | |
static Entity * | Make (name_t type, File *file) |
Loads an Entity from a File. More... | |
static Entity * | Make (name_t type, const SharedEntityData &, const ValueArray &) |
Creates an entity. More... | |
static Entity * | Find (id_t entity_id) |
Finds the entity by its ID number. More... | |
static Entity * | Find (name_t entity_name) |
Finds the entity by its name. More... | |
Protected Attributes | |
Component< AudioComponent > | audio |
name_t | sound |
float | volume |
int | sound_flags |
![]() | |
id_t | id = 0 |
name_t | name |
WorldCell * | cell = nullptr |
SignalTable * | signals = nullptr |
quat | rotation = {1.0f, 0.0f, 0.0f, 0.0f} |
vec3 | location = {0.0f, 0.0f, 0.0f} |
uint32_t | flags = 0 |
Additional Inherited Members | |
![]() | |
enum | : uint32_t { FIELD_SERIALIZE = 1 } |
![]() | |
enum | : uint32_t { NON_PERSISTENT = 1 , LOADED = 2 , DISABLE_AUTO_LOAD = 4 , NON_SERIALIZABLE = 8 , DIRTY = 16 , DELETED = 32 , LOADED_FROM_DISK = 64 } |
![]() | |
void | Register () |
Registers the entity. More... | |
void | Unregister () |
Unregisters the entity. More... | |
void | FireSignal (signal_t type) |
void | FireSignal (signal_t type, Value value) |
void | SetFlag (uint32_t flag, bool value) |
AudioComponent wrapper.
Can be used for placing environmental sounds, or for playing sounds for Signal triggers, but since you're looking this up in the C++ docs, you are probably are intereseted in the Sound entity as an self-yeeting AudioComponent.
Which it can be used as.
Very successfully, might I add.
tram::Sound::Sound | ( | const SharedEntityData & | , |
const ValueArray & | |||
) |
PLays a sound, then removes itself.
|
virtual |
Returns the type of the entity.
Usually this method returns the same name that is used to Entity::RegisterType() its type.
Implements tram::Entity.
|
virtual |
Loads an entity.
Usually the Load() method for an entity type will set up its components, event listeners, etc. After being loaded, the entity will be ready for simulation.
When implementing this method, make sure to flag the entity with the LOADED
flag, so that world streaming system doesn't try to load your entity twice.
Implements tram::Entity.
|
virtual |
Allows entities to receive messages.
Whenever an entity is sent a Message, once the Message::Dispatch() function has been called, the entity will gets the message passed to it through this method.
Implements tram::Entity.
|
static |
|
virtual |
Implements tram::Entity.
|
virtual |
Called when either Entity::SetLocation or Entity::SetRotation is called.
Usually this method is used to relocate or rerotate an entity.
If the entity has a PhysicsComponent, its position or rotation is usually set from this method, otherwise in the next Physics update step, the entity's previous rotation and location will be restored.
Implements tram::Entity.
|
virtual |
Unloads an entity.
Usually the Load() method for an entity type will destroy its its components, event listeners, etc. After being unloaded, the entity have been removed from the simulation.
When implementing this method, make sure to clear your entity's LOADED flag, so that world streaming system can load the entity again.
Implements tram::Entity.
|
virtual |
Called when Entity::UpdateTransform is called.
From the runtime's side, only the Physics system will call the Entity::UpdateTransform() method, and through it, this method.
Usually this method is used to forward the entity's new position and rotation to its RenderComponent, if it has one.
If the entity has a PhysicsComponent, its position or rotation is never updated from this method.
Implements tram::Entity.
|
protected |
|
protected |
|
protected |
|
protected |