blob: f0c6b5325b42b1f790ed2c82002b79137a9882ce (
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
|
using System.Collections;
using UnityEngine;
public class GridBounceCircle : GridObject
{
private float m_startSize;
private bool isBlooping;
private float currentDistance;
private void Start()
{
m_startSize = base.transform.localScale.x;
}
public override void BopCall(float power)
{
if (!isBlooping || (isBlooping && power > currentDistance))
{
StopAllCoroutines();
StartCoroutine(Blop(power));
}
}
public override void OnSetSize(float size)
{
if (!isBlooping)
{
base.transform.localScale = Vector3.one * size * m_startSize;
}
}
private IEnumerator Blop(float power)
{
isBlooping = true;
currentDistance = power;
float maxSize = Mathf.Lerp(1f * m_startSize, 3f * m_startSize, power);
float timer2 = 0f;
while (timer2 < 1f)
{
timer2 += TimeHandler.deltaTime * 10f;
base.transform.localScale = Vector3.one * Mathf.Lerp(m_startSize, maxSize, timer2);
yield return null;
}
yield return new WaitForSeconds(0.2f);
timer2 = 0f;
while (timer2 < 1f)
{
timer2 += TimeHandler.deltaTime * 6f;
base.transform.localScale = Vector3.one * Mathf.Lerp(maxSize, m_startSize, timer2);
yield return null;
}
base.transform.localScale = Vector3.one * m_startSize;
isBlooping = false;
}
}
|