Skip to content

Instantly share code, notes, and snippets.

@Redhucules
Created July 27, 2015 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Redhucules/a1268b7da3aaf880aacf to your computer and use it in GitHub Desktop.
Save Redhucules/a1268b7da3aaf880aacf to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PlayerBattleUI : MonoBehaviour {
//private GameObject BattleUICanvas;
public Image ENGauge;
public Image ENGaugeOBRequire;
public PlayerStatus Status;
void Awake ()
{
if (GameObject.Find("BattleUICanvas/ENGauge") != null)
{
ENGauge = GameObject.Find("BattleUICanvas/ENGauge").GetComponent <Image> ();
}
if (GameObject.Find("BattleUICanvas/ENGaugeOBRequire") != null)
{
ENGaugeOBRequire = GameObject.Find("BattleUICanvas/ENGaugeOBRequire").GetComponent <Image> ();
}
Status = GetComponent<PlayerStatus> ();
}
// Use this for initialization
void Start ()
{
if (ENGaugeOBRequire != null)
{
ENGaugeOBRequire.fillAmount = Status.OBStartCost / Status.MaxEnergy;
}
}
// Update is called once per frame
void Update ()
{
if (ENGauge != null)
{
ENGauge.fillAmount = Status.CurrentEnergy / Status.MaxEnergy;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment