Пример #1
0
 public void Execute()
 {
     for (int i = 0; i <= SpawnLocationList.Length - 1; i++)
     {
         float3  position = SpawnLocationList[i].Position;
         Vector2 point2D  = new Vector2(position.x, position.z);
         if (!TerrainRect.Contains(point2D))
         {
             BVHRay ray = new BVHRay
             {
                 Origin    = position + new float3(0, 10000, 0),
                 Direction = new float3(0, -1, 0),
                 DoRaycast = 0
             };
             Rays[i] = ray;
         }
         else
         {
             BVHRay ray = new BVHRay
             {
                 Origin    = position + new float3(0, 10000, 0),
                 Direction = new float3(0, -1, 0),
                 DoRaycast = math.@select(1, 0, SpawnLocationList[i].SpawnChance < 0)
             };
             Rays[i] = ray;
         }
     }
 }
        public void Execute()
        {
            for (int i = 0; i <= Rays.Length - 1; i++)
            {
                BVHRay ray = Rays[i];
                if (ray.DoRaycast == 0)
                {
                    continue;
                }

                RayCastStackless(i);
            }
        }
Пример #3
0
        //public Rect TerrainRect;

        //[ReadOnly] public NativeArray<byte> CoverageMapArray;

        public void Execute(int index)
        {
            BVHRay ray = Rays[index];

            if (ray.DoRaycast == 0)
            {
                HitInfo hitInfo = new HitInfo
                {
                    HitDistance = -1
                };
                HitInfos[index] = hitInfo;
                return;
            }

            //float3 worldPosition = Rays[index].origin;
            //if (HasMesh(worldPosition))
            //{
            RayCastStackless(index);
            //}
        }