/// <summary> /// Target a given actor. /// </summary> /// <param name="gameObject"></param> public void Target(GameObject gameObject) { _worldActorStats = gameObject.GetComponent <WorldActorStats>(); // Re-activate TargetUIContainer.SetActive(false); _name.SetActive(true); // Update values TargetedObjectHealth.GetComponent <Slider>().maxValue = _worldActorStats.MaxHealth; TargetedObjectHealth.GetComponent <Slider>().value = _worldActorStats.Health; _name.GetComponent <Text>().text = _worldActorStats.Name; _fill.GetComponent <Image>().color = Color.red; }
public void Cancel(Guid?id) { // If passing in no target or // a target that matches the currently targeted WorldActor, // then cancel if (!id.HasValue || (_worldActorStats != null && id.HasValue && _worldActorStats.Id == id)) { _worldActorStats = null; // De-activate TargetUIContainer.SetActive(false); _name.SetActive(false); } }