-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtameButton.cs
More file actions
44 lines (39 loc) · 1.08 KB
/
tameButton.cs
File metadata and controls
44 lines (39 loc) · 1.08 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
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class tameButton : MonoBehaviour {
public Button button;
public Text text;
public PlayerControls player;
// Use this for initialization
void Start () {
player = FindObjectOfType<PlayerControls>();
if (text.text == "Combat")
{
text.text = "Combat";
player.tamingCombat = "Combat";
button.GetComponent<Image>().color = Color.red;
}
else
{
text.text = "Taming";
player.tamingCombat = "Taming";
button.GetComponent<Image>().color = new Color(0, 234, 255);
}
}
public void TameCombat()
{
if (text.text == "Combat")
{
text.text = "Taming";
player.tamingCombat = "Taming";
button.GetComponent<Image>().color = new Color(0, 234, 255);
}
else
{
text.text = "Combat";
player.tamingCombat = "Combat";
button.GetComponent<Image>().color = Color.red;
}
}
}