mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
remove test
This commit is contained in:
parent
94dc93d7fa
commit
afd97d80aa
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3776f76149b634c48a0bf7a7f98ee0c5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44bc1d65f4a37af4fb55621ae2da09be
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public struct EnemyTag
|
||||
{
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7100cf6b7909824ba4ffcd869e64167
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public struct PlayerTag
|
||||
{
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 730345f3f95800a4dbd182950d4e9f19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public struct TransfromCom
|
||||
{
|
||||
public Vector3 position;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c391c96db013de4780ce5e87c015fa1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public struct Velocity
|
||||
{
|
||||
public Vector3 value;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a819836b0a5354408897f028b67504c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public struct View
|
||||
{
|
||||
public Transform Ref;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df980941b94b3864c81750c212259b8f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
[Serializable]
|
||||
public class SharedData
|
||||
{
|
||||
public Transform view1;
|
||||
public Transform view2;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea74209e58692b3428f531e27d577cd7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DCFApixels;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public class Startup : MonoBehaviour
|
||||
{
|
||||
|
||||
private EcsSession _ecsSession;
|
||||
|
||||
[SerializeField]
|
||||
public SharedData _data = new SharedData();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_ecsSession = new EcsSession()
|
||||
.Inject(_data)
|
||||
.AddWorld(new EcsWorld<DefaultWorld>())
|
||||
.Add(new TestSystem())
|
||||
.Add(new VelocitySystem())
|
||||
.Add(new ViewSystem())
|
||||
.Init();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_ecsSession.Run();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
_ecsSession.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8520d71f413c71442bd847f51820760e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public class TestSystem : IEcsInject<SharedData>, IEcsInject<EcsWorldMap>, IEcsInitSystem
|
||||
{
|
||||
private SharedData _sharedData;
|
||||
private EcsWorld<DefaultWorld> _world;
|
||||
public void Inject(SharedData obj) => _sharedData = obj;
|
||||
public void Inject(EcsWorldMap obj) { _world = obj.Get<DefaultWorld>(); }
|
||||
|
||||
public void Init(EcsSession session)
|
||||
{
|
||||
//var x1 = _world.GetFilter<Inc<TransfromCom, Velocity>>();
|
||||
//var x2 = _world.GetFilter<Inc<TransfromCom, View>>();
|
||||
//var x3 = _world.GetFilter<Inc<TransfromCom, Velocity>>();
|
||||
//var x4 = _world.GetFilter<Inc<TransfromCom, Velocity>>();
|
||||
//var x5 = _world.GetFilter<Inc<Velocity, TransfromCom>>();
|
||||
//
|
||||
//int has1 = x1.GetHashCode();
|
||||
//int has2 = x2.GetHashCode();
|
||||
//int has3 = x3.GetHashCode();
|
||||
//int has4 = x4.GetHashCode();
|
||||
//int has5 = x5.GetHashCode();
|
||||
//
|
||||
//Debug.Log("1 " + has1);
|
||||
//Debug.Log("2 " + has2);
|
||||
//Debug.Log("3 " + has3);
|
||||
//Debug.Log("4 " + has4);
|
||||
//Debug.Log("5 " + has5);
|
||||
var e = _world.NewEntity();
|
||||
e.Write<TransfromCom>().position = Vector3.zero;
|
||||
e.Write<Velocity>().value = Vector3.one;
|
||||
e.Write<View>().Ref = _sharedData.view1;
|
||||
e.Write<EnemyTag>();
|
||||
|
||||
var e2 = _world.NewEntity();
|
||||
e2.Write<TransfromCom>().position = Vector3.zero;
|
||||
e2.Write<Velocity>().value = Vector3.zero;
|
||||
e2.Write<View>().Ref = _sharedData.view2;
|
||||
e2.Write<PlayerTag>();
|
||||
|
||||
var x1 = _world.GetFilter<Inc<TransfromCom, Velocity>>();
|
||||
|
||||
bool bb = _world.IsMaskCompatible(x1.Mask, e.id);
|
||||
//has1 = x1.GetHashCode();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: affa952a9e445864ebfe2ca2388e76de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public class VelocitySystem : IEcsInject<EcsWorldMap>, IEcsRunSystem
|
||||
{
|
||||
private EcsWorld<DefaultWorld> _world;
|
||||
public void Inject(EcsWorldMap obj) { _world = obj.Get<DefaultWorld>(); }
|
||||
|
||||
public void Run(EcsSession session)
|
||||
{
|
||||
var x = _world.GetFilter<Inc<TransfromCom, Velocity>>();
|
||||
foreach (var item in _world.GetFilter<Inc<TransfromCom, Velocity>>().Entities)
|
||||
{
|
||||
item.Write<TransfromCom>().position += item.Read<Velocity>().value * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 447778e02b3f0f8409c44680de9dbc0e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
public class ViewSystem : IEcsInject<EcsWorldMap>, IEcsRunSystem
|
||||
{
|
||||
private EcsWorld<DefaultWorld> _world;
|
||||
public void Inject(EcsWorldMap obj) { _world = obj.Get<DefaultWorld>(); }
|
||||
|
||||
public void Run(EcsSession session)
|
||||
{
|
||||
foreach (var item in _world.GetFilter<Inc<TransfromCom, View>>().Entities)
|
||||
{
|
||||
item.Write<View>().Ref.position = item.Read<TransfromCom>().position;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 780f70f4504a08b45b58c4fe891b894f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user