private void SetTargetHUD() { myTargetHUD.Show(); myTarget.GetComponent <Health>().EventOnHealthChange += ChangeTargetHudHealth; ChangeTargetHudHealth(myTarget.GetComponent <Health>().GetHealthPercentage(), myTarget.GetComponent <Health>().myCurrentHealth.ToString() + "/" + myTarget.GetComponent <Health>().MaxHealth, myTarget.GetComponent <Health>().GetTotalShieldValue()); if (myTarget.GetComponent <Resource>() != null) { myTarget.GetComponent <Resource>().EventOnResourceChange += ChangeTargetHudResource; ChangeTargetHudResource(myTarget.GetComponent <Resource>().GetResourcePercentage(), myTarget.GetComponent <Resource>().myCurrentResource.ToString() + "/" + myTarget.GetComponent <Resource>().MaxResource); myTargetHUD.SetResourceBarColor(myTarget.GetComponent <Resource>().myResourceColor); } else { ChangeTargetHudResource(0.0f, "0/0"); } if (myTarget.tag == "Enemy") { myTargetHUD.SetName(myTarget.name); myTargetHUD.SetNameColor(Color.red); } else if (myTarget.tag == "Player") { if (myTarget.GetComponent <PlayerCharacter>() != null) { myTargetHUD.SetName(myTarget.GetComponent <PlayerCharacter>().Name); } myTargetHUD.SetNameColor(new Color(120f / 255f, 1.0f, 0.0f)); } }
private void ManualStart() { myHealth.EventOnHealthChange += ChangeMyHudHealth; myHealth.EventOnHealthZero += OnDeath; ChangeMyHudHealth(myHealth.GetHealthPercentage(), myHealth.myCurrentHealth.ToString() + "/" + myHealth.myMaxHealth.ToString(), GetComponent <Health>().GetTotalShieldValue()); myResource.EventOnResourceChange += ChangeMyHudResource; ChangeMyHudResource(myResource.GetResourcePercentage(), myResource.myCurrentResource.ToString() + "/" + myResource.MaxResource.ToString()); myClass.SetupSpellHud(CastSpell); myCharacterHUD.SetName(myName + " (" + myClass.myClassName + ")"); myCharacterHUD.Show(); }