Beispiel #1
0
 void MakeClick(float x, float y)
 {
     if (enableClearFogOnClick)
     {
         // Smoothly clear fog at position
         map.FogOfWarIncrement(x, y, -0.25f, 0.075f);
     }
     else if (enableClearFogCountryOnClick)
     {
         // Get country index at position
         Vector2 position     = new Vector2(x, y);
         int     countryIndex = map.GetCountryIndex(position);
         if (countryIndex >= 0)
         {
             // Get fog alpha at position and toggle its state
             float alpha = map.FogOfWarGet(x, y);
             if (alpha > 0)
             {
                 // Fog is visible, clear it on entire country
                 map.FogOfWarSetCountry(countryIndex, 0);
             }
             else
             {
                 // Fog is clear, show it on entire country
                 map.FogOfWarSetCountry(countryIndex, 1);
             }
         }
     }
 }