GameAsset

Namespace: Murder.Assets
Assembly: Murder.dll

public abstract class GameAsset

The GameAsset is the core functionality on how Murder Engine serializes and persists data of the game. Its design is made so most of its data structures should be immutable while the game is running and any field modification is left to the editor project. You can override its fields and methods to specify where how it will be displayed in the editor, e.g.EditorFolder and EditorIcon.

⭐ Constructors

protected GameAsset()

⭐ Properties

CanBeCreated

public virtual bool CanBeCreated { get; }

Determines if the asset can be created, override to change this capability.

Returns
bool

CanBeDeleted

public virtual bool CanBeDeleted { get; }

Determines if the asset can be deleted, override to change this capability.

Returns
bool

CanBeRenamed

public virtual bool CanBeRenamed { get; }

Determines if the asset can be renamed, override to change this capability.

Returns
bool

CanBeSaved

public virtual bool CanBeSaved { get; }

Determines if the asset can be saved, override to change this capability.

Returns
bool

EditorColor

public virtual Vector4 EditorColor { get; }

Gets the default color used in the editor for the asset, override to use a custom color. From 0 to 1.

Returns
Vector4

EditorFolder

public virtual string EditorFolder { get; }

Gets the default folder path in the editor for the asset, override to specify a different folder.

Returns
string

FileChanged

public bool FileChanged { get; public set; }

Returns
bool

FilePath

public string FilePath { get; public set; }

Path to this asset file, relative to its base directory where this asset is stored.

Returns
string

Guid

public Guid Guid { get; protected set; }

Returns
Guid

Icon

public virtual char Icon { get; }

Gets the icon character for the asset, override to provide a custom icon. Use a free FontAwesome character for this to work.

Returns
char

IsStoredInSaveData

public virtual bool IsStoredInSaveData { get; }

Whether this file is saved relative do the save path.

Returns
bool

Name

public string Name { get; public set; }

Returns
string

Rename

public bool Rename { get; public set; }

Whether it should rename the file and delete the previous name.

Returns
bool

SaveLocation

public virtual string SaveLocation { get; }

Returns
string

SkipDirectoryIconCharacter

public static const char SkipDirectoryIconCharacter;

Returns
char

StoreInDatabase

public virtual bool StoreInDatabase { get; }

Whether this file should be stored following a database hierarchy of the files. True by default.

Returns
bool

TaggedForDeletion

public bool TaggedForDeletion;

Returns
bool

⭐ Methods

OnModified()

protected virtual void OnModified()

Implemented by assets that may cache data. This notifies it that it has been modified (usually by an editor).

Duplicate(string)

public GameAsset Duplicate(string name)

Create a duplicate of the current asset.

Parameters
name string

Returns
GameAsset

AssetsToBeSaved()

public List<T> AssetsToBeSaved()

Return the assets which will be saved with this (GameAsset._saveAssetsOnSave). Also clear the pending list.

Returns
List<T>

GetSimplifiedName()

public string GetSimplifiedName()

Returns
string

GetSplitNameWithEditorPath()

public String[] GetSplitNameWithEditorPath()

Returns
string[]

AfterDeserialized()

public virtual void AfterDeserialized()

Called after the asset is deserialized, override to implement custom post-deserialization logic.

MakeGuid()

public void MakeGuid()

Generates and assigns a new globally unique identifier (GUID) to the object.

TrackAssetOnSave(Guid)

public void TrackAssetOnSave(Guid g)

Track an asset such that is also saved once this asset is saved.

Parameters
g Guid