blob: abada07e2dc25394be61fb3a252695a7e662a153 (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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;
}
}
|