private void Start() { EcsComponentType <TransformComponent> .Register(); EcsComponentType <RigBodyComponent> .Register(); EcsComponentType <ColliderComponent> .Register(); EcsComponentType <RigBodyStaticComponent> .Register(); EcsComponentType <BroadphaseRefComponent> .Register(); EcsComponentType <BroadphaseSAPComponent> .Register(); EcsComponentType <RayComponent> .Register(); EcsComponentType <HeroComponent> .Register(); EcsComponentType <CharacterComponent> .Register(); EcsComponentType <StaticRectComponent> .Register(); EcsComponentType <StaticCircleComponent> .Register(); EcsComponentType <BlueCircleComponent> .Register(); EcsComponentType <YellowCircleComponent> .Register(); _world = new EcsWorld(); _engine = new EcsSystemGroup(); _engine.AddSystem(new BroadphaseInitSystem()); _engine.AddSystem(new IntegrateVelocitySystem()); _engine.AddSystem(new BroadphaseUpdateSystem()); _engine.AddSystem(new BroadphaseCalculatePairSystem(_collisionMatrix)); _engine.AddSystem(new ResolveCollisionsSystem()); _engine.AddSystem(new RaytracingSystem(_collisionMatrix)); _engine.AddSystem(new BroadphaseClearPairSystem()); _engine.AddSystem(new CreatorSystem(this, _collisionMatrix)); _engine.AddSystem(new InputSystem()); _engine.AddSystem(new PresenterSystem()); }
public void SorterTest() { SystemA systemA = new SystemA(); SystemB systemB = new SystemB(); SystemC systemC = new SystemC(); SystemD systemD = new SystemD(); SystemE systemE = new SystemE(); SystemF systemF = new SystemF(); SystemG systemG = new SystemG(); EcsSystemGroup root = new EcsSystemGroup(); root.AddSystem(systemE); root.AddSystem(systemA); root.AddSystem(systemD); root.AddSystem(systemF); root.AddSystem(systemC); root.AddSystem(systemB); root.AddSystem(systemG); root.Update(0, new EcsWorld()); List <IEcsSystem> systems = new List <IEcsSystem>(root.Systems); Assert.AreEqual(1, systems.Count); systems = new List <IEcsSystem>(((EcsSystemGroup)systems[0]).Systems); Assert.AreEqual(2, systems.Count); Assert.AreEqual(systemG, systems[0]); systems = new List <IEcsSystem>(((EcsSystemGroup)systems[1]).Systems); Assert.AreEqual(systemF, systems[0]); Assert.AreEqual(systemB, systems[1]); Assert.AreEqual(systemD, systems[2]); Assert.AreEqual(systemA, systems[3]); Assert.AreEqual(systemE, systems[4]); Assert.AreEqual(systemC, systems[5]); EcsSystemSorter.Sort(new List <IEcsSystem> { new SystemF(), new SystemG() }); //ExpectedException }