Пример #1
0
    private void MoveFood(Entity food)
    {
        var translation = EntityManager.GetComponentData <Translation>(food);

        translation.Value = _random.NextInt3(new int3(-15, -9, 0), new int3(15, 9, 0));
        EntityManager.SetComponentData(food, translation);
    }
Пример #2
0
        public static void Generic()
        {
            Unity.Mathematics.Random rng = new Unity.Mathematics.Random(Helpers.GetRngSeed);

            for (int i = 0; i < 3; i++)
            {
                NativeArray <int3> test = new NativeArray <int3>(rng.NextInt(1, 1_000_000), Allocator.Persistent);

                for (int j = 0; j < test.Length; j++)
                {
                    test[j] = rng.NextInt3();
                }

                Assert.AreEqual(Scalar(test.GetUnsafePtr(), sizeof(int3) * test.Length), test.SIMD_CountBits());

                test.Dispose();
            }
        }