GaugeIncreasing.cs
2.33 KB
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
80
81
82
83
84
85
86
87
88
89
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
public class GaugeIncreasing : MonoBehaviour
{
Slider gauge;
GameObject text;
GameObject afterText;
GameObject cheerUp;
GameObject clue;
GameObject panel;
GameObject apple;
//GameObject controller_L;
GameObject controller_R;
GameObject gaugeBar;
Color color;
//Text textBlink;
float timeSpan;
float checkTime;
// Start is called before the first frame update
void Start()
{
// controller_L = GameObject.Find("Controller (left)");
controller_R = GameObject.Find("Controller (right)");
gauge = GetComponent<Slider>();
gaugeBar = GameObject.Find("Gauge");
text = GameObject.Find("Text");
afterText = GameObject.Find("AfterText");
clue = GameObject.Find("Clue");
panel = GameObject.Find("Panel");
apple = GameObject.Find("4");
cheerUp = GameObject.Find("CheerUp");
color = new Color(255f, 0, 0);
timeSpan = 0.0f;
checkTime = 0.1667f;
afterText.SetActive(false);
panel.SetActive(false);
clue.SetActive(false);
cheerUp.SetActive(false);
}
// Update is called once per frame
void Update()
{
if (gauge.value >= 0.5f && gauge.value < 1)
cheerUp.SetActive(true);
else if (gauge.value >= 1)
{
gauge.gameObject.transform.Find("Fill Area").Find("Fill").GetComponent<Image>().color = color;
apple.transform.Rotate(0, 60 * Time.deltaTime, 0);
cheerUp.SetActive(false);
text.SetActive(false);
afterText.SetActive(true);
if (controller_R.GetComponent<ActionTest>().GetTeleportDown()) //
{
apple.SetActive(false);
clue.SetActive(true);
panel.SetActive(true);
afterText.SetActive(false);
gaugeBar.SetActive(false);
}
}
timeSpan += Time.deltaTime;
if (timeSpan > checkTime)
{
gauge.value += 0.01f;
apple.transform.localScale += new Vector3(0.05f, 0.05f, 0.05f);
timeSpan = 0;
}
}
}