Ejemplo n.º 1
0
 private static void Reset(int inMapWidth, int inMapHeight, int inBitmapWidth, int inBitmapHeight, int sight)
 {
     FogOfWar._BitmapWidth  = inBitmapWidth;
     FogOfWar._BitmapHeight = inBitmapHeight;
     if (inBitmapWidth == 0 || inBitmapHeight == 0 || sight == 0)
     {
         return;
     }
     FogOfWar.Clear();
     if (FogOfWar._bitmapTexture != null)
     {
         FogOfWar._bitmapTexture.Resize(FogOfWar._BitmapWidth, FogOfWar._BitmapHeight, TextureFormat.Alpha8, false);
     }
     else
     {
         FogOfWar._bitmapTexture          = new Texture2D(FogOfWar._BitmapWidth, FogOfWar._BitmapHeight, TextureFormat.Alpha8, false);
         FogOfWar._bitmapTexture.wrapMode = TextureWrapMode.Clamp;
     }
     for (int i = 0; i < FogOfWar.fowTextures.Length; i++)
     {
         if (FogOfWar.fowTextures[i] != null)
         {
             FogOfWar.fowTextures[i].Release();
         }
         int num  = FogOfWar._BitmapWidth * 2;
         int num2 = FogOfWar._BitmapHeight * 2;
         if (SystemInfo.npotSupport == NPOTSupport.None)
         {
             num  = IntMath.CeilPowerOfTwo(num);
             num2 = IntMath.CeilPowerOfTwo(num2);
         }
         FogOfWar.fowTextures[i]          = new RenderTexture(num, num2, 0, RenderTextureFormat.Default);
         FogOfWar.fowTextures[i].wrapMode = TextureWrapMode.Clamp;
     }
     FogOfWar.CreateMat(ref FogOfWar.fowMats[0], "SGame_Post/FowBlur");
     FogOfWar.CreateMat(ref FogOfWar.fowMats[1], "SGame_Post/FowInterpolate");
     FogOfWar.CreateMat(ref FogOfWar.fowMats[2], "SGame_Post/FowLight");
     if (inMapWidth == 0 || inMapHeight == 0)
     {
         return;
     }
 }