Engine
(NOTE) Game Object Composition class. This class is the foundational object for all dynamic objects in the game world. The Cog is a piece of logical interactive content and the primary mechanism game systems (Graphics, Physics, Etc.) provide functionality and communicate. A Cog can be anything from physical objects like trees, tanks, players to logical objects like teams, triggers, or AI objects.
Properties
Actions : actions
read-only
var Actions : Actions
Archetype : archetype
Getter / setter for Archetype.
var Archetype : Archetype
BaseArchetype : archetype
read-only
Returns the Archetype our Archetype inherits from.
var BaseArchetype : Archetype
ChildCount : integer
read-only
Returns the amount of children on this Cog. Note that this function has to iterate over all children to calculate the count.
var ChildCount : Integer
Children : hierarchylistrange
read-only
Returns a range of all direct children on this Cog.
var Children : HierarchyListRange
ComponentCount : integer
read-only
Returns how many Components are on this Cog.
var ComponentCount : Integer
EditorViewportHidden : boolean
Hidden from view used for editor.
var EditorViewportHidden : Boolean
GameSession : gamesession
read-only
Get the GameSession that owns us and our Space.
var GameSession : GameSession
LevelSettings : cog
read-only
Get the object named 'LevelSettings', a special convenience object where we can put general functionality for our Level.
var LevelSettings : Cog
Locked : boolean
Not able to be modified or selected in the viewport.
var Locked : Boolean
MarkedForDestruction : boolean
read-only
Has this Cog already been destroyed and is waiting for the frame to end (delayed destruction). This allows us to do custom logic when an object is still not null, but about to be destroyed (e.g. we don't want to render Cogs marked for deletion).
var MarkedForDestruction : Boolean
Name : string
Name of the Object.
var Name : String
ObjectViewHidden : boolean
If the object needs to not show up in the object view.
var ObjectViewHidden : Boolean
Parent : cog
read-only
Get the parent of this object in the Hierarchy.
var Parent : Cog
Persistent : boolean
Object will not be destroyed on level load or change.
var Persistent : Boolean
RuntimeId : integer
read-only
Gets a unique integer for this object (used primarily for debugging)
var RuntimeId : Integer
Space : space
read-only
Returns the Space that this object lives in.
var Space : Space
Transient : boolean
Object will not be saved.
var Transient : Boolean
Methods
AddComponentByName : boolean
Add a component by name. |Name|Type|Description| |---|---|---| |name|string| |
function AddComponentByName(name : String) : Boolean
AddComponentByType : boolean
Add a component of the given type. |Name|Type|Description| |---|---|---| |componentType|boundtype| |
function AddComponentByType(componentType : BoundType) : Boolean
AttachTo : boolean
Attach to a parent object and compute the new transform so that the objects are relative. |Name|Type|Description| |---|---|---| |parent|cog| |
function AttachTo(parent : Cog) : Boolean
AttachToPreserveLocal : boolean
Attach to a parent object. |Name|Type|Description| |---|---|---| |parent|cog| |
function AttachToPreserveLocal(parent : Cog) : Boolean
ClearArchetype : Void
Removes our association with the current Archetype. |Name|Type|Description| |---|---|---|
function ClearArchetype()
Clone : cog
Clones this cog. The cloned object will be parented to this objects parent (if it exists). |Name|Type|Description| |---|---|---|
function Clone() : Cog
Cog : Void
constructor
Constructor / destructor. |Name|Type|Description| |---|---|---|
function Cog()
DebugDraw : Void
Calls DebugDraw on all components in this cog. |Name|Type|Description| |---|---|---|
function DebugDraw()
Destroy : Void
Queues the cog up for delayed destruction (at the end of the frame). If the object is marked as Protected, this will do nothing. |Name|Type|Description| |---|---|---|
function Destroy()
Detach : Void
Detach from a parent object and compute the new transform so that the objects are relative. |Name|Type|Description| |---|---|---|
function Detach()
DetachPreserveLocal : Void
Detach from a parent object. |Name|Type|Description| |---|---|---|
function DetachPreserveLocal()
DispatchDown : Void
Dispatches an event down the tree on all children recursively (pre-order traversal) |Name|Type|Description| |---|---|---| |eventId|string| | |event|event| |
function DispatchDown(eventId : String, event : Event)
DispatchEvent : Void
Dispatches an event on this object. |Name|Type|Description| |---|---|---| |eventId|string| | |event|event| |
function DispatchEvent(eventId : String, event : Event)
DispatchUp : Void
Dispatches an event up the tree on each parent recursively (pre-order traversal) |Name|Type|Description| |---|---|---| |eventId|string| | |event|event| |
function DispatchUp(eventId : String, event : Event)
FindAllChildrenByName : hierarchynamerange
Returns a range of all children with the given name. |Name|Type|Description| |---|---|---| |name|string| |
function FindAllChildrenByName(name : String) : HierarchyNameRange
FindChildByName : cog
Depth first search of all children. |Name|Type|Description| |---|---|---| |name|string| |
function FindChildByName(name : String) : Cog
FindDirectChildByName : cog
Checks only direct children. |Name|Type|Description| |---|---|---| |name|string| |
function FindDirectChildByName(name : String) : Cog
FindNearestArchetype : cog
Same as FindNearestParentArchetype except that it includes this Cog. |Name|Type|Description| |---|---|---|
function FindNearestArchetype() : Cog
FindNextInOrder : cog
Finds the next Cog in depth first post-order. |Name|Type|Description| |---|---|---|
function FindNextInOrder() : Cog
FindNextSibling : cog
Returns the sibling Cog after this in the parents child list. Returns null if it's the last child. If the Cog doesn't have a parent, it will return the Cog after it in the Space. |Name|Type|Description| |---|---|---|
function FindNextSibling() : Cog
FindPreviousInOrder : cog
Finds the previous Cog in reverse depth first post-order (the opposite of FindNextInOrder). |Name|Type|Description| |---|---|---|
function FindPreviousInOrder() : Cog
FindPreviousSibling : cog
Returns the sibling Cog before this in the parents child list. Returns null if it's the first child. If the Cog doesn't have a parent, it will return the Cog before it in the Space. |Name|Type|Description| |---|---|---|
function FindPreviousSibling() : Cog
FindRoot : cog
Searches up the hierarchy for the root Cog. |Name|Type|Description| |---|---|---|
function FindRoot() : Cog
FindRootArchetype : cog
Finds the top most Archetype in the Hierarchy. |Name|Type|Description| |---|---|---|
function FindRootArchetype() : Cog
GetComponentByIndex : component
Returns the Component at the given index. |Name|Type|Description| |---|---|---| |index|integer| |
function GetComponentByIndex(index : Integer) : Component
GetComponentByName : component
Finds the Components with the given type name. |Name|Type|Description| |---|---|---| |componentTypeName|string| |
function GetComponentByName(componentTypeName : String) : Component
GetComponentIndex : integer
Finds the index of the given Component type. Returns uint max if the Component didn't exist. |Name|Type|Description| |---|---|---| |componentType|boundtype| |
function GetComponentIndex(componentType : BoundType) : Integer
IsAncestorOf : boolean
Returns whether or not we are an ancestor of the given Cog. |Name|Type|Description| |---|---|---| |descendant|cog| |
function IsAncestorOf(descendant : Cog) : Boolean
IsDescendant : boolean
Returns whether or not the given cog is a descendant of us. |Name|Type|Description| |---|---|---| |cog|cog| |
function IsDescendant(cog : Cog) : Boolean
IsDescendantOf : boolean
Returns whether or not we are a descendant of the given Cog. |Name|Type|Description| |---|---|---| |ancestor|cog| |
function IsDescendantOf(ancestor : Cog) : Boolean
IsModifiedFromArchetype : boolean
Returns whether or not we have any local modifications from our Archetype. This does not account for properties with LocalModificationOverride (such as Transform modifications). |Name|Type|Description| |---|---|---|
function IsModifiedFromArchetype() : Boolean
PlaceAfterSibling : Void
Moves this Cog after the given sibling. Assumes they have the same parent. |Name|Type|Description| |---|---|---| |sibling|cog| |
function PlaceAfterSibling(sibling : Cog)
PlaceBeforeSibling : Void
Moves this Cog before the given sibling. Assumes they have the same parent. |Name|Type|Description| |---|---|---| |sibling|cog| |
function PlaceBeforeSibling(sibling : Cog)
RemoveComponentByName : boolean
Remove a component by name. Returns true if the component existed. |Name|Type|Description| |---|---|---| |typeName|string| |
function RemoveComponentByName(typeName : String) : Boolean
RemoveComponentByType : boolean
Remove a component by type. Returns true if the component existed. |Name|Type|Description| |---|---|---| |componentType|boundtype| |
function RemoveComponentByType(componentType : BoundType) : Boolean
ReplaceChild : Void
Places the new child at the same place as the old child in the Hierarchy. This detaches but does not destroy the old child. |Name|Type|Description| |---|---|---| |oldChild|cog| | |newChild|cog| |
function ReplaceChild(oldChild : Cog, newChild : Cog)
SanitizeName : string
static
Cleans an object name of invalid runes. |Name|Type|Description| |---|---|---| |newName|string| |
function SanitizeName(newName : String) : String
UploadToArchetype : Void
Upload this objects data to the archetype and marks this object as not modified. This function does not rebuild all other Cogs with the same Archetype. See ArchetypeRebuilder for more information about how to rebuild Archetypes. |Name|Type|Description| |---|---|---|
function UploadToArchetype()