Nebula
Loading...
Searching...
No Matches
Nebula.Game.Property Class Reference

Public Member Functions

virtual Nebula.Game.FrameEvent[] AcceptedEvents ()
 Override in subclass to tell the property manager which methods to call for this class.
virtual uint FixedTimeSource ()
 The time source this property's fixed events run on.
virtual void OnMessage (in Msg msg)
 Called when a message is sent to the property's associated entity.
override string ToString ()
 String representation of this property.
virtual void OnActivate ()
 Called when the property is attached to an entity, or when Property.Active is changed to true.
virtual void OnDeactivate ()
 Called when the property is detached from an entity, or when Property.Active is changed to false.
virtual void OnBeginFrame ()
 Called once every frame at the beginning of the frame.
virtual void OnFixedFrame ()
 Called once for every fixed step the time source has available this frame.
virtual void OnFrame ()
 Called once every frame.
virtual void OnEndFrame ()
 Called once every frame at the end of the frame.
void Destroy ()
 Destroys the property.

Protected Member Functions

virtual void RegisterMessages ()
void RegisterMessage< T > ()

Package Functions

bool IsSimulating ()
 Whether the property's world is simulating.
void Activate ()
 Runs OnActivate and records that it has run.
void Deactivate ()
 Runs OnDeactivate for a property that was activated.
FrameEvent[] GetAcceptedEvents ()
void AttachMessages ()
void DetachMessages ()

Properties

bool Active [get, set]
 Activate or deactivate property This is not trivial and can potentially be costly.
bool RequestedActive [get]
 What the property was asked to be, which is what a world that starts simulating activates its properties from.
Entity Entity [get, set]
 The entity that owns this property.

Private Attributes

bool requestedActive
bool active
Entity entity
FrameEvent[] acceptedEvents
bool acceptedEventsCached

Member Function Documentation

◆ AcceptedEvents()

virtual Nebula.Game.FrameEvent[] Nebula.Game.Property.AcceptedEvents ( )
inlinevirtual

Override in subclass to tell the property manager which methods to call for this class.

◆ Activate()

void Nebula.Game.Property.Activate ( )
inlinepackage

Runs OnActivate and records that it has run.

Called by the setter when the world is simulating, and by the world when its mode changes to simulating

◆ AttachMessages()

void Nebula.Game.Property.AttachMessages ( )
inlinepackage

◆ Deactivate()

void Nebula.Game.Property.Deactivate ( )
inlinepackage

Runs OnDeactivate for a property that was activated.

A property that was never activated has nothing to deactivate

◆ Destroy()

void Nebula.Game.Property.Destroy ( )
inline

Destroys the property.

You should not call this manually, it is called automatically by destroying an entity, or removing the property

◆ DetachMessages()

void Nebula.Game.Property.DetachMessages ( )
inlinepackage

◆ FixedTimeSource()

virtual uint Nebula.Game.Property.FixedTimeSource ( )
inlinevirtual

The time source this property's fixed events run on.

Override in subclass to run on a fixed source of its own, such as the physics one. The default is the game logic source.

◆ GetAcceptedEvents()

FrameEvent[] Nebula.Game.Property.GetAcceptedEvents ( )
inlinepackage

◆ IsSimulating()

bool Nebula.Game.Property.IsSimulating ( )
inlinepackage

Whether the property's world is simulating.

◆ OnActivate()

virtual void Nebula.Game.Property.OnActivate ( )
inlinevirtual

Called when the property is attached to an entity, or when Property.Active is changed to true.

Override in subclass. This only happens in a world that is simulating. A property in a world the editor is only authoring is not running, so its activation waits for the world to start simulating.

◆ OnBeginFrame()

virtual void Nebula.Game.Property.OnBeginFrame ( )
inlinevirtual

Called once every frame at the beginning of the frame.

Override in subclass. The property AcceptedEvents must return the Event code for this method to be called at all, and the property has to be active, which only happens in a world that is simulating.

See also
AcceptedEvents()

◆ OnDeactivate()

virtual void Nebula.Game.Property.OnDeactivate ( )
inlinevirtual

Called when the property is detached from an entity, or when Property.Active is changed to false.

Override in subclass. Only called for a property that was activated, and when its world stops simulating.

◆ OnEndFrame()

virtual void Nebula.Game.Property.OnEndFrame ( )
inlinevirtual

Called once every frame at the end of the frame.

Override in subclass. The property AcceptedEvents must return the Event code for this method to be called at all, and the property has to be active, which only happens in a world that is simulating.

See also
AcceptedEvents()

◆ OnFixedFrame()

virtual void Nebula.Game.Property.OnFixedFrame ( )
inlinevirtual

Called once for every fixed step the time source has available this frame.

Override in subclass. The property AcceptedEvents must return the Event code for this method to be called at all, and the property has to be active, which only happens in a world that is simulating. A source with no fixed step gives one call per frame.

See also
AcceptedEvents(), FixedTimeSource()

◆ OnFrame()

virtual void Nebula.Game.Property.OnFrame ( )
inlinevirtual

Called once every frame.

Override in subclass. The property AcceptedEvents must return the Event code for this method to be called at all, and the property has to be active, which only happens in a world that is simulating.

See also
AcceptedEvents()

◆ OnMessage()

virtual void Nebula.Game.Property.OnMessage ( in Msg msg)
inlinevirtual

Called when a message is sent to the property's associated entity.

Only called for a property in a world that is simulating, which is the same rule the update methods have

◆ RegisterMessage< T >()

void Nebula.Game.Property.RegisterMessage< T > ( )
inlineprotected
Type Constraints
T :Msg 

◆ RegisterMessages()

virtual void Nebula.Game.Property.RegisterMessages ( )
inlineprotectedvirtual

◆ ToString()

override string Nebula.Game.Property.ToString ( )
inline

String representation of this property.

Member Data Documentation

◆ acceptedEvents

FrameEvent [] Nebula.Game.Property.acceptedEvents
private

◆ acceptedEventsCached

bool Nebula.Game.Property.acceptedEventsCached
private

◆ active

bool Nebula.Game.Property.active
private

◆ entity

Entity Nebula.Game.Property.entity
private

◆ requestedActive

bool Nebula.Game.Property.requestedActive
private

Property Documentation

◆ Active

bool Nebula.Game.Property.Active
getset

Activate or deactivate property This is not trivial and can potentially be costly.

The value is whether the property is really running, which is the result of OnActivate having been called. When the world is not simulating the setter only records the intent, and the activation happens when the world starts simulating.

◆ Entity

Entity Nebula.Game.Property.Entity
getset

The entity that owns this property.

You cannot change the entity after one has been associated with the property.

◆ RequestedActive

bool Nebula.Game.Property.RequestedActive
getpackage

What the property was asked to be, which is what a world that starts simulating activates its properties from.


The documentation for this class was generated from the following file:
  • /github/workspace/code/addons/nsharp/NebulaEngine/engine/Property.cs