summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/Scene0Controller.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/Scene0Controller.cs')
-rw-r--r--Client/Assembly-CSharp/Scene0Controller.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/Scene0Controller.cs b/Client/Assembly-CSharp/Scene0Controller.cs
new file mode 100644
index 0000000..abada07
--- /dev/null
+++ b/Client/Assembly-CSharp/Scene0Controller.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections;
+using UnityEngine;
+
+public class Scene0Controller : SceneController
+{
+ public float Duration = 3f;
+
+ public SpriteRenderer[] ExtraBoys;
+
+ public AnimationCurve PopInCurve;
+
+ public AnimationCurve PopOutCurve;
+
+ public float OutDuration = 0.2f;
+
+ public void OnEnable()
+ {
+ base.StartCoroutine(this.Run());
+ }
+
+ public void OnDisable()
+ {
+ for (int i = 0; i < this.ExtraBoys.Length; i++)
+ {
+ this.ExtraBoys[i].enabled = false;
+ }
+ }
+
+ private IEnumerator Run()
+ {
+ int lastBoy = 0;
+ float start = Time.time;
+ for (;;)
+ {
+ float num = (Time.time - start) / this.Duration;
+ int num2 = Mathf.RoundToInt((Mathf.Cos(3.1415927f * num + 3.1415927f) + 1f) / 2f * (float)this.ExtraBoys.Length);
+ if (lastBoy < num2)
+ {
+ base.StartCoroutine(this.PopIn(this.ExtraBoys[lastBoy]));
+ lastBoy = num2;
+ }
+ else if (lastBoy > num2)
+ {
+ lastBoy = num2;
+ base.StartCoroutine(this.PopOut(this.ExtraBoys[lastBoy]));
+ }
+ yield return null;
+ }
+ yield break;
+ }
+
+ private IEnumerator PopIn(SpriteRenderer boy)
+ {
+ boy.enabled = true;
+ for (float timer = 0f; timer < 0.2f; timer += Time.deltaTime)
+ {
+ float num = this.PopInCurve.Evaluate(timer / 0.2f);
+ boy.transform.localScale = new Vector3(num, num, num);
+ yield return null;
+ }
+ boy.transform.localScale = Vector3.one;
+ yield break;
+ }
+
+ private IEnumerator PopOut(SpriteRenderer boy)
+ {
+ boy.enabled = true;
+ for (float timer = 0f; timer < this.OutDuration; timer += Time.deltaTime)
+ {
+ float num = this.PopOutCurve.Evaluate(timer / this.OutDuration);
+ boy.transform.localScale = new Vector3(num, num, num);
+ yield return null;
+ }
+ boy.transform.localScale = Vector3.one;
+ boy.enabled = false;
+ yield break;
+ }
+}