PrefabEntityInstance

Namespace: Murder.Prefabs
Assembly: Murder.dll

public class PrefabEntityInstance : EntityInstance, IEntity

Implements: EntityInstance, IEntity

⭐ Constructors

public PrefabEntityInstance()

⭐ Properties

_children

protected Dictionary<TKey, TValue> _children;

Returns
Dictionary<TKey, TValue>

_components

protected readonly Dictionary<TKey, TValue> _components;

Returns
Dictionary<TKey, TValue>

ActivateWithParent

public bool ActivateWithParent;

Returns
bool

Children

public virtual ImmutableArray<T> Children { get; }

Returns
ImmutableArray<T>

Components

public virtual ImmutableArray<T> Components { get; }

Returns all the components of the entity asset, followed by all the components of the instance.

Returns
ImmutableArray<T>

Guid

public virtual Guid Guid { get; }

Returns
Guid

Id

public T? Id;

Returns
T?

IsDeactivated

public bool IsDeactivated;

Returns
bool

IsEmpty

public virtual bool IsEmpty { get; }

Returns
bool

Name

public virtual string Name { get; }

Returns
string

PrefabRef

public readonly PrefabReference PrefabRef;

This is the guid of the PrefabAsset that this refers to.

Returns
PrefabReference

PrefabRefName

public virtual string PrefabRefName { get; }

Returns
string

⭐ Methods

CanRevertComponentForChild(Guid, Type)

public bool CanRevertComponentForChild(Guid guid, Type t)

Parameters
guid Guid
t Type

Returns
bool

FetchChildChildren(IEntity)

public ImmutableArray<T> FetchChildChildren(IEntity child)

Get all the children of a child. This will take into account any modifiers of the parent.

Parameters
child IEntity

Returns
ImmutableArray<T>

CreateChildrenlessInstance(Guid)

public PrefabEntityInstance CreateChildrenlessInstance(Guid assetGuid)

Parameters
assetGuid Guid

Returns
PrefabEntityInstance

AddOrReplaceComponentForChild(Guid, IComponent)

public virtual bool AddOrReplaceComponentForChild(Guid instance, IComponent component)

Parameters
instance Guid
component IComponent

Returns
bool

CanModifyChildAt(Guid)

public virtual bool CanModifyChildAt(Guid childId)

This checks whether a child can be modified. This means that it does not belong to any prefab reference.

Parameters
childId Guid

Returns
bool

CanRemoveChild(Guid)

public virtual bool CanRemoveChild(Guid instanceGuid)

Parameters
instanceGuid Guid

Returns
bool

CanRevertComponent(Type)

public virtual bool CanRevertComponent(Type t)

Parameters
t Type

Returns
bool

HasComponent(Type)

public virtual bool HasComponent(Type type)

Returns whether an instance of exists in the list of components.

Parameters
type Type

Returns
bool

HasComponentAtChild(Guid, Type)

public virtual bool HasComponentAtChild(Guid instance, Type type)

Parameters
instance Guid
type Type

Returns
bool

IsComponentInAsset(IComponent)

public virtual bool IsComponentInAsset(IComponent c)

Returns whether a component is present in the entity asset.

Parameters
c IComponent

Returns
bool

RemoveAllComponents()

public virtual bool RemoveAllComponents()

Returns
bool

RemoveChild(Guid)

public virtual bool RemoveChild(Guid instanceGuid)

Parameters
instanceGuid Guid

Returns
bool

RemoveComponent(Type)

public virtual bool RemoveComponent(Type t)

Parameters
t Type

Returns
bool

RevertComponent(Type)

public virtual bool RevertComponent(Type t)

Parameters
t Type

Returns
bool

RevertComponentForChild(Guid, Type)

public virtual bool RevertComponentForChild(Guid childGuid, Type t)

Parameters
childGuid Guid
t Type

Returns
bool

TryGetChild(Guid, out EntityInstance&)

public virtual bool TryGetChild(Guid guid, EntityInstance& instance)

Parameters
guid Guid
instance EntityInstance&

Returns
bool

GetChild(Guid)

public virtual EntityInstance GetChild(Guid instanceGuid)

Parameters
instanceGuid Guid

Returns
EntityInstance

GetComponent(Type)

public virtual IComponent GetComponent(Type componentType)

Parameters
componentType Type

Returns
IComponent

TryGetComponentForChild(Guid, Type)

public virtual IComponent TryGetComponentForChild(Guid guid, Type t)

Parameters
guid Guid
t Type

Returns
IComponent

FetchChildren()

public virtual ImmutableArray<T> FetchChildren()

Returns all the children of the entity asset, followed by all the children of the instance.

Returns
ImmutableArray<T>

GetChildComponents(Guid)

public virtual ImmutableArray<T> GetChildComponents(Guid guid)

Fetch the components for a given child. This will filter any modifiers made to the children components.

Parameters
guid Guid

Returns
ImmutableArray<T>

Create(World, IEntity)

public virtual int Create(World world, IEntity parent)

Parameters
world World
parent IEntity

Returns
int

Create(World)

public virtual int Create(World world)

Create the instance entity in the world.

Parameters
world World

Returns
int

AddChild(EntityInstance)

public virtual void AddChild(EntityInstance asset)

Parameters
asset EntityInstance

AddChildAtChild(Guid, EntityInstance)

public virtual void AddChildAtChild(Guid childId, EntityInstance instance)

Parameters
childId Guid
instance EntityInstance

AddOrReplaceComponent(IComponent)

public virtual void AddOrReplaceComponent(IComponent c)

Parameters
c IComponent

RemoveChildAtChild(Guid, Guid)

public virtual void RemoveChildAtChild(Guid childId, Guid instance)

Parameters
childId Guid
instance Guid

RemoveComponentForChild(Guid, Type)

public virtual void RemoveComponentForChild(Guid instance, Type t)

Parameters
instance Guid
t Type

SetName(string)

public virtual void SetName(string name)

Parameters
name string

UpdateGuid(Guid)

public void UpdateGuid(Guid newGuid)

Parameters
newGuid Guid