-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenTutorialButton.cs
More file actions
47 lines (36 loc) · 1.43 KB
/
Copy pathOpenTutorialButton.cs
File metadata and controls
47 lines (36 loc) · 1.43 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OpenTutorialButton : MonoBehaviour {
private LerpGameController gScript;
private Button button;
private PlayerController pScript;
// Use this for initialization
void Start () {
gScript = GameObject.FindGameObjectWithTag("GameController").GetComponent<LerpGameController>();
if (gScript == null)
Debug.Log("OpenTutorialButton could not get a reference to the game controller.");
button = GetComponent<Button>();
if (button == null)
Debug.Log("Open Tutorial Button script could not get a reference to the button sript.");
else
button.onClick.AddListener(OpenTutorial);
pScript = GameObject.FindGameObjectWithTag("PlayerController").GetComponent<PlayerController>();
if (pScript == null)
Debug.Log("Open Tutorial Button script could not get a reference to the player controller.");
}
// Update is called once per frame
void Update () {
Image img = GetComponent<Image>();
Color cA = pScript.GetCharColorA();
Color cB = pScript.GetCharColorB();
Color foo = Color.Lerp(cB, cA, pScript.GetLerpVal());
foo.a = 255f;
img.color = foo;
}
public void OpenTutorial()
{
gScript.OpenTutorial();
}
}