public void takeHit(float power, HitBox hit) { KnockBackAble nba = m_ObjectOwner.GetComponent<KnockBackAble>(); if (nba) { Vector3 dir = m_ObjectOwner.transform.position - hit.transform.position; nba.Knockback(power, dir); } KnockUpAble nua = m_ObjectOwner.GetComponent<KnockUpAble>(); if (nua) { Vector3 dir = m_ObjectOwner.transform.position - hit.transform.position; nua.Knockback(power); } Damageable da = m_ObjectOwner.GetComponent<Damageable>(); if (da) { da.injury(power); } NotifiedHit not = m_ObjectOwner.GetComponent<NotifiedHit>(); if (not) { not.notifyHit(); } }
// Use this for initialization void Start() { m_rigidbody = GetComponent <Rigidbody>(); m_animator = GetComponent <Animator>(); m_hitbox = GetComponentInChildren <HitBox>(); m_notifiedHit = GetComponent <NotifiedHit>(); }
// Use this for initialization void Start() { newRanDirection(); newRanTargetLocation(); m_notifiedHit = GetComponent <NotifiedHit>(); }
private void Start() { m_notifiedHit = GetComponent <NotifiedHit>(); }