IKAttachParam.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using UnityEngine;
  3. namespace kt.ik
  4. {
  5. public class IKAttachParam
  6. {
  7. public IKAttachParam(Maid src_chara = null, Maid target_chara = null)
  8. {
  9. this.srcChara = src_chara;
  10. this.targetChara = target_chara;
  11. this.offsetEnable.Reset();
  12. }
  13. public int slotNo
  14. {
  15. get
  16. {
  17. return (!this.targetChara || !this.targetChara.body0.IsSlotNo(this.slotName)) ? -1 : this.targetChara.body0.GetSlotNo(this.slotName);
  18. }
  19. }
  20. public string axisBoneName
  21. {
  22. get
  23. {
  24. return (!this.axisBone) ? string.Empty : this.axisBone.name;
  25. }
  26. set
  27. {
  28. if (this.targetChara)
  29. {
  30. this.axisBone = this.targetChara.body0.GetBone(value);
  31. }
  32. }
  33. }
  34. public string targetBoneName
  35. {
  36. get
  37. {
  38. return (this.odoguObj || !this.attachTarget) ? string.Empty : this.attachTarget.name;
  39. }
  40. set
  41. {
  42. if (this.targetChara)
  43. {
  44. this.attachTarget = this.targetChara.body0.GetBone(value);
  45. }
  46. }
  47. }
  48. public GameObject odoguObj { get; private set; }
  49. public string odoguName
  50. {
  51. get
  52. {
  53. return (!this.odoguObj) ? string.Empty : this.odoguObj.name;
  54. }
  55. set
  56. {
  57. this.odoguObj = GameMain.Instance.BgMgr.GetPrefabFromBg(value);
  58. if (this.odoguObj && !this.attachTarget)
  59. {
  60. this.attachTarget = this.odoguObj.transform;
  61. }
  62. }
  63. }
  64. public string odoguTgtName
  65. {
  66. get
  67. {
  68. return (!this.odoguObj || !this.attachTarget) ? string.Empty : this.attachTarget.name;
  69. }
  70. set
  71. {
  72. if (!this.odoguObj)
  73. {
  74. return;
  75. }
  76. Transform exists = this.odoguObj.transform.Find(value);
  77. if (exists)
  78. {
  79. this.attachTarget = exists;
  80. }
  81. }
  82. }
  83. public string attachIKName
  84. {
  85. get
  86. {
  87. return this.AttachIKName;
  88. }
  89. set
  90. {
  91. if (!this.targetChara)
  92. {
  93. return;
  94. }
  95. this.AttachIKName = value;
  96. AIKCtrl ikctrl = this.targetChara.body0.fullBodyIK.GetIKCtrl(this.AttachIKName);
  97. if (ikctrl)
  98. {
  99. this.attachTarget = ikctrl.bone;
  100. }
  101. }
  102. }
  103. public Maid srcChara;
  104. public Maid targetChara;
  105. public AIKCtrl.IKAttachType attachType = AIKCtrl.IKAttachType.NewPoint;
  106. public AIKCtrl.IKExecTiming execTiming;
  107. public Transform attachTarget;
  108. public string slotName = string.Empty;
  109. public string attachPointName = string.Empty;
  110. public Transform axisBone;
  111. private string AttachIKName = string.Empty;
  112. public AIKCtrl.PosRotPair virtualPosRot = new AIKCtrl.PosRotPair(Vector3.zero, Quaternion.identity);
  113. public Vector3 offset = Vector3.zero;
  114. public bool doAnimation;
  115. public AIKCtrl.Vec3Enable offsetEnable;
  116. public float blendTime;
  117. public AIKCtrl.PosOffsetType posOffsetType;
  118. public bool bodyPull = true;
  119. }
  120. }