private void Hit() { if (target) { target.GetComponent <Health>().TakeDamage(weaponDamage); } }
private Vector3 GetAimLocation() { CapsuleCollider targetCapsule = target.GetComponent <CapsuleCollider>(); if (targetCapsule == null) { return(target.transform.position); } return(target.transform.position + Vector3.up * targetCapsule.height / 2); }
/// <summary> /// /// To define where the hit effect should be generated. /// /// </summary> /// <returns> /// Where are the effect generated. /// </returns> private Vector3 GetEffectLocation() { CapsuleCollider targetCollider = attackTarget.GetComponent <CapsuleCollider>(); if (targetCollider) { return(attackTarget.transform.position + Vector3.up * targetCollider.height / 2); } return(attackTarget.transform.position); }