PrefabAsset

Namespace: Murder.Assets
Assembly: Murder.dll

public class PrefabAsset : GameAsset, IEntity

Implements: GameAsset, IEntity

⭐ Constructors

public PrefabAsset()
public PrefabAsset(EntityInstance instance)

Parameters
instance EntityInstance

⭐ Properties

CanBeCreated

public virtual bool CanBeCreated { get; }

Returns
bool

CanBeDeleted

public virtual bool CanBeDeleted { get; }

Returns
bool

CanBeRenamed

public virtual bool CanBeRenamed { get; }

Returns
bool

CanBeSaved

public virtual bool CanBeSaved { get; }

Returns
bool

Children

public virtual ImmutableArray<T> Children { get; }

Returns
ImmutableArray<T>

Components

public virtual ImmutableArray<T> Components { get; }

Returns
ImmutableArray<T>

Dimensions

public readonly TileDimensions Dimensions;

Dimensions of the prefab. Used when drawing it on the map or the editor.

Returns
TileDimensions

EditorColor

public virtual Vector4 EditorColor { get; }

Returns
Vector4

EditorFolder

public virtual string EditorFolder { get; }

Returns
string

FileChanged

public bool FileChanged { get; public set; }

Returns
bool

FilePath

public string FilePath { get; public set; }

Returns
string

Guid

public Guid Guid { get; protected set; }

Returns
Guid

Icon

public virtual char Icon { get; }

Returns
char

IsStoredInSaveData

public virtual bool IsStoredInSaveData { get; }

Returns
bool

Name

public string Name { get; public set; }

Returns
string

PrefabRefName

public virtual string PrefabRefName { get; }

Returns
string

Rename

public bool Rename { get; public set; }

Returns
bool

SaveLocation

public virtual string SaveLocation { get; }

Returns
string

ShowOnPrefabSelector

public bool ShowOnPrefabSelector;

Whether this should show in the editor selector.

Returns
bool

StoreInDatabase

public virtual bool StoreInDatabase { get; }

Returns
bool

TaggedForDeletion

public bool TaggedForDeletion;

Returns
bool

⭐ Methods

OnModified()

protected virtual void OnModified()

HasComponent(IComponent)

public bool HasComponent(IComponent c)

Parameters
c IComponent

Returns
bool

CreateAndFetch(World)

public Entity CreateAndFetch(World world)

Parameters
world World

Returns
Entity

ToInstance(string)

public EntityInstance ToInstance(string name)

Creates a new instance entity from the current asset.

Parameters
name string

Returns
EntityInstance

Duplicate(string)

public GameAsset Duplicate(string name)

Parameters
name string

Returns
GameAsset

AssetsToBeSaved()

public List<T> AssetsToBeSaved()

Returns
List<T>

ToInstanceAsAsset(string)

public PrefabAsset ToInstanceAsAsset(string name)

Parameters
name string

Returns
PrefabAsset

GetSimplifiedName()

public string GetSimplifiedName()

Returns
string

GetSplitNameWithEditorPath()

public String[] GetSplitNameWithEditorPath()

Returns
string[]

AddOrReplaceComponentForChild(Guid, IComponent)

public virtual bool AddOrReplaceComponentForChild(Guid childGuid, IComponent component)

Parameters
childGuid Guid
component IComponent

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)

Parameters
type Type

Returns
bool

HasComponentAtChild(Guid, Type)

public virtual bool HasComponentAtChild(Guid childGuid, Type type)

Parameters
childGuid Guid
type Type

Returns
bool

RemoveChild(Guid)

public virtual bool RemoveChild(Guid instanceGuid)

Add an entity asset as a children of the current asset. Each of the children will be an instance of the current asset.

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

GetComponent(Type)

public virtual IComponent GetComponent(Type type)

Parameters
type 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
ImmutableArray<T>

GetChildComponents(Guid)

public virtual ImmutableArray<T> GetChildComponents(Guid childGuid)

Parameters
childGuid Guid

Returns
ImmutableArray<T>

Create(World)

public virtual int Create(World world)

Create an instance of the entity and all of its children.

Parameters
world World

Returns
int

AddChild(EntityInstance)

public virtual void AddChild(EntityInstance asset)

Add an entity asset as a children of the current asset. Each of the children will be an instance of the current asset.

Parameters
asset EntityInstance

AddOrReplaceComponent(IComponent)

public virtual void AddOrReplaceComponent(IComponent c)

Parameters
c IComponent

AfterDeserialized()

public virtual void AfterDeserialized()

RemoveComponentForChild(Guid, Type)

public virtual void RemoveComponentForChild(Guid childGuid, Type t)

Parameters
childGuid Guid
t Type

MakeGuid()

public void MakeGuid()

Replace(World, Entity, IComponent[])

public void Replace(World world, Entity e, IComponent[] startWithComponents)

This will replace an existing entity in the world. It keeps some elements of the original entity: position and target id components.

Parameters
world World

e Entity

startWithComponents IComponent[]

Replace(World, Entity)

public void Replace(World world, Entity e)

This will replace an existing entity in the world. It keeps some elements of the original entity: position and target id components.

Parameters
world World
e Entity

TrackAssetOnSave(Guid)

public void TrackAssetOnSave(Guid g)

Parameters
g Guid