Guest User

Untitled

a guest
Mar 30th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. public void Flinched(HitboxFistState damagingHit)
  2. {
  3. if (damagingHit == null) { return; } // (like, really? I hope not)
  4. if (GetCurAnim() == launchHash) { return; } // (flinches should never override launches, animation-wise)
  5. // @TODO: We'll eventually need to consider how this interacts with knockback/slide anim, if at all
  6.  
  7. // First, we calculate the jiggle bone. Hee hee. Jiggle bone. (the bone we jiggle about... huhuhu)
  8. if (jiggleBone != null)
  9. {
  10. jiggleElapsedTime = 0.0f;
  11.  
  12. // 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.
  13. int curAnimHash = GetCurAnim();
  14. if (curAnimHash != impactHash) { jiggleBoneRot = jiggleBone.transform.localRotation; }
  15.  
  16. jiggleAxis = GetPerpSpinAxis(damagingHit, jiggleBone);
  17. }
  18.  
  19. // Now that we've done all the bone calculating, THEN we can play the animation (that might influence those bones)
  20. PlayAnim(impactHash);
  21.  
  22. // Also MAKE SOME NOOOOOISE
  23. if ((painSounds.Length > 0) && (audioSource != null))
  24. {
  25. audioSource.Stop();
  26. audioSource.time = 0.0f;
  27. audioSource.clip = painSounds[Random.Range(0, painSounds.Length)];
  28. audioSource.Play();
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment