You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using GameCore.TinyECS;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace ECSTest
|
|
|
|
|
{
|
|
|
|
|
public static class TestEntityDataBlock
|
|
|
|
|
{
|
|
|
|
|
public static void Run()
|
|
|
|
|
{
|
|
|
|
|
var meta = EntityDataBlockMeta.Create<TransformData, StateData>();
|
|
|
|
|
using var blockChain = new EntityDataBlockChain(meta, 1000);
|
|
|
|
|
|
|
|
|
|
blockChain.Add();
|
|
|
|
|
ref var stateData = ref blockChain.GetData<StateData>(0);
|
|
|
|
|
stateData.hp = 1000;
|
|
|
|
|
|
|
|
|
|
var view = blockChain.AsBlockView(0);
|
|
|
|
|
var hp = view.GetData<StateData>(0).hp;
|
|
|
|
|
Debug.LogError($"hp: {hp}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|