all repos — RPG @ 502924ae35666f2d5ac541310b3e57f2e4fe70b4

Fully functional 3D turn based role playing game coded in C# and base Unity.

Assets/Scripts/Battle/GoodGuy.cs (view raw)

 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using UnityEngine.UI;
 5
 6public abstract class GoodGuy : Fighter
 7{
 8    protected Text hp_text, mp_text, status_text;
 9    protected Slider hp_slider, mp_slider;
10
11    public bool inBattle = true;
12    
13    public override void GetGUI()
14    {
15        if (inBattle)
16        {
17            damage_tooltip = GameObject.Find("f" + fighter_number + "_damage");
18            status_text = GameObject.Find("f" + fighter_number + "_status").GetComponent<Text>();
19            hp_text = GameObject.Find("f" + fighter_number + "_hp").GetComponent<Text>();
20            hp_slider = hp_text.GetComponentInChildren<Slider>();
21
22
23            if (stats.MaxMP > 0)
24            {
25                mp_text = GameObject.Find("f" + fighter_number + "_mp").GetComponent<Text>();
26                mp_slider = mp_text.GetComponentInChildren<Slider>();
27            }
28
29            status_text.transform.localScale = Vector3.one;
30            updateStatus();
31        }
32        
33
34    }
35
36    public void updateStatus()
37    {
38        UI.updateMeters(stats, status_text.transform);
39    }
40}