blob: 10ac3217ee0c8eb2319be0cabcb2e70b720123c3 (
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
|
using UnityEngine;
public class RingHandler : MonoBehaviour
{
public float timeBeforeRing = 30f;
public static RingHandler instance;
private CodeAnimation code;
private float counter;
private void Awake()
{
instance = this;
}
private void Start()
{
code = GetComponent<CodeAnimation>();
}
private void Update()
{
if (GameManager.instance.isPlaying)
{
if (code.currentState != 0 && counter > timeBeforeRing && !code.isPlaying)
{
code.PlayIn();
}
counter += TimeHandler.deltaTime;
}
else
{
if (code.currentState != CodeAnimationInstance.AnimationUse.Out && !code.isPlaying)
{
code.PlayOut();
}
counter = 0f;
}
}
public Vector2 ClosestPoint(Vector2 pos)
{
return pos.normalized * Radius();
}
public float Radius()
{
return base.transform.localScale.x * 95f;
}
}
|