summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/NoShadowBehaviour.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/NoShadowBehaviour.cs')
-rw-r--r--Client/Assembly-CSharp/NoShadowBehaviour.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/NoShadowBehaviour.cs b/Client/Assembly-CSharp/NoShadowBehaviour.cs
new file mode 100644
index 0000000..67023ce
--- /dev/null
+++ b/Client/Assembly-CSharp/NoShadowBehaviour.cs
@@ -0,0 +1,55 @@
+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);
+ }
+ }
+}