123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using kt;
- using kt.ik;
- using kt.Physics;
- using kt.Utility;
- using RootMotion.FinalIK;
- using UnityEngine;
- public class FullBodyIKMgr : MonoBehaviour
- {
- public TBody body
- {
- get
- {
- return this.Body;
- }
- }
- public Maid chara
- {
- get
- {
- return this.body.maid;
- }
- }
- public Transform ikTargetRoot
- {
- get
- {
- return this.IKTargetRoot;
- }
- }
- public FullBodyBipedIK ik
- {
- get
- {
- return this.IK;
- }
- }
- public IKEffector bodyEffector
- {
- get
- {
- return this.ik.solver.bodyEffector;
- }
- }
- public IKBodyOffsetCtrl bodyOffsetCtrl
- {
- get
- {
- return this.BodyOffsetCtrl;
- }
- }
- public Dictionary<string, AIKCtrl> strIKCtrlPair
- {
- get
- {
- return this.StrIKCtrlPair;
- }
- }
- public float blendTime
- {
- get
- {
- return this.BlendTime;
- }
- set
- {
- this.BlendTime = value;
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- aikctrl.blendTime = value;
- }
- }
- }
- public bool isUpdateEnd { get; private set; }
- public bool isIKExec
- {
- get
- {
- bool result;
- if (this.isIKActive)
- {
- result = this.strIKCtrlPair.Any((KeyValuePair<string, AIKCtrl> ik) => ik.Value.isIKExec);
- }
- else
- {
- result = false;
- }
- return result;
- }
- }
- public bool isNeedAttachTargetUpdatePreExec
- {
- get
- {
- bool result;
- if (this.isIKActive)
- {
- result = this.strIKCtrlPair.Any((KeyValuePair<string, AIKCtrl> ik) => ik.Value.isNeedAttachTargetUpdatePreExec);
- }
- else
- {
- result = false;
- }
- return result;
- }
- }
- public Transform planeColliderTrans { get; private set; }
- public float floorColliderY
- {
- get
- {
- return this.FloorColliderY;
- }
- set
- {
- this.FloorColliderY = value;
- Vector3 localPosition = this.planeColliderTrans.localPosition;
- localPosition.y = this.FloorColliderY;
- this.planeColliderTrans.localPosition = localPosition;
- }
- }
- public bool floorColliderEnable
- {
- set
- {
- foreach (NativePlaneCollider nativePlaneCollider in this.FloorColliderList)
- {
- if (nativePlaneCollider)
- {
- nativePlaneCollider.enabled = value;
- }
- }
- }
- }
- public float wallColliderZ
- {
- get
- {
- return this.WallColliderZ;
- }
- set
- {
- this.WallColliderZ = value;
- Vector3 localPosition = this.planeColliderTrans.localPosition;
- localPosition.z = this.WallColliderZ;
- this.planeColliderTrans.localPosition = localPosition;
- }
- }
- public bool wallColliderEnable
- {
- set
- {
- foreach (NativePlaneCollider nativePlaneCollider in this.WallColliderList)
- {
- if (nativePlaneCollider)
- {
- nativePlaneCollider.enabled = value;
- }
- }
- }
- }
- public bool wallDirectionInverse
- {
- set
- {
- foreach (NativePlaneCollider nativePlaneCollider in this.WallColliderList)
- {
- if (nativePlaneCollider)
- {
- nativePlaneCollider.planeStatus.isDirectionInverse = value;
- }
- }
- }
- }
- public FullBodyIKMgr.BoneCrossBorder upperCrossBorder { get; private set; }
- public bool upperBorderEnable
- {
- get
- {
- return this.upperCrossBorder.left.enabled && this.upperCrossBorder.right.enabled;
- }
- set
- {
- Behaviour left = this.upperCrossBorder.left;
- this.upperCrossBorder.right.enabled = value;
- left.enabled = value;
- }
- }
- public FullBodyIKMgr.BoneCrossBorder lowerCrossBorder { get; private set; }
- public bool lowerBorderEnable
- {
- get
- {
- return this.lowerCrossBorder.left.enabled && this.lowerCrossBorder.right.enabled;
- }
- set
- {
- Behaviour left = this.lowerCrossBorder.left;
- this.lowerCrossBorder.right.enabled = value;
- left.enabled = value;
- }
- }
- public HashSet<Maid> partnerList
- {
- get
- {
- return this.PartnerList;
- }
- }
- public IKColliderSaveLoader colliderLoader { get; private set; }
- public void Init()
- {
- this.Body = base.GetComponent<TBody>();
- this.DestroyIKObject();
- this.IKTargetRoot = new GameObject("IK Target Root").transform;
- this.IKTargetRoot.SetParent(this.Body.m_trBones, false);
- if (this.body.IsCrcBody)
- {
- this.STRoot = this.Body.m_trBones.Find("ST_Root");
- }
- else if (!this.chara.boMAN)
- {
- this.STRoot = this.Body.m_trBones.Find("ST_Root");
- }
- this.PlaneColiderSetUp();
- if (this.body.IsCrcBody && !this.colliderLoader)
- {
- this.colliderLoader = this.IKTargetRoot.gameObject.AddComponent<IKColliderSaveLoader>();
- }
- this.IK = this.IKTargetRoot.gameObject.AddComponent<FullBodyBipedIK>();
- this.Mouth = new GameObject("Mouth").transform;
- this.Mouth.SetParent(this.body.trsHead, false);
- this.Mouth.localEulerAngles = new Vector3(-90f, 90f, 0f);
- if (!this.chara.boMAN)
- {
- this.NippleL = new GameObject("Nipple_L").transform;
- this.NippleL.SetParent(CMT.SearchObjName(this.body.m_trBones, "Mune_L_sub", true), false);
- this.NippleR = new GameObject("Nipple_R").transform;
- this.NippleR.SetParent(CMT.SearchObjName(this.body.m_trBones, "Mune_R_sub", true), false);
- }
- this.NameFlagObjpair.Clear();
- this.partnerList.Clear();
- this.IKBoneDic = FullBodyIKMgr.GetAllIKBoneDic(this.chara);
- this.IK.references.root = this.Body.m_trBones;
- this.IK.references.pelvis = this.GetIKBone(FullBodyIKMgr.IKBoneType.Root);
- if (this.body.IsCrcBody)
- {
- this.IK.references.spine = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine0),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3)
- };
- }
- else if (!this.chara.boMAN)
- {
- this.IK.references.spine = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine0),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3)
- };
- }
- else
- {
- this.IK.references.spine = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine0),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2)
- };
- }
- this.IK.references.head = this.GetIKBone(FullBodyIKMgr.IKBoneType.Head);
- this.IK.references.leftUpperArm = this.GetIKBone(FullBodyIKMgr.IKBoneType.UpperArm_L);
- this.IK.references.leftForearm = this.GetIKBone(FullBodyIKMgr.IKBoneType.Forearm_L);
- this.IK.references.leftHand = this.GetIKBone(FullBodyIKMgr.IKBoneType.Hand_L);
- this.IK.references.rightUpperArm = this.GetIKBone(FullBodyIKMgr.IKBoneType.UpperArm_R);
- this.IK.references.rightForearm = this.GetIKBone(FullBodyIKMgr.IKBoneType.Forearm_R);
- this.IK.references.rightHand = this.GetIKBone(FullBodyIKMgr.IKBoneType.Hand_R);
- this.IK.references.leftThigh = this.GetIKBone(FullBodyIKMgr.IKBoneType.Thigh_L);
- this.IK.references.leftCalf = this.GetIKBone(FullBodyIKMgr.IKBoneType.Calf_L);
- this.IK.references.leftFoot = this.GetIKBone(FullBodyIKMgr.IKBoneType.Foot_L);
- this.IK.references.rightThigh = this.GetIKBone(FullBodyIKMgr.IKBoneType.Thigh_R);
- this.IK.references.rightCalf = this.GetIKBone(FullBodyIKMgr.IKBoneType.Calf_R);
- this.IK.references.rightFoot = this.GetIKBone(FullBodyIKMgr.IKBoneType.Foot_R);
- this.IK.solver.SetToReferences(this.IK.references, null);
- this.IK.fixTransforms = false;
- foreach (IKEffector ikeffector in this.IK.solver.effectors)
- {
- ikeffector.positionWeight = 0f;
- ikeffector.rotationWeight = 0f;
- }
- foreach (FBIKChain fbikchain in this.IK.solver.chain)
- {
- fbikchain.bendConstraint.weight = 0f;
- }
- this.BodyOffsetCtrl = this.AddBodyCtrl();
- if (this.body.IsCrcBody)
- {
- this.AddFreeFBIKCtrl(FullBodyIKMgr.IKEffectorType.Head, true, FullBodyIKMgr.IKBoneType.Neck);
- this.AddMouthIKCtrl();
- if (!this.chara.boMAN)
- {
- this.AddMuneIKCtrl(FullBodyIKMgr.IKEffectorType.Bust_L);
- this.AddMuneIKCtrl(FullBodyIKMgr.IKEffectorType.Bust_R);
- }
- else
- {
- this.AddPenisIKCtrl();
- }
- }
- this.IK.solver.GetChain(FullBodyBipedChain.LeftLeg).pull = 0f;
- this.IK.solver.GetChain(FullBodyBipedChain.RightLeg).pull = 0f;
- this.AddLimbIKCtrl(FullBodyIKMgr.IKEffectorType.Hand_L, FullBodyIKMgr.IKEffectorType.Forearm_L, FullBodyIKMgr.IKEffectorType.UpperArm_L, FullBodyBipedEffector.LeftHand, FullBodyBipedEffector.LeftShoulder);
- this.AddLimbIKCtrl(FullBodyIKMgr.IKEffectorType.Hand_R, FullBodyIKMgr.IKEffectorType.Forearm_R, FullBodyIKMgr.IKEffectorType.UpperArm_R, FullBodyBipedEffector.RightHand, FullBodyBipedEffector.RightShoulder);
- this.AddLimbIKCtrl(FullBodyIKMgr.IKEffectorType.Foot_L, FullBodyIKMgr.IKEffectorType.Calf_L, FullBodyIKMgr.IKEffectorType.Thigh_L, FullBodyBipedEffector.LeftFoot, FullBodyBipedEffector.LeftThigh);
- this.AddLimbIKCtrl(FullBodyIKMgr.IKEffectorType.Foot_R, FullBodyIKMgr.IKEffectorType.Calf_R, FullBodyIKMgr.IKEffectorType.Thigh_R, FullBodyBipedEffector.RightFoot, FullBodyBipedEffector.RightThigh);
- if (this.body.IsCrcBody)
- {
- this.colliderLoader.fullbodyIK = this;
- this.colliderLoader.fileName = (this.chara.boMAN ? "manIKCollider.ikcol" : "maidIKCollider.ikcol");
- this.colliderLoader.ColliderLoad();
- }
- if (!this.bodyEffector.target)
- {
- string name2 = this.bodyEffector.bone.name + "_Target";
- Transform transform = this.ikTargetRoot.Find(name2);
- if (!transform)
- {
- transform = new GameObject(name2).transform;
- }
- transform.SetParent(this.IKTargetRoot, false);
- this.bodyEffector.target = new GameObject("IKTarget").transform;
- this.bodyEffector.target.SetParent(transform, false);
- }
- this.bodyEffector.effectChildNodes = false;
- this.IK.enabled = false;
- if (this.body.IsCrcBody)
- {
- Func<string, Transform, FullBodyIKMgr.BoneCrossBorder> func = delegate(string name, Transform parent)
- {
- GameObject gameObject = new GameObject(name);
- gameObject.transform.SetParent(parent, false);
- NativePlaneCollider nativePlaneCollider = gameObject.AddComponent<NativePlaneCollider>();
- nativePlaneCollider.planeStatus.direction = MathUtility.VectorType.Z;
- NativePlaneCollider nativePlaneCollider2 = gameObject.AddComponent<NativePlaneCollider>();
- nativePlaneCollider2.planeStatus.direction = MathUtility.VectorType.Z;
- nativePlaneCollider2.planeStatus.isDirectionInverse = true;
- Behaviour behaviour = nativePlaneCollider;
- bool enabled = false;
- nativePlaneCollider2.enabled = enabled;
- behaviour.enabled = enabled;
- return new FullBodyIKMgr.BoneCrossBorder(nativePlaneCollider, nativePlaneCollider2);
- };
- this.upperCrossBorder = func("UpperBody_Border", this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3));
- this.lowerCrossBorder = func("LowerBody_Border", this.GetIKBone(FullBodyIKMgr.IKBoneType.Pelvis));
- }
- }
- private IKBodyOffsetCtrl AddBodyCtrl()
- {
- IKBodyOffsetCtrl ikbodyOffsetCtrl = new IKBodyOffsetCtrl(this);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[FullBodyIKMgr.IKEffectorType.Body]] = ikbodyOffsetCtrl;
- this.BodyOffsetCtrl = ikbodyOffsetCtrl;
- return ikbodyOffsetCtrl;
- }
- private ALimbIKCtrl[] AddLimbIKCtrl(FullBodyIKMgr.IKEffectorType hand_foot, FullBodyIKMgr.IKEffectorType elbow_knee, FullBodyIKMgr.IKEffectorType shoulder_thigh, FullBodyBipedEffector handfoot_effector, FullBodyBipedEffector shoulderthigh_effector)
- {
- IKSolverFullBodyBiped solver = this.ik.solver;
- IKMappingLimb limbMapping = solver.GetLimbMapping(handfoot_effector);
- FBIKChain chain = solver.GetChain(handfoot_effector);
- ShoulderThighIKCtrl shoulderThighIKCtrl = new ShoulderThighIKCtrl(solver.GetEffector(shoulderthigh_effector), chain, limbMapping, this, shoulder_thigh);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[shoulder_thigh]] = shoulderThighIKCtrl;
- ElbowKneeIKCtrl elbowKneeIKCtrl = new ElbowKneeIKCtrl(chain, limbMapping, this, elbow_knee);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[elbow_knee]] = elbowKneeIKCtrl;
- HandFootIKCtrl handFootIKCtrl = new HandFootIKCtrl(solver.GetEffector(handfoot_effector), chain, limbMapping, this, hand_foot);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[hand_foot]] = handFootIKCtrl;
- shoulderThighIKCtrl.SetChain(handFootIKCtrl, elbowKneeIKCtrl);
- elbowKneeIKCtrl.SetChain(handFootIKCtrl, shoulderThighIKCtrl);
- handFootIKCtrl.SetChain(elbowKneeIKCtrl, shoulderThighIKCtrl);
- return new ALimbIKCtrl[]
- {
- shoulderThighIKCtrl,
- elbowKneeIKCtrl,
- handFootIKCtrl
- };
- }
- private FreeFBIKCtrl AddFreeFBIKCtrl(FullBodyIKMgr.IKEffectorType effector_type, bool is_upper, FullBodyIKMgr.IKBoneType bend_bone = FullBodyIKMgr.IKBoneType.None)
- {
- FreeFBIKCtrl freeFBIKCtrl = new FreeFBIKCtrl(this, effector_type, is_upper, bend_bone);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[effector_type]] = freeFBIKCtrl;
- return freeFBIKCtrl;
- }
- private PenisIKCtrl AddPenisIKCtrl()
- {
- FullBodyIKMgr.IKEffectorType key = FullBodyIKMgr.IKEffectorType.Penis;
- PenisIKCtrl penisIKCtrl = new PenisIKCtrl(this);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[key]] = penisIKCtrl;
- return penisIKCtrl;
- }
- private MuneIKCtrl AddMuneIKCtrl(FullBodyIKMgr.IKEffectorType effector_type)
- {
- MuneIKCtrl muneIKCtrl = new MuneIKCtrl(this, effector_type);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[effector_type]] = muneIKCtrl;
- return muneIKCtrl;
- }
- private MouthIKCtrl AddMouthIKCtrl()
- {
- MouthIKCtrl mouthIKCtrl = new MouthIKCtrl(this);
- this.strIKCtrlPair[FullBodyIKMgr.IKEffectorTypeStrDic[FullBodyIKMgr.IKEffectorType.Mouth]] = mouthIKCtrl;
- return mouthIKCtrl;
- }
- private void PlaneColiderSetUp()
- {
- this.FloorColliderList.Clear();
- this.WallColliderList.Clear();
- if (this.planeColliderTrans)
- {
- UnityEngine.Object.DestroyImmediate(this.planeColliderTrans.gameObject);
- }
- this.planeColliderTrans = new GameObject(string.Format("IKPlaneCollider_{0}[{1}]", this.chara.boMAN ? "Man" : "Maid", this.chara.ActiveSlotNo)).transform;
- this.planeColliderTrans.SetParent(base.transform, false);
- }
- private void ColiderStateReset()
- {
- this.floorColliderEnable = true;
- this.wallColliderEnable = false;
- float num = 0f;
- this.wallColliderZ = num;
- this.floorColliderY = num;
- foreach (NativePlaneCollider nativePlaneCollider in this.FloorColliderList)
- {
- if (nativePlaneCollider)
- {
- nativePlaneCollider.status.center.y = 0f;
- }
- }
- foreach (NativePlaneCollider nativePlaneCollider2 in this.WallColliderList)
- {
- if (nativePlaneCollider2)
- {
- nativePlaneCollider2.status.center.z = 0f;
- }
- }
- }
- public void AddFloorCollider(NativePlaneCollider floor_collider)
- {
- this.FloorColliderList.Add(floor_collider);
- }
- public void AddWallCollider(NativePlaneCollider wall_collider)
- {
- this.WallColliderList.Add(wall_collider);
- }
- public NativePlaneCollider GetFloorCollider(string ik_name)
- {
- ALimbIKCtrl ikctrl = this.GetIKCtrl<ALimbIKCtrl>(ik_name);
- if (!ikctrl)
- {
- return null;
- }
- return ikctrl.floorCollider;
- }
- public NativePlaneCollider GetWallCollider(string ik_name)
- {
- ALimbIKCtrl ikctrl = this.GetIKCtrl<ALimbIKCtrl>(ik_name);
- if (!ikctrl)
- {
- return null;
- }
- return ikctrl.wallCollider;
- }
- private void Update()
- {
- this.isUpdateEnd = false;
- if (this.bodyOffsetCtrl != null)
- {
- this.bodyOffsetCtrl.CharaPosReset();
- }
- }
- private void OnDisable()
- {
- this.AllIKDetach(0f);
- }
- private void OnDestroy()
- {
- this.DestroyIKObject();
- }
- public void DestroyIKObject()
- {
- if (this.ikTargetRoot)
- {
- UnityEngine.Object.DestroyImmediate(this.ikTargetRoot.gameObject);
- }
- if (this.planeColliderTrans)
- {
- UnityEngine.Object.DestroyImmediate(this.planeColliderTrans.gameObject);
- }
- if (this.upperCrossBorder != null && this.upperCrossBorder.left)
- {
- UnityEngine.Object.DestroyImmediate(this.upperCrossBorder.left.gameObject);
- }
- if (this.lowerCrossBorder != null && this.lowerCrossBorder.left)
- {
- UnityEngine.Object.DestroyImmediate(this.lowerCrossBorder.left.gameObject);
- }
- if (this.Mouth)
- {
- UnityEngine.Object.DestroyImmediate(this.Mouth);
- }
- if (this.NippleL)
- {
- UnityEngine.Object.DestroyImmediate(this.NippleL);
- }
- if (this.NippleR)
- {
- UnityEngine.Object.DestroyImmediate(this.NippleR);
- }
- }
- public void IKAttach(FullBodyIKMgr.IKEffectorType effector_type, IKAttachParam param)
- {
- this.IKAttach(FullBodyIKMgr.IKEffectorTypeStrDic[effector_type], param);
- }
- public void IKAttach(string ik_name, IKAttachParam param)
- {
- AIKCtrl ikctrl = this.GetIKCtrl(ik_name);
- if (!ikctrl)
- {
- return;
- }
- ikctrl.SetIKSetting(param);
- }
- public void SetPelvisPull(bool pull_on)
- {
- this.IsPelvisPull = pull_on;
- }
- public void IKDetach(string name)
- {
- AIKCtrl ikctrl = this.GetIKCtrl(name);
- if (!ikctrl)
- {
- return;
- }
- if (this.ReservedDetachList.Contains(ikctrl))
- {
- return;
- }
- ikctrl.Detach();
- }
- public void IKDetach(FullBodyIKMgr.IKEffectorType effector_type)
- {
- this.IKDetach(FullBodyIKMgr.IKEffectorTypeStrDic[effector_type]);
- }
- public void IKDetach(string name, float blendtime)
- {
- AIKCtrl ikctrl = this.GetIKCtrl(name);
- if (!ikctrl)
- {
- return;
- }
- if (this.ReservedDetachList.Contains(ikctrl))
- {
- return;
- }
- ikctrl.blendTime = blendtime;
- ikctrl.Detach();
- }
- public void IKDetach(FullBodyIKMgr.IKEffectorType effector_type, float blendtime)
- {
- this.IKDetach(FullBodyIKMgr.IKEffectorTypeStrDic[effector_type], blendtime);
- }
- public void AllIKDetach(float blendtime = 0f)
- {
- this.isIKActive = (blendtime > 0f);
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- aikctrl.blendTime = blendtime;
- aikctrl.Detach();
- }
- }
- public void RemoveReservedDetach(AIKCtrl ik_data)
- {
- this.ReservedDetachList.Remove(ik_data);
- }
- public void SetAllColliderEnable(bool is_enable)
- {
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- if (aikctrl is ALimbIKCtrl)
- {
- ALimbIKCtrl alimbIKCtrl = aikctrl as ALimbIKCtrl;
- alimbIKCtrl.colliderEnable = is_enable;
- }
- }
- }
- public void IKReset()
- {
- this.ColiderStateReset();
- this.ReservedDetachList.Clear();
- this.IsPelvisPull = false;
- this.ikExecOrder = 0;
- this.upperBorderEnable = false;
- this.lowerBorderEnable = false;
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- aikctrl.Reset();
- if (aikctrl.isIKExec)
- {
- this.ReservedDetachList.Add(aikctrl);
- }
- }
- }
- public void AllIKResetDetach(float blendtime = 0f)
- {
- this.ColiderStateReset();
- this.isIKActive = (blendtime > 0f);
- this.IsPelvisPull = false;
- this.ikExecOrder = 0;
- this.upperBorderEnable = false;
- this.lowerBorderEnable = false;
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- aikctrl.blendTime = blendtime;
- aikctrl.ResetDetach();
- }
- }
- public void AddPartner(Maid partner, bool with_partner = false)
- {
- if (!this.partnerList.Contains(partner) && partner != this.chara)
- {
- this.partnerList.Add(partner);
- if (with_partner)
- {
- partner.body0.fullBodyIK.AddPartner(this.chara, false);
- }
- }
- }
- public void RemovePartner(Maid partner, bool with_partner = false)
- {
- if (this.partnerList.Contains(partner))
- {
- this.partnerList.Remove(partner);
- if (partner.fullBodyIK && with_partner)
- {
- partner.fullBodyIK.RemovePartner(this.chara, false);
- }
- }
- }
- public void IKUpdate()
- {
- if (!this.IsPelvisPull)
- {
- this.bodyEffector.positionWeight = 1f;
- }
- else
- {
- this.bodyEffector.positionWeight = 0f;
- }
- this.bodyEffector.target.position = this.bodyEffector.bone.position;
- this.bodyEffector.target.rotation = this.bodyEffector.bone.rotation;
- this.isUpdateLate = false;
- if (this.ReservedDetachList.Count > 0)
- {
- for (int i = 0; i < this.ReservedDetachList.Count; i++)
- {
- this.ReservedDetachList[i].Detach();
- }
- this.ReservedDetachList.Clear();
- }
- if (this.body.IsCrcBody)
- {
- if (this.upperBorderEnable)
- {
- this.SetBorderCenter(this.upperCrossBorder, this.GetIKBone(FullBodyIKMgr.IKBoneType.Forearm_L), this.GetIKBone(FullBodyIKMgr.IKBoneType.Forearm_R));
- }
- if (this.lowerBorderEnable)
- {
- this.SetBorderCenter(this.lowerCrossBorder, this.GetIKBone(FullBodyIKMgr.IKBoneType.Calf_L), this.GetIKBone(FullBodyIKMgr.IKBoneType.Calf_R));
- }
- }
- this.BodyOffsetUpdate();
- if (this.isUpdateLate)
- {
- return;
- }
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- if (!(aikctrl is IKBodyOffsetCtrl))
- {
- aikctrl.TargetTransCpy();
- }
- }
- foreach (AIKCtrl aikctrl2 in this.strIKCtrlPair.Values)
- {
- if (!(aikctrl2 is IKBodyOffsetCtrl))
- {
- aikctrl2.ApplyIKSetting();
- }
- }
- if (!this.isUpdateLate)
- {
- if (this.isIKExec)
- {
- this.SolverUpdate();
- }
- else
- {
- foreach (AIKCtrl aikctrl3 in this.strIKCtrlPair.Values)
- {
- aikctrl3.OnPostIKUpdate();
- }
- }
- }
- }
- private void SetBorderCenter(FullBodyIKMgr.BoneCrossBorder cross_border, Transform left_bone, Transform right_bone)
- {
- NativePlaneCollider left = cross_border.left;
- NativePlaneCollider right = cross_border.right;
- Transform parent = left.transform.parent;
- float d = Mathf.Min(Vector3.Dot(left_bone.position - parent.position, left.worldDirection), 0f);
- float d2 = Mathf.Min(Vector3.Dot(right_bone.position - parent.position, right.worldDirection), 0f);
- left.planeStatus.center = left.localDirection * d;
- right.planeStatus.center = right.localDirection * d2;
- }
- private void BodyOffsetUpdate()
- {
- if (this.bodyOffsetCtrl.isCharaPosSetEnd)
- {
- return;
- }
- this.bodyOffsetCtrl.TargetTransCpy();
- this.bodyOffsetCtrl.ApplyIKSetting();
- if (this.isUpdateLate)
- {
- return;
- }
- if (this.bodyOffsetCtrl.isIKExec && this.isIKActive)
- {
- this.bodyOffsetCtrl.OnPostFullBodySolverUpdate();
- }
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- if (aikctrl is ALimbIKCtrl && !aikctrl.isIKExec)
- {
- ALimbIKCtrl alimbIKCtrl = aikctrl as ALimbIKCtrl;
- if (alimbIKCtrl.correctType != ALimbIKCtrl.BorderCorrectType.HalfBody)
- {
- alimbIKCtrl.HitCheck();
- }
- }
- }
- }
- private void SolverUpdate()
- {
- this.isUpdateEnd = true;
- if (this.isIKActive && this.isIKExec)
- {
- bool flag = false;
- foreach (AIKCtrl aikctrl in this.strIKCtrlPair.Values)
- {
- if (!(aikctrl is IKBodyOffsetCtrl))
- {
- flag = aikctrl.isNeedFullbodySolverUpdate;
- if (flag)
- {
- break;
- }
- }
- }
- if (flag)
- {
- Vector3 localPosition = this.ik.references.spine[1].localPosition;
- this.ik.solver.Update();
- this.ik.references.spine[1].localPosition = localPosition;
- }
- foreach (AIKCtrl aikctrl2 in this.strIKCtrlPair.Values)
- {
- if (!(aikctrl2 is IKBodyOffsetCtrl))
- {
- aikctrl2.OnPostFullBodySolverUpdate();
- }
- }
- }
- foreach (AIKCtrl aikctrl3 in this.strIKCtrlPair.Values)
- {
- aikctrl3.OnPostIKUpdate();
- }
- if (this.isIKActive)
- {
- this.onPostSolverUpdate.Invoke();
- }
- }
- public void LateIKUpdate()
- {
- this.IKUpdate();
- this.body.AutoTwist();
- this.body.IKAttachTargetUpdate();
- }
- public Transform GetIKBone(FullBodyIKMgr.IKEffectorType effector_type)
- {
- return this.GetIKBone(FullBodyIKMgr.IKEffectorBonePair[effector_type]);
- }
- public Transform GetIKBone(FullBodyIKMgr.IKBoneType boneType)
- {
- return (!this.IKBoneDic.ContainsKey(boneType)) ? null : this.IKBoneDic[boneType];
- }
- public Transform[] GetChainBonesToInit(FullBodyIKMgr.IKEffectorType effector_type)
- {
- return this.GetChainBonesToInit(FullBodyIKMgr.IKEffectorBonePair[effector_type]);
- }
- public Transform[] GetChainBonesToInit(FullBodyIKMgr.IKBoneType boneType)
- {
- Transform[] result = new Transform[0];
- switch (boneType)
- {
- case FullBodyIKMgr.IKBoneType.ChinkoNub:
- if (this.chara.boMAN)
- {
- if (this.body.IsCrcBody)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko1),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko3),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko4),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko5),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko6),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko7),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.ChinkoNub)
- };
- }
- else
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko1),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Chinko2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.ChinkoNub)
- };
- }
- }
- break;
- case FullBodyIKMgr.IKBoneType.Thigh_R:
- case FullBodyIKMgr.IKBoneType.Calf_R:
- case FullBodyIKMgr.IKBoneType.Foot_R:
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Thigh_R),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Calf_R),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Foot_R)
- };
- break;
- case FullBodyIKMgr.IKBoneType.Thigh_L:
- case FullBodyIKMgr.IKBoneType.Calf_L:
- case FullBodyIKMgr.IKBoneType.Foot_L:
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Thigh_L),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Calf_L),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Foot_L)
- };
- break;
- case FullBodyIKMgr.IKBoneType.Bust_L:
- case FullBodyIKMgr.IKBoneType.Bust_L_Sub:
- if (!this.chara.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Bust_L),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Bust_L_Sub)
- };
- }
- break;
- case FullBodyIKMgr.IKBoneType.Bust_R:
- case FullBodyIKMgr.IKBoneType.Bust_R_Sub:
- if (!this.chara.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Bust_R),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Bust_R_Sub)
- };
- }
- break;
- case FullBodyIKMgr.IKBoneType.Mouth:
- if (this.body.IsCrcBody)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Head),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Mouth)
- };
- }
- break;
- default:
- switch (boneType)
- {
- case FullBodyIKMgr.IKBoneType.Neck:
- if (this.body.IsCrcBody)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck)
- };
- }
- else if (!this.chara.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck)
- };
- }
- else
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine1),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck)
- };
- }
- break;
- case FullBodyIKMgr.IKBoneType.Head:
- if (this.body.IsCrcBody)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine0),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine1),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Head)
- };
- }
- else if (!this.chara.boMAN)
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine0),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine1),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine3),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Head)
- };
- }
- else
- {
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine0),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine1),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Spine2),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Neck),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Head)
- };
- }
- break;
- case FullBodyIKMgr.IKBoneType.UpperArm_R:
- case FullBodyIKMgr.IKBoneType.Forearm_R:
- case FullBodyIKMgr.IKBoneType.Hand_R:
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.UpperArm_R),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Forearm_R),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Hand_R)
- };
- break;
- case FullBodyIKMgr.IKBoneType.UpperArm_L:
- case FullBodyIKMgr.IKBoneType.Forearm_L:
- case FullBodyIKMgr.IKBoneType.Hand_L:
- result = new Transform[]
- {
- this.GetIKBone(FullBodyIKMgr.IKBoneType.UpperArm_L),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Forearm_L),
- this.GetIKBone(FullBodyIKMgr.IKBoneType.Hand_L)
- };
- break;
- }
- break;
- }
- return result;
- }
- public AIKCtrl GetIKCtrl(string tag_name)
- {
- if (this.strIKCtrlPair.ContainsKey(tag_name))
- {
- return this.strIKCtrlPair[tag_name];
- }
- return null;
- }
- public T GetIKCtrl<T>(string tag_name) where T : AIKCtrl
- {
- AIKCtrl ikctrl = this.GetIKCtrl(tag_name);
- if (ikctrl != null && ikctrl is T)
- {
- return ikctrl as T;
- }
- return (T)((object)null);
- }
- public AIKCtrl GetIKCtrl(FullBodyIKMgr.IKEffectorType effector_type)
- {
- return this.GetIKCtrl(FullBodyIKMgr.IKEffectorTypeStrDic[effector_type]);
- }
- public T GetIKCtrl<T>(FullBodyIKMgr.IKEffectorType effector_type) where T : AIKCtrl
- {
- AIKCtrl ikctrl = this.GetIKCtrl(effector_type);
- if (ikctrl != null && ikctrl is T)
- {
- return ikctrl as T;
- }
- return (T)((object)null);
- }
- public Transform GetSTFlagObj(string name)
- {
- if (this.NameFlagObjpair.ContainsKey(name))
- {
- return this.NameFlagObjpair[name];
- }
- Transform transform = this.STRoot.Find(name);
- if (!transform)
- {
- transform = this.body.GetBone(name);
- if (!transform)
- {
- Debug.LogErrorFormat("{0}は存在しません", new object[]
- {
- name
- });
- return null;
- }
- }
- this.NameFlagObjpair.Add(name, transform);
- return transform;
- }
- public static Dictionary<FullBodyIKMgr.IKBoneType, Transform> GetAllIKBoneDic(Maid chara)
- {
- if (chara == null)
- {
- return null;
- }
- DebugUtility.Assert.IsNotNull<TBody>(chara.body0, "[body0] it does not end load.");
- string text = string.Empty;
- if (chara.body0.IsCrcBody)
- {
- text = "Bip01";
- }
- else
- {
- text = ((!chara.boMAN) ? "Bip01" : "ManBip");
- }
- Dictionary<FullBodyIKMgr.IKBoneType, Transform> dictionary = new Dictionary<FullBodyIKMgr.IKBoneType, Transform>();
- dictionary.Add(FullBodyIKMgr.IKBoneType.TopFixed, chara.body0.GetBone(text).parent);
- dictionary.Add(FullBodyIKMgr.IKBoneType.Root, chara.body0.GetBone(text));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Pelvis, chara.body0.GetBone(text + " Pelvis"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine0, chara.body0.GetBone(text + " Spine"));
- if (chara.body0.IsCrcBody)
- {
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine1, chara.body0.GetBone(text + " Spine0a"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine2, chara.body0.GetBone(text + " Spine1"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine3, chara.body0.GetBone(text + " Spine1a"));
- }
- else if (!chara.boMAN)
- {
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine1, chara.body0.GetBone(text + " Spine0a"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine2, chara.body0.GetBone(text + " Spine1"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine3, chara.body0.GetBone(text + " Spine1a"));
- }
- else
- {
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine1, chara.body0.GetBone(text + " Spine1"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Spine2, chara.body0.GetBone(text + " Spine2"));
- }
- dictionary.Add(FullBodyIKMgr.IKBoneType.Head, chara.body0.GetBone(text + " Head"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Neck, chara.body0.GetBone(text + " Neck"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.UpperArm_R, chara.body0.GetBone(text + " R UpperArm"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Forearm_R, chara.body0.GetBone(text + " R Forearm"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Hand_R, chara.body0.GetBone(text + " R Hand"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.UpperArm_L, chara.body0.GetBone(text + " L UpperArm"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Forearm_L, chara.body0.GetBone(text + " L Forearm"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Hand_L, chara.body0.GetBone(text + " L Hand"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Thigh_R, chara.body0.GetBone(text + " R Thigh"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Calf_R, chara.body0.GetBone(text + " R Calf"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Foot_R, chara.body0.GetBone(text + " R Foot"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Thigh_L, chara.body0.GetBone(text + " L Thigh"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Calf_L, chara.body0.GetBone(text + " L Calf"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Foot_L, chara.body0.GetBone(text + " L Foot"));
- if (chara.boMAN)
- {
- dictionary.Add(FullBodyIKMgr.IKBoneType.ChinkoCenter, chara.body0.GetBone("chinkoCenter"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko1, chara.body0.GetBone("chinko1"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko2, chara.body0.GetBone("chinko2"));
- if (chara.body0.IsCrcBody)
- {
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko3, chara.body0.GetBone("chinko3"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko4, chara.body0.GetBone("chinko4"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko5, chara.body0.GetBone("chinko5"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko6, chara.body0.GetBone("chinko6"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Chinko7, chara.body0.GetBone("chinko7"));
- }
- dictionary.Add(FullBodyIKMgr.IKBoneType.ChinkoNub, chara.body0.GetBone("chinko_nub"));
- }
- else
- {
- dictionary.Add(FullBodyIKMgr.IKBoneType.Bust_L, chara.body0.GetBone("Mune_L"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Bust_L_Sub, chara.body0.GetBone("Mune_L_sub"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Bust_R, chara.body0.GetBone("Mune_R"));
- dictionary.Add(FullBodyIKMgr.IKBoneType.Bust_R_Sub, chara.body0.GetBone("Mune_R_sub"));
- }
- dictionary.Add(FullBodyIKMgr.IKBoneType.Mouth, chara.body0.GetBone("_IK_mouth"));
- return dictionary;
- }
- public static Dictionary<FullBodyIKMgr.IKEffectorType, string> GetBoneTypeStrDic(Maid chara)
- {
- return FullBodyIKMgr.GetBoneTypeStrDic(chara.boMAN);
- }
- public static Dictionary<FullBodyIKMgr.IKEffectorType, string> GetBoneTypeStrDic(bool isMan)
- {
- Dictionary<FullBodyIKMgr.IKEffectorType, string> dictionary = new Dictionary<FullBodyIKMgr.IKEffectorType, string>(FullBodyIKMgr.IKEffectorTypeStrDic);
- if (!isMan)
- {
- dictionary.Remove(FullBodyIKMgr.IKEffectorType.Penis);
- }
- else
- {
- dictionary.Remove(FullBodyIKMgr.IKEffectorType.Bust_L);
- dictionary.Remove(FullBodyIKMgr.IKEffectorType.Bust_R);
- }
- return dictionary;
- }
- public const float PULL_MIN_VALUE = 0.1f;
- public static readonly Dictionary<FullBodyIKMgr.IKEffectorType, string> IKEffectorTypeStrDic = new Dictionary<FullBodyIKMgr.IKEffectorType, string>
- {
- {
- FullBodyIKMgr.IKEffectorType.Body,
- "体全体"
- },
- {
- FullBodyIKMgr.IKEffectorType.Hand_R,
- "右手"
- },
- {
- FullBodyIKMgr.IKEffectorType.Forearm_R,
- "右肘"
- },
- {
- FullBodyIKMgr.IKEffectorType.UpperArm_R,
- "右肩"
- },
- {
- FullBodyIKMgr.IKEffectorType.Hand_L,
- "左手"
- },
- {
- FullBodyIKMgr.IKEffectorType.Forearm_L,
- "左肘"
- },
- {
- FullBodyIKMgr.IKEffectorType.UpperArm_L,
- "左肩"
- },
- {
- FullBodyIKMgr.IKEffectorType.Foot_R,
- "右足"
- },
- {
- FullBodyIKMgr.IKEffectorType.Calf_R,
- "右膝"
- },
- {
- FullBodyIKMgr.IKEffectorType.Thigh_R,
- "右腿"
- },
- {
- FullBodyIKMgr.IKEffectorType.Foot_L,
- "左足"
- },
- {
- FullBodyIKMgr.IKEffectorType.Calf_L,
- "左膝"
- },
- {
- FullBodyIKMgr.IKEffectorType.Thigh_L,
- "左腿"
- },
- {
- FullBodyIKMgr.IKEffectorType.Head,
- "頭"
- },
- {
- FullBodyIKMgr.IKEffectorType.Penis,
- "ちんこ"
- },
- {
- FullBodyIKMgr.IKEffectorType.Bust_L,
- "左胸"
- },
- {
- FullBodyIKMgr.IKEffectorType.Bust_R,
- "右胸"
- },
- {
- FullBodyIKMgr.IKEffectorType.Mouth,
- "口"
- }
- };
- public static readonly Dictionary<FullBodyIKMgr.IKEffectorType, FullBodyIKMgr.IKBoneType> IKEffectorBonePair = new Dictionary<FullBodyIKMgr.IKEffectorType, FullBodyIKMgr.IKBoneType>
- {
- {
- FullBodyIKMgr.IKEffectorType.Body,
- FullBodyIKMgr.IKBoneType.Root
- },
- {
- FullBodyIKMgr.IKEffectorType.Hand_R,
- FullBodyIKMgr.IKBoneType.Hand_R
- },
- {
- FullBodyIKMgr.IKEffectorType.Forearm_R,
- FullBodyIKMgr.IKBoneType.Forearm_R
- },
- {
- FullBodyIKMgr.IKEffectorType.UpperArm_R,
- FullBodyIKMgr.IKBoneType.UpperArm_R
- },
- {
- FullBodyIKMgr.IKEffectorType.Hand_L,
- FullBodyIKMgr.IKBoneType.Hand_L
- },
- {
- FullBodyIKMgr.IKEffectorType.Forearm_L,
- FullBodyIKMgr.IKBoneType.Forearm_L
- },
- {
- FullBodyIKMgr.IKEffectorType.UpperArm_L,
- FullBodyIKMgr.IKBoneType.UpperArm_L
- },
- {
- FullBodyIKMgr.IKEffectorType.Foot_R,
- FullBodyIKMgr.IKBoneType.Foot_R
- },
- {
- FullBodyIKMgr.IKEffectorType.Calf_R,
- FullBodyIKMgr.IKBoneType.Calf_R
- },
- {
- FullBodyIKMgr.IKEffectorType.Thigh_R,
- FullBodyIKMgr.IKBoneType.Thigh_R
- },
- {
- FullBodyIKMgr.IKEffectorType.Foot_L,
- FullBodyIKMgr.IKBoneType.Foot_L
- },
- {
- FullBodyIKMgr.IKEffectorType.Calf_L,
- FullBodyIKMgr.IKBoneType.Calf_L
- },
- {
- FullBodyIKMgr.IKEffectorType.Thigh_L,
- FullBodyIKMgr.IKBoneType.Thigh_L
- },
- {
- FullBodyIKMgr.IKEffectorType.Head,
- FullBodyIKMgr.IKBoneType.Head
- },
- {
- FullBodyIKMgr.IKEffectorType.Penis,
- FullBodyIKMgr.IKBoneType.ChinkoNub
- },
- {
- FullBodyIKMgr.IKEffectorType.Bust_R,
- FullBodyIKMgr.IKBoneType.Bust_R_Sub
- },
- {
- FullBodyIKMgr.IKEffectorType.Bust_L,
- FullBodyIKMgr.IKBoneType.Bust_L_Sub
- },
- {
- FullBodyIKMgr.IKEffectorType.Mouth,
- FullBodyIKMgr.IKBoneType.Mouth
- }
- };
- [SerializeField]
- private TBody Body;
- [SerializeField]
- private Transform IKTargetRoot;
- [SerializeField]
- private Transform STRoot;
- [SerializeField]
- private FullBodyBipedIK IK;
- private Dictionary<FullBodyIKMgr.IKBoneType, Transform> IKBoneDic = new Dictionary<FullBodyIKMgr.IKBoneType, Transform>();
- [SerializeField]
- private IKBodyOffsetCtrl BodyOffsetCtrl;
- private Transform NippleL;
- private Transform NippleR;
- private Transform Mouth;
- private Dictionary<string, AIKCtrl> StrIKCtrlPair = new Dictionary<string, AIKCtrl>();
- private Dictionary<string, Transform> NameFlagObjpair = new Dictionary<string, Transform>();
- public bool isIKActive = true;
- [HideInInspector]
- public bool isUpdateLate;
- public PermTempAction onPostSolverUpdate = new PermTempAction();
- [SerializeField]
- private float BlendTime;
- private List<NativePlaneCollider> FloorColliderList = new List<NativePlaneCollider>();
- private float FloorColliderY;
- private List<NativePlaneCollider> WallColliderList = new List<NativePlaneCollider>();
- private float WallColliderZ;
- private HashSet<Maid> PartnerList = new HashSet<Maid>();
- private List<AIKCtrl> ReservedDetachList = new List<AIKCtrl>();
- private bool IsPelvisPull;
- public int ikExecOrder;
- public enum IKBoneType
- {
- None,
- TopFixed,
- Root,
- Spine0,
- Spine1,
- Spine2,
- Spine3,
- Neck,
- Head,
- Clavicle_R,
- UpperArm_R,
- Forearm_R,
- Hand_R,
- Clavicle_L,
- UpperArm_L,
- Forearm_L,
- Hand_L,
- Pelvis,
- ChinkoCenter,
- Chinko1,
- Chinko2,
- Chinko3,
- Chinko4,
- Chinko5,
- Chinko6,
- Chinko7,
- ChinkoNub,
- Thigh_R,
- Calf_R,
- Foot_R,
- Thigh_L,
- Calf_L,
- Foot_L,
- Bust_L,
- Bust_L_Sub,
- Bust_R,
- Bust_R_Sub,
- Mouth
- }
- public enum IKEffectorType
- {
- Body,
- Hand_R,
- Forearm_R,
- UpperArm_R,
- Hand_L,
- Forearm_L,
- UpperArm_L,
- Foot_R,
- Calf_R,
- Thigh_R,
- Foot_L,
- Calf_L,
- Thigh_L,
- Head,
- Penis,
- Bust_R,
- Bust_L,
- Mouth,
- Finger_R0,
- Finger_R1,
- Finger_R2,
- Finger_R3,
- Finger_R4,
- Finger_L0,
- Finger_L1,
- Finger_L2,
- Finger_L3,
- Finger_L4
- }
- public class BoneCrossBorder
- {
- public BoneCrossBorder(NativePlaneCollider left, NativePlaneCollider right)
- {
- this.left = left;
- this.right = right;
- }
- public readonly NativePlaneCollider left;
- public readonly NativePlaneCollider right;
- }
- }
|