Class EcsNode
Base class for all ECS nodes.
public abstract class EcsNode : IDisposable
- Inheritance
-
EcsNode
- Implements
- Derived
- Inherited Members
Constructors
EcsNode()
public EcsNode()
Properties
Attributes
The attributes associated with this node.
public IReadOnlyDictionary<string, object> Attributes { get; }
Property Value
Context
The context of this entity.
public EcsContext Context { get; }
Property Value
Id
Entity ID of this node.
public Guid Id { get; }
Property Value
IsDisposed
Is this instance disposed?
protected bool IsDisposed { get; }
Property Value
IsGameThread
True if this is the game thread.
public bool IsGameThread { get; }
Property Value
this[Guid]
Get child by GUID.
public EcsNode this[Guid id] { get; }
Parameters
id
Guid
Property Value
Exceptions
- KeyNotFoundException
Entity does not exist.
this[Guid, bool]
public EcsNode this[Guid id, bool rawget] { get; }
Parameters
Property Value
Kind
public abstract EcsNodeKind Kind { get; }
Property Value
Name
Name of this node.
public string Name { get; set; }
Property Value
Parent
The parent of this entity.
public EcsNode? Parent { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Internal function to handle dispose behavior.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolTrue if disposing.
DisposeGuarded(bool)
protected void DisposeGuarded(bool disposing)
Parameters
disposing
bool
~EcsNode()
protected ~EcsNode()
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
HasAttribute(string)
public bool HasAttribute(string name)
Parameters
name
string
Returns
HasAttribute<T>()
public bool HasAttribute<T>()
Returns
Type Parameters
T
NotifyBroadcast<T>(EcsNode?, T)
Notify this entity and its childrenList.
public void NotifyBroadcast<T>(EcsNode? sender, T details)
Parameters
sender
EcsNodedetails
TThe notification message.
Type Parameters
T
The notification type.
Notify<T>(EcsNode?, T)
Notify this entity.
public void Notify<T>(EcsNode? sender, T details)
Parameters
sender
EcsNodedetails
TThe notification message.
Type Parameters
T
The notification type.
OnNotify<T>(EcsNode?, T)
protected virtual void OnNotify<T>(EcsNode? sender, T details)
Parameters
sender
EcsNodedetails
T
Type Parameters
T
RecallAttribute(string)
Recall an attribute from this node.
public object RecallAttribute(string name)
Parameters
name
stringAttribute name.
Returns
- object
Attribute object instance.
RecallAttribute<T>()
public T RecallAttribute<T>()
Returns
- T
Type Parameters
T
RecallAttribute<T>(string)
Recall an attribute from this node.
public T RecallAttribute<T>(string name)
Parameters
name
stringAttribute name.
Returns
- T
Attribute object instance.
Type Parameters
T
Attribute object type.
StoreAttribute(string, object?)
Store an attribute in this node.
public void StoreAttribute(string name, object? data)
Parameters
StoreAttribute<T>(string, T?)
Store an attribute in this node.
public void StoreAttribute<T>(string name, T? data)
Parameters
name
stringAttribute name.
data
TAttribute object instance.
Type Parameters
T
Attribute object type.
StoreAttribute<T>(T?)
Store an attribute with a predefined GUID.
public void StoreAttribute<T>(T? data)
Parameters
data
TThe attribtue data.
Type Parameters
T
The attribute type.
SubscribeNotification<T>(NotifyHandler<T>)
Subscribe to a notification.
public void SubscribeNotification<T>(NotifyHandler<T> handler)
Parameters
handler
NotifyHandler<T>The handler that will subscribe.
Type Parameters
T
The notification type.
TryGet(Guid, out EcsNode?, bool)
public bool TryGet(Guid id, out EcsNode? node, bool rawget = false)
Parameters
Returns
TryGet<T>(Guid, out T?, bool)
public bool TryGet<T>(Guid id, out T? node, bool rawget = false) where T : EcsNode
Parameters
Returns
Type Parameters
T
TryRecallAttribute(out object?, string)
Try recalling an attribute from this node.
public bool TryRecallAttribute(out object? attribute, string name)
Parameters
Returns
- bool
True if the attribute is found.
TryRecallAttribute<T>(out T?)
public bool TryRecallAttribute<T>(out T? attribute)
Parameters
attribute
T
Returns
Type Parameters
T
TryRecallAttribute<T>(out T?, string)
Try recalling an attribute from this node.
public bool TryRecallAttribute<T>(out T? attribute, string name)
Parameters
attribute
TAttribute object instance.
name
stringAttribute name.
Returns
- bool
True if the attribute is found.
Type Parameters
T
Attribute object type.
UnsubscribeNotification<T>(NotifyHandler<T>)
Unsubscribe from a notification.
public void UnsubscribeNotification<T>(NotifyHandler<T> handler)
Parameters
handler
NotifyHandler<T>The handler that will unsubscribe.
Type Parameters
T
The notification type.
Events
Notified
public event NotifyHandler? Notified