Esempio n. 1
0
 private void Hit()
 {
     if (target)
     {
         target.GetComponent <Health>().TakeDamage(weaponDamage);
     }
 }
Esempio n. 2
0
        private Vector3 GetAimLocation()
        {
            CapsuleCollider targetCapsule = target.GetComponent <CapsuleCollider>();

            if (targetCapsule == null)
            {
                return(target.transform.position);
            }
            return(target.transform.position + Vector3.up * targetCapsule.height / 2);
        }
Esempio n. 3
0
        /// <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);
        }