Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Flinched(HitboxFistState damagingHit)
- {
- if (damagingHit == null) { return; } // (like, really? I hope not)
- if (GetCurAnim() == launchHash) { return; } // (flinches should never override launches, animation-wise)
- // @TODO: We'll eventually need to consider how this interacts with knockback/slide anim, if at all
- // First, we calculate the jiggle bone. Hee hee. Jiggle bone. (the bone we jiggle about... huhuhu)
- if (jiggleBone != null)
- {
- jiggleElapsedTime = 0.0f;
- // Don't overwrite the neutral bone rotation with a mid-jiggle rotation, that'll result in some really odd, twisty jiggles from multiple impacts. We want it to be readable.
- int curAnimHash = GetCurAnim();
- if (curAnimHash != impactHash) { jiggleBoneRot = jiggleBone.transform.localRotation; }
- jiggleAxis = GetPerpSpinAxis(damagingHit, jiggleBone);
- }
- // Now that we've done all the bone calculating, THEN we can play the animation (that might influence those bones)
- PlayAnim(impactHash);
- // Also MAKE SOME NOOOOOISE
- if ((painSounds.Length > 0) && (audioSource != null))
- {
- audioSource.Stop();
- audioSource.time = 0.0f;
- audioSource.clip = painSounds[Random.Range(0, painSounds.Length)];
- audioSource.Play();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment