void OnTriggerEnter(Collider triggerCollider) { ISmashable smashable = GetFirstSmashableFromCollider(triggerCollider); if (smashable == null) { return; } Vector3 smashVelocity, sliceVelocity; hand.GetEstimatedPeakVelocities(out smashVelocity, out sliceVelocity); SmashInfo info = new SmashInfo { fist = this, smashing = true, handIndex = handIndex, shape = handShape, posiion = transform.position, // for fist smashing, use fist position rotation = transform.rotation, // for staff slice, use rotation smashVelocity = smashVelocity, sliceVelocity = sliceVelocity }; smashable.SmashHit(info); }
void OnTriggerExit(Collider triggerCollider) { ISmashable smashable = GetFirstSmashableFromCollider(triggerCollider); if (smashable == null) { return; } SmashInfo info = new SmashInfo { fist = this, smashing = false, handIndex = handIndex, shape = handShape, posiion = transform.position, // for fist smashing, use fist position rotation = transform.rotation, // for staff slice, use rotation smashVelocity = Vector3.zero, sliceVelocity = Vector3.zero }; smashable.SmashHit(info); }