-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReticleAnimation.cs
65 lines (58 loc) · 2.04 KB
/
ReticleAnimation.cs
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ReticleAnimation : MonoBehaviour
{
[SerializeField] private GameObject circle1;
[SerializeField] private float c1start;
[SerializeField] private float c1end;
[SerializeField] private GameObject circle2;
[SerializeField] private float c2start;
[SerializeField] private float c2end;
[SerializeField] private GameObject point;
[SerializeField] private float pointStart;
[SerializeField] private float pointEnd;
[SerializeField] private AnimationCurve animCurve;
[SerializeField] private float selectAnimTime;
[SerializeField] public float deselectAnimTime;
private TimeManager time;
void Start()
{
time = GameObject.Find("TimeManager").GetComponent<TimeManager>();
}
public void Selected()
{
this.gameObject.SetActive(true);
if (point != null)
{
point.gameObject.SetActive(true);
}
LeanTween.moveLocalX(circle2, c2start, selectAnimTime).setEase(animCurve);
LeanTween.moveLocalX(circle1, c1start, selectAnimTime).setEase(animCurve);
if (point != null) LeanTween.moveLocalX(point, pointStart, selectAnimTime).setEase(animCurve);
time.SetTime(0.15f, 0.005f);
/* Time.timeScale = 0.2f;
Time.fixedDeltaTime = 0.005f; */
}
public void Deselect()
{
/* Time.timeScale = 1f;
Time.fixedDeltaTime = 0.02f; */
time.SetTime(0.9f, 0.015f);
LeanTween.moveLocalX(circle1, c1end, deselectAnimTime).setEase(animCurve);
LeanTween.moveLocalX(circle2, c2end, deselectAnimTime).setEase(animCurve);
if (point != null)
{
LeanTween.moveLocalX(point, pointEnd, deselectAnimTime).setEase(animCurve).setOnComplete(() =>
{
point.GetComponent<Shot>().FireProjectile();
this.gameObject.SetActive(false);
}
);
}
else
{
this.gameObject.SetActive(false);
}
}
}