summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/AlphaBlink.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/AlphaBlink.cs')
-rw-r--r--Client/Assembly-CSharp/AlphaBlink.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/AlphaBlink.cs b/Client/Assembly-CSharp/AlphaBlink.cs
new file mode 100644
index 0000000..4813ba6
--- /dev/null
+++ b/Client/Assembly-CSharp/AlphaBlink.cs
@@ -0,0 +1,44 @@
+using System;
+using UnityEngine;
+
+public class AlphaBlink : MonoBehaviour
+{
+ public float Period = 1f;
+
+ public float Ratio = 0.5f;
+
+ private SpriteRenderer rend;
+
+ private MeshRenderer mesh;
+
+ public FloatRange AlphaRange = new FloatRange(0.2f, 0.5f);
+
+ public Color baseColor = Color.white;
+
+ public void SetColor(Color c)
+ {
+ this.Start();
+ this.baseColor = c;
+ this.Update();
+ }
+
+ private void Start()
+ {
+ this.mesh = base.GetComponent<MeshRenderer>();
+ this.rend = base.GetComponent<SpriteRenderer>();
+ }
+
+ public void Update()
+ {
+ float num = Time.time % this.Period / this.Period;
+ num = (float)((num < this.Ratio) ? 1 : 0);
+ if (this.rend)
+ {
+ this.rend.color = new Color(this.baseColor.r, this.baseColor.g, this.baseColor.b, this.AlphaRange.Lerp(num));
+ }
+ if (this.mesh)
+ {
+ this.mesh.material.SetColor("_Color", new Color(this.baseColor.r, this.baseColor.g, this.baseColor.b, this.AlphaRange.Lerp(num)));
+ }
+ }
+}