123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using RootMotion.FinalIK;
- using UnityEngine;
- public class FullBodyIKCtrl : MonoBehaviour
- {
- private HeightIKCtrlData m_MouthIKData
- {
- get
- {
- return (!this.m_strIKDataPair.ContainsKey("口")) ? null : ((HeightIKCtrlData)this.m_strIKDataPair["口"]);
- }
- }
- public Transform BodyTarget { get; private set; }
- public bool IsUpdateEnd { get; private set; }
- public BodyCtrlData BodyCtrlData
- {
- get
- {
- return this.m_BodyCtrlData;
- }
- }
- public TBody TgtBody
- {
- get
- {
- return this.m_TgtBody;
- }
- }
- public Maid TgtMaid
- {
- get
- {
- return this.m_TgtBody.maid;
- }
- }
- public FullBodyBipedIK FullbodyIK
- {
- get
- {
- return this.m_FullbodyIK;
- }
- }
- public Transform IKTgtRoot
- {
- get
- {
- return this.m_IKTgtRoot;
- }
- }
- public IKEffector BodyEffector
- {
- get
- {
- return this.m_FullbodyIK.solver.bodyEffector;
- }
- }
- public Dictionary<string, IKCtrlData> strIKDataPair
- {
- get
- {
- return this.m_strIKDataPair;
- }
- }
- public bool IsIKExec
- {
- get
- {
- return this.m_strIKDataPair.Any((KeyValuePair<string, IKCtrlData> ik) => ik.Value.IsIKExec) && this.IKActive;
- }
- }
- public bool IsSelfIKAttach
- {
- get
- {
- return this.m_strIKDataPair.Any((KeyValuePair<string, IKCtrlData> ik) => ik.Value.IsSelfIKAttach) && this.IKActive;
- }
- }
- private void Update()
- {
- this.IsUpdateEnd = false;
- if (this.BodyCtrlData.IsIKExec && this.IKActive)
- {
- this.TgtMaid.SetPos(this.BodyCtrlData.OrijinMaidPos);
- if (this.BodyCtrlData.DoAllOffset)
- {
- GameMain.Instance.CharacterMgr.SetCharaAllPos(this.BodyCtrlData.OrijinAllPos);
- }
- }
- }
- private void OnDestroy()
- {
- if (this.m_IKTgtRoot)
- {
- UnityEngine.Object.Destroy(this.m_IKTgtRoot);
- }
- }
- private BodyCtrlData SafeAddBodyCtrlData(string key_str)
- {
- BodyCtrlData bodyCtrlData = new BodyCtrlData(this);
- if (this.m_strIKDataPair.ContainsKey(key_str))
- {
- this.m_strIKDataPair[key_str] = bodyCtrlData;
- }
- else
- {
- this.m_strIKDataPair.Add(key_str, bodyCtrlData);
- }
- this.m_BodyCtrlData = bodyCtrlData;
- return (BodyCtrlData)this.m_strIKDataPair[key_str];
- }
- private BipedIKCtrlData SafeAddFullbodyIKData(string key_str, string bend_key, string root_key, IKEffector effector, FBIKChain chain, IKMappingLimb ik_mapping, IKEffector sub_effector, bool use_old = false)
- {
- BipedIKCtrlData bipedIKCtrlData = new BipedIKCtrlData(effector, chain, ik_mapping, this, effector.bone, sub_effector, use_old);
- if (this.m_strIKDataPair.ContainsKey(key_str))
- {
- this.m_strIKDataPair[key_str] = bipedIKCtrlData;
- }
- else
- {
- this.m_strIKDataPair.Add(key_str, bipedIKCtrlData);
- }
- this.m_FullbodyDataList.Add(bipedIKCtrlData);
- this.m_ForearmCalfIKList.Add(bend_key, bipedIKCtrlData);
- this.m_SholderThighIKList.Add(root_key, bipedIKCtrlData);
- return (BipedIKCtrlData)this.m_strIKDataPair[key_str];
- }
- private CCDIKCtrlData SafeAddCCDIKData(string key_str, ref CCDIK ccd_ik, bool weight_fade, bool attach_ik, IKManager.BoneType boneType, bool affect_height)
- {
- if (ccd_ik)
- {
- UnityEngine.Object.DestroyImmediate(ccd_ik);
- }
- ccd_ik = this.IKTgtRoot.gameObject.AddComponent<CCDIK>();
- CCDIKCtrlData value = (!affect_height) ? new CCDIKCtrlData(ccd_ik, this.GetChainBonesToInit(boneType), this, weight_fade, attach_ik) : new HeightIKCtrlData(ccd_ik, this.GetChainBonesToInit(boneType), this, weight_fade, attach_ik);
- if (this.m_strIKDataPair.ContainsKey(key_str))
- {
- this.m_strIKDataPair[key_str] = value;
- }
- else
- {
- this.m_strIKDataPair.Add(key_str, value);
- }
- this.m_CCDDataList.Add((CCDIKCtrlData)this.m_strIKDataPair[key_str]);
- return (CCDIKCtrlData)this.m_strIKDataPair[key_str];
- }
- private FABRIKCtrlData SafeAddFABRIKData(string key_str, ref FABRIK fabr_ik, bool weight_fade, bool attach_ik, IKManager.BoneType boneType, bool affect_height)
- {
- if (fabr_ik)
- {
- UnityEngine.Object.DestroyImmediate(fabr_ik);
- }
- fabr_ik = this.IKTgtRoot.gameObject.AddComponent<FABRIK>();
- FABRIKCtrlData value = new FABRIKCtrlData(fabr_ik, this.GetChainBonesToInit(boneType), this, attach_ik);
- if (this.m_strIKDataPair.ContainsKey(key_str))
- {
- this.m_strIKDataPair[key_str] = value;
- }
- else
- {
- this.m_strIKDataPair.Add(key_str, value);
- }
- this.m_FABRDataList.Add((FABRIKCtrlData)this.m_strIKDataPair[key_str]);
- return (FABRIKCtrlData)this.m_strIKDataPair[key_str];
- }
- public void LateIKUpdate()
- {
- this.IKUpdate();
- this.TgtBody.AutoTwist();
- for (int i = 0; i < this.TgtBody.goSlot.Count; i++)
- {
- if (this.TgtBody.goSlot[i].obj != null)
- {
- this.TgtBody.goSlot[i].CopyTrans();
- }
- this.TgtBody.goSlot[i].Update();
- }
- }
- public void Init()
- {
- this.m_TgtBody = base.GetComponent<TBody>();
- if (!this.m_IKTgtRoot)
- {
- this.m_IKTgtRoot = new GameObject("IK Target Root").transform;
- this.m_IKTgtRoot.SetParent(this.m_TgtBody.m_trBones, false);
- }
- if (!this.TgtMaid.boMAN)
- {
- this.m_STRoot = this.m_TgtBody.m_trBones.Find("ST_Root");
- }
- if (this.m_FullbodyIK)
- {
- UnityEngine.Object.DestroyImmediate(this.m_FullbodyIK);
- }
- this.m_FullbodyIK = this.m_IKTgtRoot.gameObject.AddComponent<FullBodyBipedIK>();
- this.m_Mouth = new GameObject("Mouth").transform;
- this.m_Mouth.SetParent(this.TgtBody.trsHead, false);
- this.m_Mouth.localEulerAngles = new Vector3(-90f, 90f, 0f);
- if (!this.TgtMaid.boMAN)
- {
- this.m_NippleL = new GameObject("Nipple_L").transform;
- this.m_NippleL.SetParent(CMT.SearchObjName(this.TgtBody.m_trBones, "Mune_L_sub", true), false);
- this.m_NippleR = new GameObject("Nipple_R").transform;
- this.m_NippleR.SetParent(CMT.SearchObjName(this.TgtBody.m_trBones, "Mune_R_sub", true), false);
- }
- this.m_FullbodyDataList.Clear();
- this.m_CCDDataList.Clear();
- this.m_ForearmCalfIKList.Clear();
- this.m_FABRDataList.Clear();
- this.m_ForearmCalfIKList.Clear();
- this.m_SholderThighIKList.Clear();
- this.m_NameFlagObjpair.Clear();
- this.m_IKBoneDic = IKManager.CreateBoneDic(this.TgtMaid);
- this.m_FullbodyIK.references.root = this.m_TgtBody.m_trBones;
- this.m_FullbodyIK.references.pelvis = this.GetIKBone(IKManager.BoneType.Root);
- if (!this.TgtMaid.boMAN)
- {
- this.m_FullbodyIK.references.spine = new Transform[]
- {
- this.m_IKBoneDic[IKManager.BoneType.Spine0].Value.transform,
- this.m_IKBoneDic[IKManager.BoneType.Spine3].Value.transform
- };
- }
- else
- {
- this.m_FullbodyIK.references.spine = new Transform[]
- {
- this.m_IKBoneDic[IKManager.BoneType.Spine0].Value.transform,
- this.m_IKBoneDic[IKManager.BoneType.Spine2].Value.transform
- };
- }
- this.m_FullbodyIK.references.head = this.GetIKBone(IKManager.BoneType.Head);
- this.m_FullbodyIK.references.leftUpperArm = this.GetIKBone(IKManager.BoneType.UpperArm_L);
- this.m_FullbodyIK.references.leftForearm = this.GetIKBone(IKManager.BoneType.Forearm_L);
- this.m_FullbodyIK.references.leftHand = this.GetIKBone(IKManager.BoneType.Hand_L);
- this.m_FullbodyIK.references.rightUpperArm = this.GetIKBone(IKManager.BoneType.UpperArm_R);
- this.m_FullbodyIK.references.rightForearm = this.GetIKBone(IKManager.BoneType.Forearm_R);
- this.m_FullbodyIK.references.rightHand = this.GetIKBone(IKManager.BoneType.Hand_R);
- this.m_FullbodyIK.references.leftThigh = this.GetIKBone(IKManager.BoneType.Thigh_L);
- this.m_FullbodyIK.references.leftCalf = this.GetIKBone(IKManager.BoneType.Calf_L);
- this.m_FullbodyIK.references.leftFoot = this.GetIKBone(IKManager.BoneType.Foot_L);
- this.m_FullbodyIK.references.rightThigh = this.GetIKBone(IKManager.BoneType.Thigh_R);
- this.m_FullbodyIK.references.rightCalf = this.GetIKBone(IKManager.BoneType.Calf_R);
- this.m_FullbodyIK.references.rightFoot = this.GetIKBone(IKManager.BoneType.Foot_R);
- this.m_FullbodyIK.solver.SetToReferences(this.m_FullbodyIK.references, null);
- this.m_FullbodyIK.fixTransforms = false;
- foreach (IKEffector ikeffector in this.m_FullbodyIK.solver.effectors)
- {
- ikeffector.positionWeight = 0f;
- ikeffector.rotationWeight = 0f;
- }
- foreach (FBIKChain fbikchain in this.m_FullbodyIK.solver.chain)
- {
- fbikchain.bendConstraint.weight = 0f;
- }
- this.m_BodyCtrlData = this.SafeAddBodyCtrlData("体全体");
- this.SafeAddFullbodyIKData("左手", "左肘", "左肩", this.m_FullbodyIK.solver.leftHandEffector, this.m_FullbodyIK.solver.leftArmChain, this.m_FullbodyIK.solver.leftArmMapping, this.m_FullbodyIK.solver.leftShoulderEffector, true);
- this.SafeAddFullbodyIKData("右手", "右肘", "右肩", this.m_FullbodyIK.solver.rightHandEffector, this.m_FullbodyIK.solver.rightArmChain, this.m_FullbodyIK.solver.rightArmMapping, this.m_FullbodyIK.solver.rightShoulderEffector, true);
- this.SafeAddFullbodyIKData("左足", "左膝", "左腿", this.m_FullbodyIK.solver.leftFootEffector, this.m_FullbodyIK.solver.leftLegChain, this.m_FullbodyIK.solver.leftLegMapping, this.m_FullbodyIK.solver.leftThighEffector, false);
- this.SafeAddFullbodyIKData("右足", "右膝", "右腿", this.m_FullbodyIK.solver.rightFootEffector, this.m_FullbodyIK.solver.rightLegChain, this.m_FullbodyIK.solver.rightLegMapping, this.m_FullbodyIK.solver.rightThighEffector, false);
- this.GetIKData<BipedIKCtrlData>("左足", false).Chain.pull = 0f;
- this.GetIKData<BipedIKCtrlData>("右足", false).Chain.pull = 0f;
- this.SafeAddCCDIKData("口", ref this.m_MouthIK, true, true, IKManager.BoneType.Mouth, true);
- if (!this.BodyTarget)
- {
- Transform transform = this.m_IKTgtRoot.Find(this.BodyEffector.bone.name);
- transform = new GameObject(this.BodyEffector.bone.name).transform;
- transform.SetParent(this.m_IKTgtRoot, false);
- this.BodyTarget = new GameObject("IKTarget").transform;
- this.BodyTarget.SetParent(transform, false);
- }
- this.BodyEffector.target = this.BodyTarget;
- this.BodyEffector.effectChildNodes = false;
- this.m_FullbodyIK.enabled = false;
- }
- public void IKUpdate()
- {
- if (this.TgtMaid.boMAN)
- {
- this.m_Mouth.localPosition = new Vector3(-0.013f, 0.1115f, 0f);
- }
- else
- {
- this.AttachPointTransCpy(this.m_Mouth, "head", "歯", false);
- this.AttachPointTransCpy(this.m_NippleL, "body", "乳首左", false);
- this.AttachPointTransCpy(this.m_NippleR, "body", "乳首右", false);
- }
- this.BodyEffector.positionWeight = 0f;
- this.BodyTarget.position = this.BodyEffector.bone.position;
- this.DoHeightCover = false;
- this.IsUpdateLate = false;
- foreach (IKCtrlData ikctrlData in this.m_strIKDataPair.Values)
- {
- ikctrlData.ApplyIKSetting();
- }
- if (!this.IsUpdateLate && (this.IsIKExec || this.AllForceIK))
- {
- this.SolverUpdate();
- }
- }
- public void SolverUpdate()
- {
- this.IsUpdateEnd = true;
- Action postSolverUpdate = this.PostSolverUpdate;
- this.PostSolverUpdate = null;
- if (this.IKActive)
- {
- if (this.BodyCtrlData.IsIKExec)
- {
- this.BodyCtrlData.Update();
- }
- bool flag = this.m_FullbodyDataList.Any((BipedIKCtrlData data) => data.IsIKExec && !data.OldIkExec);
- if (this.m_MouthIKData.IsIKExec)
- {
- this.m_MouthIKData.Update();
- }
- flag |= (this.BodyEffector.positionWeight == 1f);
- if (flag)
- {
- Vector3 localPosition = this.m_FullbodyIK.references.spine[1].localPosition;
- this.m_FullbodyIK.solver.Update();
- this.m_FullbodyIK.references.spine[1].localPosition = localPosition;
- }
- }
- foreach (IKCtrlData ikctrlData in this.m_strIKDataPair.Values)
- {
- ikctrlData.LateUpdate();
- }
- if (this.IKActive && postSolverUpdate != null)
- {
- postSolverUpdate();
- }
- }
- public void AttachPointTransCpy(Transform trans, string slot_name, string attach_name, bool scale_cpy = false)
- {
- int slotNo = this.TgtBody.GetSlotNo(slot_name);
- if (this.TgtBody.goSlot[slotNo].morph == null)
- {
- return;
- }
- Vector3 position;
- Quaternion rotation;
- Vector3 localScale;
- this.TgtBody.goSlot[slotNo].morph.GetAttachPoint(attach_name, out position, out rotation, out localScale, false);
- trans.position = position;
- trans.rotation = rotation;
- if (scale_cpy)
- {
- trans.localScale = localScale;
- }
- }
- public Transform GetIKBone(IKManager.BoneType boneType)
- {
- return (!this.m_IKBoneDic.ContainsKey(boneType)) ? null : this.m_IKBoneDic[boneType].Value.transform;
- }
- public Transform[] GetChainBonesToInit(IKManager.BoneType boneType)
- {
- Transform[] result = new Transform[0];
- switch (boneType)
- {
- case IKManager.BoneType.Forearm_R:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Clavicle_R),
- this.GetIKBone(IKManager.BoneType.UpperArm_R),
- this.GetIKBone(IKManager.BoneType.Forearm_R)
- };
- break;
- case IKManager.BoneType.Hand_R:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.UpperArm_R),
- this.GetIKBone(IKManager.BoneType.Forearm_R),
- this.GetIKBone(IKManager.BoneType.Hand_R)
- };
- break;
- default:
- switch (boneType)
- {
- case IKManager.BoneType.Head:
- if (!this.TgtMaid.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Spine3),
- this.GetIKBone(IKManager.BoneType.Neck),
- this.GetIKBone(IKManager.BoneType.Head)
- };
- }
- else
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Neck),
- this.GetIKBone(IKManager.BoneType.Head)
- };
- }
- break;
- case IKManager.BoneType.Neck:
- if (!this.TgtMaid.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Spine3),
- this.GetIKBone(IKManager.BoneType.Neck)
- };
- }
- else
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Neck)
- };
- }
- break;
- default:
- switch (boneType)
- {
- case IKManager.BoneType.Mouth:
- if (!this.TgtMaid.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Spine3),
- this.GetIKBone(IKManager.BoneType.Neck),
- this.GetIKBone(IKManager.BoneType.Head),
- this.GetIKBone(IKManager.BoneType.Mouth)
- };
- }
- else
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Neck),
- this.GetIKBone(IKManager.BoneType.Head),
- this.GetIKBone(IKManager.BoneType.Mouth)
- };
- }
- break;
- case IKManager.BoneType.Nipple_L:
- if (!this.TgtMaid.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Bust_L),
- this.GetIKBone(IKManager.BoneType.Bust_L_Sub),
- this.GetIKBone(IKManager.BoneType.Nipple_L)
- };
- }
- break;
- case IKManager.BoneType.Nipple_R:
- if (!this.TgtMaid.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Bust_R),
- this.GetIKBone(IKManager.BoneType.Bust_R_Sub),
- this.GetIKBone(IKManager.BoneType.Nipple_R)
- };
- }
- break;
- }
- break;
- case IKManager.BoneType.Spine2:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2)
- };
- break;
- case IKManager.BoneType.Spine3:
- if (!this.TgtMaid.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Spine0),
- this.GetIKBone(IKManager.BoneType.Spine1),
- this.GetIKBone(IKManager.BoneType.Spine2),
- this.GetIKBone(IKManager.BoneType.Spine3)
- };
- }
- break;
- }
- break;
- case IKManager.BoneType.Calf_R:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Thigh_R),
- this.GetIKBone(IKManager.BoneType.Calf_R)
- };
- break;
- case IKManager.BoneType.Foot_R:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Thigh_R),
- this.GetIKBone(IKManager.BoneType.Calf_R),
- this.GetIKBone(IKManager.BoneType.Foot_R)
- };
- break;
- case IKManager.BoneType.Forearm_L:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Clavicle_L),
- this.GetIKBone(IKManager.BoneType.UpperArm_L),
- this.GetIKBone(IKManager.BoneType.Forearm_L)
- };
- break;
- case IKManager.BoneType.Hand_L:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.UpperArm_L),
- this.GetIKBone(IKManager.BoneType.Forearm_L),
- this.GetIKBone(IKManager.BoneType.Hand_L)
- };
- break;
- case IKManager.BoneType.Calf_L:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Thigh_L),
- this.GetIKBone(IKManager.BoneType.Calf_L)
- };
- break;
- case IKManager.BoneType.Foot_L:
- result = new Transform[]
- {
- this.GetIKBone(IKManager.BoneType.Thigh_L),
- this.GetIKBone(IKManager.BoneType.Calf_L),
- this.GetIKBone(IKManager.BoneType.Foot_L)
- };
- break;
- }
- return result;
- }
- public IKCtrlData GetIKData(string tag_name, bool flagcheck = false)
- {
- if (this.m_strIKDataPair.ContainsKey(tag_name))
- {
- return this.m_strIKDataPair[tag_name];
- }
- if (this.m_ForearmCalfIKList.ContainsKey(tag_name))
- {
- if (flagcheck)
- {
- this.m_ForearmCalfIKList[tag_name].IsBendIK = true;
- }
- return this.m_ForearmCalfIKList[tag_name];
- }
- if (this.m_SholderThighIKList.ContainsKey(tag_name))
- {
- if (flagcheck)
- {
- this.m_SholderThighIKList[tag_name].IsRootIK = true;
- }
- return this.m_SholderThighIKList[tag_name];
- }
- return null;
- }
- public T GetIKData<T>(string tag_name, bool flagcheck = false) where T : IKCtrlData
- {
- IKCtrlData ikdata = this.GetIKData(tag_name, flagcheck);
- if (ikdata != null && ikdata is T)
- {
- return ikdata as T;
- }
- return (T)((object)null);
- }
- public Transform GetSTFlagObj(string name)
- {
- if (this.m_NameFlagObjpair.ContainsKey(name))
- {
- return this.m_NameFlagObjpair[name];
- }
- Transform transform = this.m_STRoot.Find(name);
- if (!transform)
- {
- transform = this.TgtBody.GetBone(name);
- if (!transform)
- {
- Debug.LogErrorFormat("{0}は存在しません", new object[]
- {
- name
- });
- return null;
- }
- }
- this.m_NameFlagObjpair.Add(name, transform);
- return transform;
- }
- [SerializeField]
- private TBody m_TgtBody;
- [SerializeField]
- private Transform m_IKTgtRoot;
- [SerializeField]
- private Transform m_STRoot;
- [SerializeField]
- private FullBodyBipedIK m_FullbodyIK;
- private CCDIK m_MouthIK;
- private CCDIK m_MuneLIK;
- private CCDIK m_MuneRIK;
- private FABRIK m_ForearmLIK;
- private FABRIK m_ForearmRIK;
- private FABRIK m_CalfLIK;
- private FABRIK m_CalfRIK;
- private Dictionary<IKManager.BoneType, KeyValuePair<IKManager.BoneSetType, GameObject>> m_IKBoneDic = new Dictionary<IKManager.BoneType, KeyValuePair<IKManager.BoneSetType, GameObject>>();
- [SerializeField]
- private BodyCtrlData m_BodyCtrlData;
- [SerializeField]
- private List<BipedIKCtrlData> m_FullbodyDataList = new List<BipedIKCtrlData>();
- [SerializeField]
- private List<CCDIKCtrlData> m_CCDDataList = new List<CCDIKCtrlData>();
- [SerializeField]
- private List<FABRIKCtrlData> m_FABRDataList = new List<FABRIKCtrlData>();
- private Transform m_NippleL;
- private Transform m_NippleR;
- private Transform m_Mouth;
- private Dictionary<string, IKCtrlData> m_strIKDataPair = new Dictionary<string, IKCtrlData>();
- private Dictionary<string, BipedIKCtrlData> m_ForearmCalfIKList = new Dictionary<string, BipedIKCtrlData>();
- private Dictionary<string, BipedIKCtrlData> m_SholderThighIKList = new Dictionary<string, BipedIKCtrlData>();
- private Dictionary<string, Transform> m_NameFlagObjpair = new Dictionary<string, Transform>();
- public bool IKActive = true;
- public bool DoHeightCover;
- public bool IsUpdateLate;
- public Action PostSolverUpdate;
- public bool AllForceIK;
- public float BlendTime = 0.5f;
- }
|