コード例 #1
0
ファイル: InsideCheck.cs プロジェクト: DevZhav/The-Forest
        private static void AddWallChunk(InsideCheck.GridPosition position, InsideCheck.WallChunk chunk)
        {
            List <InsideCheck.WallChunk> list = InsideCheck.AffirmWallList(position);

            list.Add(chunk);
            InsideCheck.ForceRefresh(position);
        }
コード例 #2
0
ファイル: InsideCheck.cs プロジェクト: DevZhav/The-Forest
 public static int AddWallChunk(Vector3 start, Vector3 end, float height)
 {
     if (end.y < start.y)
     {
         float y = start.y;
         start.y = end.y;
         end.y   = y;
     }
     end.y += height;
     InsideCheck.WallChunk wallChunk = new InsideCheck.WallChunk(start, end, InsideCheck._nextGridToken);
     InsideCheck._nextGridToken++;
     InsideCheck.GridPosition gridPosition = InsideCheck.ToGridPosition(start);
     InsideCheck.AddWallChunk(gridPosition, wallChunk);
     InsideCheck.GridPosition gridPosition2 = InsideCheck.ToGridPosition(end);
     if (gridPosition2 != gridPosition)
     {
         InsideCheck.AddWallChunk(gridPosition2, wallChunk);
     }
     return(wallChunk.token);
 }
コード例 #3
0
ファイル: InsideCheck.cs プロジェクト: DevZhav/The-Forest
        private static void RenderChunkToOcclusion(InsideCheck.WallChunk chunk, Vector3 centre, List <bool> occlusion)
        {
            if (centre.y < chunk.start.y || chunk.end.y < centre.y)
            {
                return;
            }
            float num  = InsideCheck.CalculateAngle(InsideCheck.ToPlanarPosition(chunk.start, centre));
            float num2 = InsideCheck.CalculateAngle(InsideCheck.ToPlanarPosition(chunk.end, centre));

            if (num2 < num)
            {
                float num3 = num;
                num  = num2;
                num2 = num3;
            }
            int   num4 = InsideCheck.CalculateIndex(num, occlusion.Count);
            int   num5 = InsideCheck.CalculateIndex(num2, occlusion.Count);
            float num6 = num2 - num;

            if (num6 <= 3.14159274f)
            {
                for (int i = num4; i <= num5; i++)
                {
                    occlusion[i] = true;
                }
            }
            else
            {
                for (int j = 0; j <= num4; j++)
                {
                    occlusion[j] = true;
                }
                for (int k = num5; k < occlusion.Count; k++)
                {
                    occlusion[k] = true;
                }
            }
        }