public static void BeginLevel() { FogOfWar.DisableShaderFogFunction(); if (FogOfWar.enable) { GC.Collect(); GameObject gameObject = GameObject.Find("Design/Field"); if (gameObject != null && gameObject.activeInHierarchy) { FieldObj component = gameObject.GetComponent <FieldObj>(); if (component != null) { if (!Singleton <WatchController> .get_instance().IsWatching) { FogOfWar.EnableShaderFogFunction(); } component.InitField(); int inFakeSightRange = 0; component.UnrealToGridX(Horizon.QueryMainActorFakeSightRadius(), out inFakeSightRange); Singleton <GameFowManager> .get_instance().InitSurface(true, component, inFakeSightRange); if (Singleton <GameFowManager> .get_instance().LoadPrecomputeData()) { FogOfWar.Reset(component.FieldX, component.FieldY, component.NumX, component.NumY, (int)GameDataMgr.globalInfoDatabin.GetDataByKey(56u).dwConfValue); FogOfWar.ClearAllFog(true); float num = Mathf.Max((float)component.FieldX / 1000f, 1f); float num2 = Mathf.Max((float)component.FieldY / 1000f, 1f); Shader.SetGlobalVector("_InvSceneSize", new Vector4(1f / num, 1f / num2, num, num2)); } } } } }
public static void EndLevel() { FogOfWar.DisableShaderFogFunction(); FogOfWar.enable = false; Singleton <GameFowManager> .get_instance().UninitSurface(); FogOfWar.Clear(); FogOfWar._bitmapData = null; FogOfWar.RenderFrameNum = 0u; }