summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/NoShadowBehaviour.cs
blob: 67023ce890aee20665d8a2a1925e610de3dabf3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);
		}
	}
}