コード例 #1
0
        public void Run()
        {
            foreach (int e in filter.Entities)
            {
                Pos pos = world.GetComponent <Pos>(e, _posId);
                Vel vel = world.GetComponent <Vel>(e, _velId);
                //const float dt = 1.0f / 60.0f;

                //pos.Location = pos.Location + vel.Linear * dt;
                //pos.Rotation = pos.Rotation + vel.Angular * dt;
            }
        }
コード例 #2
0
        public static void RunLeoEcsBenchmark()
        {
            EcsWorld world = new EcsWorld().AddSystem(new MoveSys());

            for (var i = 0; i < EntitiesCount; i++)
            {
                int e   = world.CreateEntity();
                Pos pos = world.AddComponent <Pos>(e);
                pos.Location = new Vector3(1f, 2f, 0f);
                pos.Rotation = 0;
                Vel vel = world.AddComponent <Vel>(e);
                vel.Linear  = new Vector3(2f, 2f, 1f);
                vel.Angular = 0.01f;
            }
            //warmup
            world.RunUpdate();

            Measure("Leopotam", () => {
                for (var i = 0; i < RepeatCount; i++)
                {
                    world.RunUpdate();
                }
            });
        }