public override bool PickUp(MonoBehaviour pickuper) { // If something that can be healed picked this up, heal it IHasHP toHeal = pickuper as IHasHP; bool healPickuper = toHeal != null; if (healPickuper) { toHeal.TakeHealing(healAmount); } PickedUp.Invoke(); return(true); }
// ========================================================================== // /* public - [Do] Function * 외부 객체가 호출(For External class call)*/ public void DoInit(IHasHP pDrawTarget, Transform pTransform_UI_HPBar_Pos) { _pDrawTarget = pDrawTarget; _pDrawTarget.p_Event_OnResetHP.Subscribe += OnResetHP; _pDrawTarget.p_Event_OnDamage.Subscribe += OnChangeHP; _pDrawTarget.p_Event_OnDead.Subscribe += Event_OnDead; _pTransform_UI_HPBar_Pos = pTransform_UI_HPBar_Pos; if (_pTransform_UI_HPBar_Pos != null) { transform.position = _pTransform_UI_HPBar_Pos.position; } if (p_bIsShow_OnChangeHPOnly) { SetEnable_Renderer(false); } }
protected override void OnDisableObject(bool bIsQuitApplciation) { base.OnDisableObject(bIsQuitApplciation); if (bIsQuitApplciation) { return; } _pTransform_UI_HPBar_Pos = null; if (_pDrawTarget != null) { _pDrawTarget.p_Event_OnResetHP.DoRemove_Listener(OnResetHP); _pDrawTarget.p_Event_OnDamage.DoRemove_Listener(OnChangeHP); _pDrawTarget.p_Event_OnDead.DoRemove_Listener(Event_OnDead); _pDrawTarget = null; } }
private void Awake() { text = GetComponent <Text>(); hasHp = obj.GetComponent <IHasHP>(); }
public virtual void Use(IHasHP target) { target.TakeHealing(healAmount); }
private void Event_OnDead(IHasHP pHasHP) { gameObject.SetActive(false); }