Exemplo n.º 1
0
        public void Execute(Entity *entity, ref SpawnerData spawner, ref AssetData assetData)
        {
            var count          = spawner.Count;
            var center         = spawner.Position;
            var radius         = spawner.Radius;
            var spawnPositions = new NativeArray <LVector3>(count, Allocator.Temp,
                                                            NativeArrayOptions.UninitializedMemory);

            GeneratePoints.RandomPointsInUnitCube(spawnPositions);
            var pointPtr = spawnPositions.GetPointer(0);
            var context  = _context;

            for (int i = 0; i < count; ++i, ++pointPtr)
            {
                var boidPtr = context.PostCmdCreateBoid();
                boidPtr->LocalToWorld.Position = center + (*pointPtr * radius);
                boidPtr->LocalToWorld.Forward  = *pointPtr;
                boidPtr->AssetData.AssetId     = assetData.AssetId;
            }

            spawnPositions.Dispose();
            context.PostCmdDestroyEntity(entity);
        }
Exemplo n.º 2
0
 private int _GetOffsetOfAssetData_AssetId()
 {
     var tempObj = new AssetData(); AssetData *ptr = &tempObj; var filedPtr = &(ptr->AssetId); return((int)((long)filedPtr - (long)ptr));
 }