32 lines
771 B
C#
32 lines
771 B
C#
using System;
|
|
namespace Nerfed.Runtime;
|
|
|
|
public enum ResourceState
|
|
{
|
|
Unloaded,
|
|
Queued,
|
|
Loading,
|
|
Loaded,
|
|
Failed
|
|
}
|
|
|
|
public abstract class Resource
|
|
{
|
|
public Guid Id { get; internal set; }
|
|
public string Path { get; internal set; }
|
|
|
|
/// <summary>
|
|
/// Natively tracks if the resource is currently in RAM/VRAM.
|
|
/// </summary>
|
|
public ResourceState State { get; internal set; } = ResourceState.Unloaded;
|
|
|
|
/// <summary>
|
|
/// Tracks how many entities or systems currently need this loaded.
|
|
/// When it hits 0, the ResourceManager handles unloading natively.
|
|
/// </summary>
|
|
public int ReferenceCount { get; internal set; } = 0;
|
|
|
|
internal abstract void Load(Stream stream);
|
|
internal abstract void Unload();
|
|
}
|