using System; using UnityEngine; public class NoShadowBehaviour : MonoBehaviour { public Renderer rend; public bool didHit; public Renderer shadowChild; public void Start() { LightSource.NoShadows.Add(base.gameObject, this); } public void OnDestroy() { LightSource.NoShadows.Remove(base.gameObject); } private void LateUpdate() { if (!PlayerControl.LocalPlayer) { return; } GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data; if (data != null && !data.IsDead) { if (this.didHit) { this.didHit = false; ShipStatus instance = ShipStatus.Instance; if (instance && instance.CalculateLightRadius(data) > instance.MaxLightRadius / 3f) { this.SetMaskFunction(8); return; } } this.SetMaskFunction(1); return; } this.SetMaskFunction(8); } private void SetMaskFunction(int func) { this.rend.material.SetInt("_Mask", func); if (this.shadowChild) { this.shadowChild.material.SetInt("_Mask", func); } } }