update framework
This commit is contained in:
1 parent
3a1e97df6f
commit
e3f449f183
31 files changed
+984
-307
No files matched your search
@@ -1,7 +1,20 @@
|
||||
using GameCore.TinyECS;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace GameCore.Test
|
||||
{
|
||||
using Entity = Entity<EntityType>;
|
||||
|
||||
public struct TransformData
|
||||
{
|
||||
public float3 position;
|
||||
public float scale;
|
||||
public quaternion rotation;
|
||||
}
|
||||
|
||||
public struct StateData
|
||||
{
|
||||
public bool death;
|
||||
public int hp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "Game.Test",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"nimin.tinyecs",
|
||||
"Unity.Mathematics",
|
||||
"Unity.Burst"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21d33bf0450d14e5289fe083b8566dbe
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using GameCore.Test;
|
||||
using UnityEngine;
|
||||
|
||||
public class Main : MonoBehaviour
|
||||
@@ -7,7 +8,7 @@ public class Main : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
TestEntityDataBlock.Run();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using GameCore.TinyECS;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameCore.Test
|
||||
{
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5d058ca04eb44268eb93d1871dd132c
|
||||
timeCreated: 1668273920
|
||||
Reference in new issue
Block a user