Entity
class · namespace Hazel
Implements IEquatable<Entity>
public class Entity : IEquatable<Entity>
Constructors
Entity()
Fields
| Field |
Description |
public readonly ulong ID |
|
public static readonly Entity Invalid |
|
Properties
Children
public Entity[] Children { get; }
Parent
public Entity? Parent { get; set; }
Rotation
public Vector3 Rotation { get; set; }
RotationQuat
public Quaternion RotationQuat { get; set; }
Scale
public Vector3 Scale { get; set; }
Tag
public string Tag { get; }
public TransformComponent Transform { get; }
Translation
public Vector3 Translation { get; set; }
Methods
As()
public T? As<T>() where T : Entity
Returns the script instance as type T if this entity is of the given type, otherwise null
Type parameters
CreateComponent()
public T? CreateComponent<T>() where T : Component, new()
Destroy()
Destroy(Entity)
public void Destroy(Entity other)
DestroyAllChildren()
public void DestroyAllChildren()
Equals(Entity?)
public bool Equals(Entity? other)
Equals(object?)
public override bool Equals(object? obj)
FindChildEntityByTag(string)
public Entity? FindChildEntityByTag(string tag)
FindEntityByID(ulong)
public Entity? FindEntityByID(ulong entityID)
FindEntityByTag(string)
public Entity? FindEntityByTag(string tag)
GetComponent()
public T? GetComponent<T>() where T : Component, new()
GetHashCode()
public override int GetHashCode()
HasComponent(Type)
public bool HasComponent(Type type)
HasComponent()
public bool HasComponent<T>() where T : Component
Instantiate(Prefab)
public Entity? Instantiate(Prefab prefab)
Instantiate(Prefab, Transform)
public Entity? Instantiate(Prefab prefab, Transform transform)
Instantiate(Prefab, Vector3)
public Entity? Instantiate(Prefab prefab, Vector3 translation)
Instantiate(Prefab, Vector3, Vector3)
public Entity? Instantiate(Prefab prefab, Vector3 translation, Vector3 rotation)
Instantiate(Prefab, Vector3, Vector3, Vector3)
public Entity? Instantiate(Prefab prefab, Vector3 translation, Vector3 rotation, Vector3 scale)
InstantiateChild(Prefab)
public Entity? InstantiateChild(Prefab prefab)
InstantiateChild(Prefab, Transform)
public Entity? InstantiateChild(Prefab prefab, Transform transform)
InstantiateChild(Prefab, Vector3)
public Entity? InstantiateChild(Prefab prefab, Vector3 translation)
InstantiateChild(Prefab, Vector3, Vector3)
public Entity? InstantiateChild(Prefab prefab, Vector3 translation, Vector3 rotation)
InstantiateChild(Prefab, Vector3, Vector3, Vector3)
public Entity? InstantiateChild(Prefab prefab, Vector3 translation, Vector3 rotation, Vector3 scale)
Is()
public bool Is<T>() where T : Entity
Checks if this entity is a script entity of type T
Type parameters
Returns — True if this entity is a script entity of type T
OnCreate()
protected virtual void OnCreate()
OnDestroy()
protected virtual void OnDestroy()
OnFreePostUpdate(float)
protected virtual void OnFreePostUpdate(float ts)
OnFreePreUpdate(float)
protected virtual void OnFreePreUpdate(float ts)
OnLateUpdate(float)
protected virtual void OnLateUpdate(float ts)
OnPhysicsUpdate(float)
protected virtual void OnPhysicsUpdate(float ts)
OnPostUpdate(float)
protected virtual void OnPostUpdate(float ts)
OnPreUpdate(float)
protected virtual void OnPreUpdate(float ts)
OnUpdate(float)
protected virtual void OnUpdate(float ts)
RemoveComponent()
public bool RemoveComponent<T>() where T : Component
Operators
implicit operator bool
static
public static implicit operator bool(Entity entity)
operator !=(Entity?, Entity?)
static
public static bool operator !=(Entity? entityA, Entity? entityB)
operator ==(Entity?, Entity?)
static
public static bool operator ==(Entity? entityA, Entity? entityB)
Events
AnimationEvent
protected event Action<Identifier>? AnimationEvent
Collision2DBeginEvent
public event Action<Entity>? Collision2DBeginEvent
Collision2DEndEvent
public event Action<Entity>? Collision2DEndEvent
CollisionBeginEvent
public event Action<Entity>? CollisionBeginEvent
CollisionEndEvent
public event Action<Entity>? CollisionEndEvent
DestroyedEvent
public event Action<Entity>? DestroyedEvent
JointBreakEvent
public event Action<Vector3, Vector3>? JointBreakEvent
TriggerBeginEvent
public event Action<Entity>? TriggerBeginEvent
TriggerEndEvent
public event Action<Entity>? TriggerEndEvent
Source: Hazel/Scene/Entity.cs