blob: 0904d937fd383b9679360a13a4b0c0efac6c3227 (
plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
//creates the buttons on panel of animations
public class Ui_Char_Panel : MonoBehaviour {
public GameObject character;
public Transform acts_table;
public Button buttonPrefab;
Button sel_btm;
Actions actions;
void Start () {
actions = character.GetComponent<Actions> ();
CreateActionButton("Idle");
CreateActionButton("Idle2");
CreateActionButton("Attack");
CreateActionButton("WalkForwad");
CreateActionButton("WalkForwad2");
CreateActionButton("WalkBack");
CreateActionButton("TurnLeft");
CreateActionButton("TurnRight");
CreateActionButton("StrafeLeft");
CreateActionButton("StrafeRight");
CreateActionButton("ChangeToWeels");
CreateActionButton("MoveWeelsForwad");
CreateActionButton("MoveWeelsForwad2");
CreateActionButton("MoveWeelsBack");
CreateActionButton("ChangeToWalk");
CreateActionButton("Dead1");
CreateActionButton("Dead2");
CreateActionButton("Dead3");
CreateActionButton("Dead4");
}
void CreateActionButton(string name) {
CreateActionButton(name, name);
}
void CreateActionButton(string name, string message) {
Button button = CreateButton (name, acts_table);
if (name == "Idle")
{
sel_btm = button;
button.GetComponentInChildren<Image>().color = new Color(.5f, .5f, .5f);
}
button.GetComponentInChildren<Text>().fontSize = 12;
button.onClick.AddListener(() => actions.SendMessage(message, SendMessageOptions.DontRequireReceiver));
button.onClick.AddListener(() => select_btm(button) );
}
void select_btm(Button btm)
{
sel_btm.GetComponentInChildren<Image>().color = new Color(.345f, .345f, .345f);
btm.GetComponentInChildren<Image>().color = new Color(.5f, .5f, .5f);
sel_btm = btm;
}
Button CreateButton(string name, Transform group) {
GameObject obj = (GameObject) Instantiate (buttonPrefab.gameObject);
obj.name = name;
obj.transform.SetParent(group);
obj.transform.localScale = Vector3.one;
Text text = obj.transform.GetChild (0).GetComponent<Text> ();
text.text = name;
return obj.GetComponent<Button> ();
}
public void GetUpgraid()
{
Application.OpenURL("https://www.assetstore.unity3d.com/#!/content/88937");
}
public void OpenPublisherPage() {
Application.OpenURL ("https://connect.unity.com/u/58c9250f32b30600230f64fa");
}
}
|