Initial Upload;

This commit is contained in:
2025-02-18 19:38:13 +09:00
commit de8eafb713
27 changed files with 554 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
namespace Misaki.AoVolume
{
internal readonly struct VolumeEntity
{
private const int _INVALID_INDEX = -1;
public readonly int entityIndex;
public readonly bool IsValid => entityIndex != _INVALID_INDEX;
public static readonly VolumeEntity InvalidEntity = new(_INVALID_INDEX);
public VolumeEntity(int index)
{
entityIndex = index;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: de5e2eab102d42b4fa1e2b7a06810b4d

View File

@@ -0,0 +1,39 @@
using UnityEngine;
namespace Misaki.AoVolume
{
internal abstract class VolumeObject : MonoBehaviour
{
private VolumeEntity _entity = VolumeEntity.InvalidEntity;
public VolumeData data;
protected virtual void InitializeEntity()
{
if (_entity.IsValid)
{
return;
}
_entity = VolumeDatabase.Instance.CreateEntity(this);
}
protected virtual void OnEnable()
{
InitializeEntity();
}
protected virtual void OnDisable()
{
if (_entity.IsValid)
{
VolumeDatabase.Instance.DestroyEntity(_entity);
}
}
protected virtual void Update()
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 410059065965c744db4523b0dec8a3aa