-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFillTextOnSelect.cs
50 lines (44 loc) · 1.3 KB
/
FillTextOnSelect.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class FillTextOnSelect : MonoBehaviour, ISelectHandler
{
public Text[] textBoxes;
[TextArea(8,8)]
public string[] fillThis;
//optional just to help save time for me:
public Enemy eStats;
// Start is called before the first frame update
void Start()
{
if(fillThis.Length!=textBoxes.Length)
{
Debug.Log("Number of texts not equal to number of strings!");
}
}
// Update is called once per frame
void Update()
{
}
public void OnSelect(BaseEventData eventData)
{
for (int i = 0; i < textBoxes.Length; i++)
{
textBoxes[i].text = fillThis[i];
}
if (eStats)
{
textBoxes[2].text =
//"Stats: \n" +
"Health: " + eStats.health + "\n" +
"Damage: " + eStats.dmgToGive + "\n" +
"Attack Delay: " + eStats.attackDelay + "\n" +
"Range: " + eStats.maxAttackDist + "\n" +
"Speed: " + eStats.moveSpeed + "\n" +
"Research Rate: " + eStats.researchSpeed + "\n" +
"Buffed By: " + eStats.buffedBy;
}
}
}