Example #1
0
        private static void RunTests()
        {
            var world  = EntityManager.CreateWorld();
            var entity = EntityManager.CreateEntity(world);
            var c      = new TestComponent()
            {
                value = 232
            };
            var oc = new OtherComponent()
            {
                value = 123
            };

            EntityManager.AddComponent <TestComponent>(world, entity, ref c);
            Assert.That(EntityManager.HasComponent <TestComponent>(world, entity), Is.EqualTo(true));
            EntityManager.AddComponent <OtherComponent>(world, entity, ref oc);
            Assert.That(EntityManager.HasComponent <OtherComponent>(world, entity), Is.EqualTo(true));
            Console.WriteLine("Test stage 1 passed");

            while (isActive == true)
            {
                EntityManager.Update();
                Thread.Sleep(1000 / 60);
            }
            Console.WriteLine("All tests passed!");
            Console.ReadLine();
        }
Example #2
0
 public void AddComponent()
 {
     foreach (var e in entities)
     {
         var c = new TestComponent()
         {
             value = 232
         };
         var oc = new OtherComponent()
         {
             value = 123
         };
         EntityManager.AddComponent <TestComponent>(world, e, ref c);
         EntityManager.AddComponent <OtherComponent>(world, e, ref oc);
     }
 }
Example #3
0
        public void IterationSetup()
        {
            world = EntityManager.CreateWorld();
            proto = EntityManager.CreateEntityPrototype();
            var cc = new TestComponent()
            {
                value = 232
            };
            var occ = new OtherComponent()
            {
                value = 123
            };

            EntityManager.AddComponent <TestComponent>(proto, ref cc);
            EntityManager.AddComponent <OtherComponent>(proto, ref occ);
        }