IKColliderMeta.cs 968 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using kt.Physics;
  4. using UnityEngine;
  5. public class IKColliderMeta : MonoBehaviour
  6. {
  7. private void OnDestroy()
  8. {
  9. this.AllColliderAction(delegate(ANativeColliderBase col)
  10. {
  11. UnityEngine.Object.Destroy(col);
  12. });
  13. }
  14. private void OnEnable()
  15. {
  16. this.AllColliderAction(delegate(ANativeColliderBase col)
  17. {
  18. col.enabled = true;
  19. });
  20. }
  21. private void OnDisable()
  22. {
  23. this.AllColliderAction(delegate(ANativeColliderBase col)
  24. {
  25. col.enabled = false;
  26. });
  27. }
  28. private void AllColliderAction(Action<ANativeColliderBase> action)
  29. {
  30. if (this.colliderList == null)
  31. {
  32. return;
  33. }
  34. foreach (ANativeColliderBase anativeColliderBase in this.colliderList)
  35. {
  36. if (anativeColliderBase && action != null)
  37. {
  38. action(anativeColliderBase);
  39. }
  40. }
  41. }
  42. [ReadOnly]
  43. public FullBodyIKMgr.IKEffectorType effectorType;
  44. public List<ANativeColliderBase> colliderList = new List<ANativeColliderBase>();
  45. }