-
Notifications
You must be signed in to change notification settings - Fork 0
/
BonusTextController.cs
51 lines (51 loc) · 1.67 KB
/
BonusTextController.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BonusTextController : MonoBehaviour {
Animator animator;
Text text;
bool lastRainbowMode = false;
int lastColorMode = 0;
int number = 0;
// Use this for initialization
void Start () {
animator = GetComponent<Animator> ();
text = GetComponent<Text> ();
lastRainbowMode = ColorBarController.instance.rainbowMode;
lastColorMode = ColorBarController.instance.colorMode;
}
// Update is called once per frame
void Update () {
if (Time.frameCount % 3 == 1) {
if (lastRainbowMode != ColorBarController.instance.rainbowMode) {
lastRainbowMode = ColorBarController.instance.rainbowMode;
if (ColorBarController.instance.rainbowMode == true) {
number = ((ColorBarController.instance.colorMode + 2));
if (animator.GetCurrentAnimatorClipInfo (0) [0].clip.name == "Hidden") {
//animator.SetTrigger ("Show");
}
animator.SetTrigger ("Show");
} else {
number = ((ColorBarController.instance.colorMode + 1));
}
text.text = "COLLECT " + number + "X COINS";
}
}
if (Time.frameCount % 3 == 2) {
if (lastColorMode != ColorBarController.instance.colorMode) {
lastColorMode = ColorBarController.instance.colorMode;
if (ColorBarController.instance.rainbowMode == true) {
number = ((ColorBarController.instance.colorMode + 2));
} else {
number = (ColorBarController.instance.colorMode + 1);
}
text.text = "COLLECT " + number + "X COINS";
if (animator.GetCurrentAnimatorClipInfo (0) [0].clip.name == "Hidden") {
//animator.SetTrigger ("Show");
}
animator.SetTrigger ("Show");
}
}
}
}