public static HealthModPopup CreateHealthModPopup(Transform _followTarget, float initialAmt) { //Static method to create an instance of a healthPopup GameObject newInstance = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/HealthModPopup")); HealthModPopup toRet = newInstance.GetComponent <HealthModPopup>(); toRet.InitializeOnTarget(_followTarget, initialAmt); return(toRet); }
public void ModHP(Transform target, float amt) { //ModHp, if first time called, create a new healthModPopup, otherwise, update the existing one if (healthPopupDict.ContainsKey(target)) { healthPopupDict[target].ModValue(amt); } else { healthPopupDict.Add(target, HealthModPopup.CreateHealthModPopup(target, amt)); } }