Fix Cloak Invisible Bug

This commit is contained in:
Noah Pilarski 2022-05-27 05:54:18 -04:00
parent b8b3d70638
commit bb22b03c18
2 changed files with 20 additions and 2 deletions

View File

@ -1,4 +1,4 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.Utility; using NewHorizons.Utility;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
@ -32,6 +32,8 @@ namespace NewHorizons.Builder.Body
newCloak.SetActive(true); newCloak.SetActive(true);
cloakFieldController.enabled = true; cloakFieldController.enabled = true;
cloakSectorController.EnableCloak();
// To cloak from the start // To cloak from the start
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(cloakSectorController.OnPlayerExit); Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
} }

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Components namespace NewHorizons.Components
@ -60,5 +60,21 @@ namespace NewHorizons.Components
renderer.forceRenderingOff = true; renderer.forceRenderingOff = true;
} }
} }
public void EnableCloak()
{
SunLightController.RegisterSunOverrider(_cloak, 900);
_cloak._cloakSphereRenderer.SetActivation(true);
Shader.EnableKeyword("_CLOAKINGFIELDENABLED");
_cloak._cloakVisualsEnabled = true;
}
public void DisableCloak()
{
SunLightController.UnregisterSunOverrider(_cloak);
_cloak._cloakSphereRenderer.SetActivation(false);
Shader.DisableKeyword("_CLOAKINGFIELDENABLED");
_cloak._cloakVisualsEnabled = false;
}
} }
} }