Esempio n. 1
0
 //Look into initializing this once the player comes into activation distance.
 //Has to be public for Thuk Guards.  Could be extended though.
 public virtual void InitializeHealthBar()
 {
     player        = InstanceDatabase.GetPlayerReference().transform;
     currentHealth = lifePoints;
     //Create panel
     uiHealthController = InstanceDatabase.GetLevelUIReference().transform.FindChild("Health Controller").gameObject.GetComponent <UIHealthController> ();
     //Initialize icon
     characterHeadSprite = transform.GetChild(0).GetChild(0).FindChild("Head").GetComponent <SpriteRenderer> ().sprite;
     //Start the coroutine that manages the active state of the health bar item.
     StartCoroutine(ControlHealthBarState());
 }
Esempio n. 2
0
 protected virtual void InitializeHealthPanelReference()
 {
     //Setting basic component references.
     panel              = gameObject;
     headIcon           = transform.FindChild("Icon").gameObject.GetComponent <Image> ();
     healthBar          = transform.FindChild("Health Bar").gameObject.GetComponent <Slider> ();
     masterController   = transform.parent.parent.GetComponent <UIHealthController> ();
     healthBarFillImage = healthBar.transform.FindChild("Fill Area").FindChild("Fill").GetComponent <Image> ();
     //Make sure that the panels do not have any initial value.
     Clear();
 }