public static void HScene_EndProc_Patch() { inHScene = false; if (map != null && mapShouldEnable) { map.SetActive(true); mapShouldEnable = false; } if (mapSimulation != null && mapSimulationShouldEnable) { mapSimulation.SetActive(true); mapSimulationShouldEnable = false; } activeUI = false; if (!increaseBathDesire.Value || manager != null && manager.bMerchant) { return; } var females = hScene.GetFemales(); var agentTable = Singleton <Map> .Instance.AgentTable; if (females == null || agentTable == null) { return; } foreach (var female in females.Where(female => female != null)) { var agent = agentTable.FirstOrDefault(pair => pair.Value != null && pair.Value.ChaControl == female).Value; if (agent == null) { continue; } int bathDesireType = Desire.GetDesireKey(Desire.Type.Bath); int lewdDesireType = Desire.GetDesireKey(Desire.Type.H); float clampedReason = Tools.Remap(agent.GetFlavorSkill(FlavorSkill.Type.Reason), 0, 99999f, 0, 100f); float clampedDirty = Tools.Remap(agent.GetFlavorSkill(FlavorSkill.Type.Dirty), 0, 99999f, 0, 100f); float clampedLewd = agent.GetDesire(lewdDesireType) ?? 0; float newBathDesire = 100f + (clampedReason * 1.25f) - clampedDirty - clampedLewd * 1.5f; agent.SetDesire(bathDesireType, Mathf.Clamp(newBathDesire, 0f, 100f)); } }
private static void HScene_PostSetStartVoice(HScene __instance) { hScene = __instance; List <DanOptions> danOptions = PopulateDanOptionsList(); List <CollisionOptions> collisionOptions = PopulateCollisionOptionsList(); ChaControl[] femaleArray = hScene.GetFemales(); List <ChaControl> femaleList = new List <ChaControl>(); foreach (var character in femaleArray) { if (character == null) { continue; } femaleList.Add(character); } ChaControl[] maleArray = hScene.GetMales(); List <ChaControl> maleList = new List <ChaControl>(); foreach (var character in maleArray) { if (character == null) { continue; } maleList.Add(character); } CoreGame.InitializeAgents(maleList, femaleList, danOptions, collisionOptions); inHScene = true; }
private static void AfterCharacterReload(object __instance) { if (!inHScene || hScene == null) { return; } ChaControl chaControl = (ChaControl)__instance.GetPrivateProperty("ChaControl"); if (chaControl == null || chaControl.sex == 0) { return; } ChaControl[] femaleArray = hScene.GetFemales(); List <ChaControl> femaleList = new List <ChaControl>(); foreach (var character in femaleArray) { if (character == null) { continue; } femaleList.Add(character); } List <CollisionOptions> collisionOptions = PopulateCollisionOptionsList(); CoreGame.InitializeCollisionAgents(femaleList, collisionOptions); loadingCharacter = false; }
private static void HScene_StripClothes(bool stripMales, bool stripFemales) { if (stripMales) { var malesStrip = new List <Tools.ClothesStrip> { stripMaleTop.Value, stripMaleBottom.Value, stripMaleBra.Value, stripMalePanties.Value, stripMaleGloves.Value, stripMalePantyhose.Value, stripMaleSocks.Value, stripMaleShoes.Value, }; foreach (var male in hScene.GetMales().Where(male => male != null)) { foreach (var item in malesStrip.Select((x, i) => new { x, i })) { if (item.x > 0 && male.IsClothesStateKind(item.i) && male.fileStatus.clothesState[item.i] != 2) { male.SetClothesState(item.i, (byte)item.x); } } } } if (stripFemales) { var femalesStrip = new List <Tools.ClothesStrip> { stripFemaleTop.Value, stripFemaleBottom.Value, stripFemaleBra.Value, stripFemalePanties.Value, stripFemaleGloves.Value, stripFemalePantyhose.Value, stripFemaleSocks.Value, stripFemaleShoes.Value, }; foreach (var female in hScene.GetFemales().Where(female => female != null)) { foreach (var item in femalesStrip.Select((x, i) => new { x, i })) { if (item.x > 0 && female.IsClothesStateKind(item.i) && female.fileStatus.clothesState[item.i] != 2) { female.SetClothesState(item.i, (byte)item.x); } } } } }
public static void OnChangeAnimation(HScene __instance, HScene.AnimationListInfo _info, bool _isForceResetCamera, bool _isForceLoopAction = false, bool _UseFade = true) { var isGroundAnimation = Constant.StandingAnimations.Contains(_info.id); var females = __instance.GetFemales(); foreach (var female in females) { var femaleApiController = GetAPIController(female); if (femaleApiController != null) { femaleApiController.GroundAnim = isGroundAnimation; femaleApiController?.UpdateHover(); } } }
public static ChaControl[] newGetFemales() { var females = hScene.GetFemales(); var males = hScene.GetMales(); var newFemales = new ChaControl[females.Length + males.Length]; for (var i = 0; i < females.Length; i++) { newFemales[i] = females[i]; } for (var i = 0; i < males.Length; i++) { newFemales[i + females.Length] = males[i]; } return(newFemales); }
public static void SetupVariables(HScene __instance) { AI_BetterHScenes.map = GameObject.Find("map00_Beach"); if (AI_BetterHScenes.map == null) { AI_BetterHScenes.map = GameObject.Find("map_01_data"); } AI_BetterHScenes.mapSimulation = GameObject.Find("CommonSpace/MapRoot/MapSimulation(Clone)/EnviroSkyGroup(Clone)"); AI_BetterHScenes.collisionHelpers = new List <SkinnedCollisionHelper>(); AI_BetterHScenes.hScene = __instance; var hTrav = Traverse.Create(__instance); AI_BetterHScenes.hFlagCtrl = __instance.ctrlFlag; AI_BetterHScenes.manager = hTrav.Field("hSceneManager").GetValue <HSceneManager>(); AI_BetterHScenes.hSprite = hTrav.Field("sprite").GetValue <HSceneSprite>(); AI_BetterHScenes.characters = new List <ChaControl>(); AI_BetterHScenes.characters.AddRange(__instance.GetMales()); AI_BetterHScenes.characters.AddRange(__instance.GetFemales()); AI_BetterHScenes.cameraShouldLock = true; if (__instance.ctrlFlag != null) { Traverse.Create(__instance.ctrlFlag).Field("gotoFaintnessCount").SetValue(AI_BetterHScenes.countToWeakness.Value); if (__instance.ctrlFlag.cameraCtrl != null) { AI_BetterHScenes.hCamera = __instance.ctrlFlag.cameraCtrl; } } AI_BetterHScenes.finishObjects = new List <GameObject>(); foreach (var name in finishFindTransforms) { AI_BetterHScenes.finishObjects.Add(AI_BetterHScenes.hSprite.categoryFinish.transform.Find(name).gameObject); } UI.InitDraggersUI(); }
private static void StartHScene(HScene hScene) { if (_hSceneClipDistance.Value < _characterClipDistance.Value) { CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.CharaLayer, _hSceneClipDistance.Value); } if (_hSceneClipDistance.Value < _worldClipDistance.Value) { CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.MapLayer, _hSceneClipDistance.Value); } if (_hSceneClipDistance.Value < _mediumClipDistance.Value) { CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.MediumObjectLayer, _hSceneClipDistance.Value); } if (_hSceneClipDistance.Value < _smallClipDistance.Value) { CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.SmallObjectLayer, _hSceneClipDistance.Value); } if (_hSceneClipDistance.Value < _terrainClipDistance.Value) { CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.LargeObjectLayer, _hSceneClipDistance.Value); } if (_hSceneClipDistance.Value < _waterClipDistance.Value) { CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.WaterLayer, _hSceneClipDistance.Value); } AIChara.ChaControl[] females = hScene.GetFemales(); CharacterOptimizations.InitializeHScene(females); HousingOptimizations.SetParticleSystemActive(false, "e_ai_ef"); }
public static void HScene_SetStartAnimationInfo_Patch(HScene __instance, HSceneSprite ___sprite) { hScene = __instance; hSprite = ___sprite; if (hScene == null || hSprite == null) { return; } hFlagCtrl = hScene.ctrlFlag; if (hFlagCtrl == null) { return; } cameraCtrl = hFlagCtrl.cameraCtrl; if (cameraCtrl == null) { return; } hSceneTrav = Traverse.Create(hScene); Tools.hFlagCtrlTrav = Traverse.Create(hFlagCtrl); listTrav = Traverse.Create(hScene.ctrlEyeNeckMale[0]); maleMotionList = listTrav?.Field("lstEyeNeck").GetValue <List <HMotionEyeNeckMale.EyeNeck> >(); if (unlockCamera.Value) { cameraCtrl.isLimitDir = false; cameraCtrl.isLimitPos = false; } cameraShouldLock = true; characters = new List <ChaControl>(); maleCharacters = new List <ChaControl>(); ChaControl[] males = __instance.GetMales(); foreach (var male in males.Where(male => male != null)) { maleCharacters.Add(male); characters.Add(male); } femaleCharacters = new List <ChaControl>(); ChaControl[] females = __instance.GetFemales(); foreach (var female in females.Where(female => female != null)) { femaleCharacters.Add(female); characters.Add(female); } if (characters == null) { return; } obiSolver = GameObject.Find("SiruObiMgr").GetComponentInChildren <Obi.ObiSolver>(true); if (obiSolver != null) { obiSolver.UpdateOrder = obiUpdateMode.Value; } Tools.SetGotoWeaknessCount(countToWeakness.Value); SliderUI.InitDraggersUI(); }
public static void AddPColliders() { if (hScene == null) { return; } male_list = hScene.GetMales().Where(male => male != null).ToArray(); fem_list = hScene.GetFemales().Where(female => female != null).ToArray(); danPoints = new DanPoints[male_list.Length]; referenceLookAtTarget = new Transform[male_list.Length]; constrainPoints = new ConstrainPoints[fem_list.Length]; kokanBones = new List <DynamicBone> [fem_list.Length]; int maleNum = 0; foreach (var male in male_list.Where(male => male != null)) { Transform dan101 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_base)).FirstOrDefault(); Transform dan109 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_head)).FirstOrDefault(); Transform danTop = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_sack)).FirstOrDefault(); bDansFound[maleNum] = false; bDanPenetration[maleNum] = false; targetF[maleNum] = 0; if (dan101 != null && dan109 != null && danTop != null) { danPoints[maleNum] = new DanPoints(dan101, dan109, danTop); bDansFound[maleNum] = true; dan101.localScale = new Vector3(_dan_girth[maleNum].Value, _dan_girth[maleNum].Value, 1); danCollider[maleNum] = dan101.GetComponent <DynamicBoneCollider>(); if (danCollider[maleNum] == null) { danCollider[maleNum] = dan101.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } danCollider[maleNum].m_Direction = DynamicBoneColliderBase.Direction.Z; danCollider[maleNum].m_Center = new Vector3(0, _dan_collider_verticalcenter[maleNum].Value, _dan_length[maleNum].Value / 2); danCollider[maleNum].m_Bound = DynamicBoneColliderBase.Bound.Outside; danCollider[maleNum].m_Radius = _dan_collider_radius[maleNum].Value; danCollider[maleNum].m_Height = _dan_length[maleNum].Value + (_dan_collider_headlength[maleNum].Value * 2); danPoints[maleNum].danTop.localScale = new Vector3(_dan_sack_size[maleNum].Value, _dan_sack_size[maleNum].Value, _dan_sack_size[maleNum].Value); lastDan109Position[maleNum] = danPoints[maleNum].danEnd.position; lastDanRotation[maleNum] = danPoints[maleNum].danEnd.rotation; lastAdjustTime[maleNum] = Time.time; } referenceLookAtTarget[maleNum] = danPoints[maleNum].danEnd; lastDan101TargetDistance[maleNum] = Vector3.Distance(referenceLookAtTarget[maleNum].position, danPoints[maleNum].danStart.position); Console.WriteLine("bDansFound " + bDansFound[maleNum]); maleNum++; } int femaleNum = 0; foreach (var female in fem_list.Where(female => female != null)) { List <Transform> frontHPoints = new List <Transform>(); List <Transform> backHPoints = new List <Transform>(); Transform hPointBackOfHead; bHPointsFound[femaleNum] = false; for (int index = 0; index < frontHPointsList.Length; index++) { frontHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(frontHPointsList[index])).FirstOrDefault()); } for (int index = 0; index < backHPointsList.Length; index++) { backHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(backHPointsList[index])).FirstOrDefault()); } hPointBackOfHead = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(headHPoint)).FirstOrDefault(); bpKokanTarget[femaleNum] = female.GetComponentsInChildren <Transform>().Where(x => x.name.Equals(bp_kokan_target)).FirstOrDefault(); if (bpKokanTarget[femaleNum] != null) { Console.WriteLine("BP Target Found " + bpKokanTarget[femaleNum].name); frontHPoints[0] = bpKokanTarget[femaleNum]; } if (frontHPoints.Count == frontHPointsList.Length && backHPoints.Count == backHPointsList.Length && hPointBackOfHead != null) { bHPointsFound[femaleNum] = true; constrainPoints[femaleNum] = new ConstrainPoints(frontHPoints, backHPoints, hPointBackOfHead); } foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>().Where(x => x.name.Contains("cf_J_Vagina"))) { db.m_Colliders.Clear(); } Console.WriteLine("bHPointsFound " + bHPointsFound[femaleNum]); List <DynamicBone> dbList = new List <DynamicBone>(); foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>().Where(x => x.name.Contains("cf_J_Vagina"))) { if (db == null) { continue; } if (db.m_Root != null) { for (int i = 0; i < colliderList.Length; i++) { if (db.m_Root.name.Equals(dynamicBonesList[i])) { DynamicBoneCollider dbc = female.GetComponentsInChildren <DynamicBoneCollider>().Where(x => x.name.Contains(colliderList[i])).FirstOrDefault(); if (dbc == null) { Transform colliderTransform = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(colliderList[i])).FirstOrDefault(); if (colliderTransform != null) { Console.WriteLine("collider " + colliderTransform.name); dbc = colliderTransform.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; dbc.m_Bound = DynamicBoneColliderBase.Bound.Inside; dbc.m_Direction = DynamicBoneColliderBase.Direction.Y; dbc.m_Height = colliderHeightList[i]; dbc.m_Radius = colliderRadiusList[i]; } } if (dbc != null) { db.m_Colliders.Add(dbc); foreach (DynamicBoneColliderBase dbcb in db.m_Colliders) { Console.WriteLine(db.m_Root.name + " collider " + dbcb.name); } } else { Console.WriteLine(colliderList[i] + " collider not found for " + female.name); } } } } dbList.Add(db); } kokanBones[femaleNum] = dbList; femaleNum++; } Console.WriteLine("AddColliders done."); }
public static void AddPColliders(HScene __instance) { hScene = __instance; male_list = __instance.GetMales().Where(male => male != null).ToArray(); fem_list = __instance.GetFemales().Where(female => female != null).ToArray(); danPoints = new DanPoints[male_list.Length]; referenceLookAtTarget = new Transform[male_list.Length]; constrainPoints = new ConstrainPoints[fem_list.Length]; kokanBones = new List <DynamicBone> [fem_list.Length]; int maleNum = 0; foreach (var male in male_list.Where(male => male != null)) { Transform dan101 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_base)).FirstOrDefault(); Transform dan109 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_head)).FirstOrDefault(); Transform danTop = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_sack)).FirstOrDefault(); bDansFound[maleNum] = false; bDanPenetration[maleNum] = false; targetF[maleNum] = 0; if (dan101 != null && dan109 != null && danTop != null) { danPoints[maleNum] = new DanPoints(dan101, dan109, danTop); bDansFound[maleNum] = true; dan101.localScale = new Vector3(_dan_girth[maleNum].Value, _dan_girth[maleNum].Value, 1); danCollider[maleNum] = dan101.GetComponent <DynamicBoneCollider>(); if (danCollider[maleNum] == null) { danCollider[maleNum] = dan101.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } danCollider[maleNum].m_Direction = DynamicBoneColliderBase.Direction.Z; danCollider[maleNum].m_Center = new Vector3(0, 0, _dan_length[maleNum].Value / 2); danCollider[maleNum].m_Bound = DynamicBoneColliderBase.Bound.Outside; danCollider[maleNum].m_Radius = _dan_collider_radius[maleNum].Value; danCollider[maleNum].m_Height = _dan_length[maleNum].Value + (_dan_collider_headlength[maleNum].Value * 2); danPoints[maleNum].danTop.localScale = new Vector3(_dan_sack_size[maleNum].Value, _dan_sack_size[maleNum].Value, _dan_sack_size[maleNum].Value); lastDan109Position[maleNum] = danPoints[maleNum].danEnd.position; lastDanRotation[maleNum] = danPoints[maleNum].danEnd.rotation; lastDanVector[maleNum] = danPoints[maleNum].danEnd.position - danPoints[maleNum].danStart.position; lastDanLength[maleNum] = _dan_length[maleNum].Value; lastAdjustTime[maleNum] = Time.time; } referenceLookAtTarget[maleNum] = danPoints[maleNum].danEnd; lastDan101TargetDistance[maleNum] = Vector3.Distance(referenceLookAtTarget[maleNum].position, danPoints[maleNum].danStart.position); Console.WriteLine("bDansFound " + bDansFound[maleNum]); maleNum++; } int femaleNum = 0; foreach (var female in fem_list.Where(female => female != null)) { List <Transform> frontHPoints = new List <Transform>(); List <Transform> backHPoints = new List <Transform>(); Transform hPointBackOfHead; bHPointsFound[femaleNum] = false; for (int index = 0; index < frontHPointsList.Length; index++) { frontHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(frontHPointsList[index])).FirstOrDefault()); } for (int index = 0; index < backHPointsList.Length; index++) { backHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(backHPointsList[index])).FirstOrDefault()); } hPointBackOfHead = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(headHPoint)).FirstOrDefault(); if (frontHPoints.Count == frontHPointsList.Length && backHPoints.Count == backHPointsList.Length && hPointBackOfHead != null) { bHPointsFound[femaleNum] = true; constrainPoints[femaleNum] = new ConstrainPoints(frontHPoints, backHPoints, hPointBackOfHead); } Console.WriteLine("bHPointsFound " + bHPointsFound[femaleNum]); List <DynamicBone> dbList = new List <DynamicBone>(); foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>().Where(x => x.name.Contains("cf_J_Vagina"))) { if (db != null) { Console.WriteLine(db.m_Root.name + " found, adding collilders"); dbList.Add(db); for (int i = 0; i < danCollider.Length; i++) { if (db.m_Colliders.Contains(danCollider[i])) { Console.WriteLine("Instance of " + danCollider[i].name + " already exists in list for DB " + db.name); } else { db.m_Colliders.Add(danCollider[i]); Console.WriteLine(danCollider[i].name + " added to " + female.name + " for bone " + db.name); } } } } kokanBones[femaleNum] = dbList; femaleNum++; } inHScene = true; Console.WriteLine("AddColliders done."); }
public static void AddPColliders(bool setDanLength) { if (hScene == null) { return; } male_list = hScene.GetMales().Where(male => male != null).ToArray(); fem_list = hScene.GetFemales().Where(female => female != null).ToArray(); danCollider = new DynamicBoneCollider(); referenceLookAtTarget = null; constrainPoints = new ConstrainPoints(); kokanBones = new List <DynamicBone>(); bDansFound = false; foreach (var male in male_list.Where(male => male != null)) { if (!bDansFound) { Transform dan101 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_base)).FirstOrDefault(); Transform dan109 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_head)).FirstOrDefault(); Transform danTop = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_sack)).FirstOrDefault(); Transform index = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(index_finger)).FirstOrDefault(); Transform middle = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(middle_finger)).FirstOrDefault(); Transform ring = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(ring_finger)).FirstOrDefault(); bDanPenetration = false; if (dan101 != null && dan109 != null && danTop != null) { if (setDanLength) { baseDanLength = Vector3.Distance(dan101.position, dan109.position); if (Geometry.ApproximatelyZero(baseDanLength)) { baseDanLength = 1.8f; } } danPoints = new DanPoints(dan101, dan109, danTop); lastDanPostion = new Vector3(0, 0, 0); bDansFound = true; danCollider = dan101.GetComponent <DynamicBoneCollider>(); if (danCollider == null) { danCollider = dan101.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } danCollider.m_Direction = DynamicBoneColliderBase.Direction.Z; danCollider.m_Bound = DynamicBoneColliderBase.Bound.Outside; danCollider.m_Center = new Vector3(0, _dan_collider_verticalcenter.Value, baseDanLength / 2); danCollider.m_Radius = _dan_collider_radius.Value; danCollider.m_Height = baseDanLength + (_dan_collider_headlength.Value * 2); } if (index != null && middle != null && ring != null) { indexCollider = index.GetComponent <DynamicBoneCollider>(); middleCollider = middle.GetComponent <DynamicBoneCollider>(); ringCollider = ring.GetComponent <DynamicBoneCollider>(); if (indexCollider == null) { indexCollider = index.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } if (middleCollider == null) { middleCollider = middle.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } if (ringCollider == null) { ringCollider = ring.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } indexCollider.m_Direction = DynamicBoneColliderBase.Direction.X; indexCollider.m_Center = new Vector3(0, 0, 0); indexCollider.m_Bound = DynamicBoneColliderBase.Bound.Outside; indexCollider.m_Radius = _finger_collider_radius.Value; indexCollider.m_Height = _finger_collider_length.Value; middleCollider.m_Direction = DynamicBoneColliderBase.Direction.X; middleCollider.m_Center = new Vector3(0, 0, 0); middleCollider.m_Bound = DynamicBoneColliderBase.Bound.Outside; middleCollider.m_Radius = _finger_collider_radius.Value; middleCollider.m_Height = _finger_collider_length.Value; ringCollider.m_Direction = DynamicBoneColliderBase.Direction.X; ringCollider.m_Center = new Vector3(0, 0, 0); ringCollider.m_Bound = DynamicBoneColliderBase.Bound.Outside; ringCollider.m_Radius = _finger_collider_radius.Value; ringCollider.m_Height = _finger_collider_length.Value; } Console.WriteLine("bDansFound " + bDansFound); } } bHPointsFound = false; foreach (var female in fem_list.Where(female => female != null)) { if (!bHPointsFound) { List <Transform> frontHPoints = new List <Transform>(); List <Transform> backHPoints = new List <Transform>(); Transform hPointBackOfHead; for (int index = 0; index < frontHPointsList.Count; index++) { frontHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(frontHPointsList[index])).FirstOrDefault()); } for (int index = 0; index < backHPointsList.Count; index++) { backHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(backHPointsList[index])).FirstOrDefault()); } hPointBackOfHead = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(headHPoint)).FirstOrDefault(); bpKokanTarget = female.GetComponentsInChildren <Transform>(true).Where(x => x.name.Equals(bp_kokan_target)).FirstOrDefault(); if (bpKokanTarget != null) { if (bpKokanTarget.gameObject.activeSelf == false) { bpKokanTarget.gameObject.SetActive(true); } Console.WriteLine("BP Target Found " + bpKokanTarget.name); frontHPoints[0] = bpKokanTarget; } if (frontHPoints.Count == frontHPointsList.Count && backHPoints.Count == backHPointsList.Count && hPointBackOfHead != null) { bHPointsFound = true; constrainPoints = new ConstrainPoints(frontHPoints, backHPoints, hPointBackOfHead); } foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>(true).Where(x => x.name.Contains("cf_J_Vagina"))) { db.m_Colliders.Clear(); } Console.WriteLine("bHPointsFound " + bHPointsFound); Transform kokanBone = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains("cf_J_Kokan")).FirstOrDefault(); List <DynamicBone> dbList = new List <DynamicBone>(); foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>(true).Where(x => x.name.Contains("cf_J_Vagina"))) { if (db == null) { continue; } if (db.enabled == false) { db.enabled = true; } if (db.m_Root != null) { int colliderIndex = dynamicBonesList.IndexOf(db.m_Root.name); if (colliderIndex >= 0) { // DynamicBoneCollider dbc = female.GetComponentsInChildren<DynamicBoneCollider>().Where(x => x.name.Contains(colliderList[colliderIndex])).FirstOrDefault(); // if (dbc == null) // { Transform colliderTransform = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(colliderList[colliderIndex])).FirstOrDefault(); if (colliderTransform != null) { Console.WriteLine("collider " + colliderTransform.name); // dbc = colliderTransform.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; // dbc.m_Bound = DynamicBoneColliderBase.Bound.Inside; // dbc.m_Direction = DynamicBoneColliderBase.Direction.Y; if (kokanBone == null) { // dbc.m_Height = colliderHeightList[colliderIndex]; // dbc.m_Radius = colliderRadiusList[colliderIndex]; } else { if (colliderIndex < 3) { // dbc.m_Height = colliderHeightList[colliderIndex] * kokanBone.lossyScale.z; // dbc.m_Radius = colliderRadiusList[colliderIndex] * kokanBone.lossyScale.z; db.m_Radius *= kokanBone.lossyScale.z; } else { // dbc.m_Height = colliderHeightList[colliderIndex] * (kokanBone.lossyScale.x + kokanBone.lossyScale.z) / 2; // dbc.m_Radius = colliderRadiusList[colliderIndex] * (kokanBone.lossyScale.x + kokanBone.lossyScale.z) / 2; db.m_Radius *= (kokanBone.lossyScale.x + kokanBone.lossyScale.z) / 2; } } } // } // if (_use_bounding_colliders.Value && dbc != null) // db.m_Colliders.Add(dbc); } else if (kokanBone != null) { db.m_Radius *= kokanBone.lossyScale.x; } db.UpdateParameters(); dbList.Add(db); } } kokanBones = dbList; } kokanBoneAdjustTarget = fem_list[0].GetComponentsInChildren <Transform>().Where(x => x.name.Contains("cf_J_Kokan")).FirstOrDefault(); } Console.WriteLine("AddColliders done."); }
public static void AddPColliders(HScene __instance) { hScene = __instance; male_list = __instance.GetMales().Where(male => male != null).ToArray(); fem_list = __instance.GetFemales().Where(female => female != null).ToArray(); danCollider = new DynamicBoneCollider(); constrainPoints = new ConstrainPoints(); kokanBones = new List <DynamicBone>(); bDansFound = false; foreach (var male in male_list.Where(male => male != null)) { if (!bDansFound) { Transform dan101 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_base)).FirstOrDefault(); Transform dan109 = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_head)).FirstOrDefault(); Transform danTop = male.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(dan_sack)).FirstOrDefault(); bDanPenetration = false; if (dan101 != null && dan109 != null && danTop != null) { danPoints = new DanPoints(dan101, dan109, danTop); bDansFound = true; dan101.localScale = new Vector3(_dan_girth.Value, _dan_girth.Value, 1); danCollider = dan101.GetComponent <DynamicBoneCollider>(); if (danCollider == null) { danCollider = dan101.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; } danCollider.m_Direction = DynamicBoneColliderBase.Direction.Z; danCollider.m_Center = new Vector3(0, _dan_collider_verticalcenter.Value, _dan_length.Value / 2); danCollider.m_Bound = DynamicBoneColliderBase.Bound.Outside; danCollider.m_Radius = _dan_collider_radius.Value; danCollider.m_Height = _dan_length.Value + (_dan_collider_headlength.Value * 2); danPoints.danTop.localScale = new Vector3(_dan_sack_size.Value, _dan_sack_size.Value, _dan_sack_size.Value); lastDan109Position = danPoints.danEnd.position; lastDanRotation = danPoints.danEnd.rotation; lastDanVector = danPoints.danEnd.position - danPoints.danStart.position; lastDanLength = _dan_length.Value; lastAdjustTime = Time.time; } referenceLookAtTarget = danPoints.danEnd; lastDan101TargetDistance = Vector3.Distance(referenceLookAtTarget.position, danPoints.danStart.position); Console.WriteLine("bDansFound " + bDansFound); } } bHPointsFound = false; foreach (var female in fem_list.Where(female => female != null)) { if (!bHPointsFound) { List <Transform> frontHPoints = new List <Transform>(); List <Transform> backHPoints = new List <Transform>(); Transform hPointBackOfHead; for (int index = 0; index < frontHPointsList.Length; index++) { frontHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(frontHPointsList[index])).FirstOrDefault()); } for (int index = 0; index < backHPointsList.Length; index++) { backHPoints.Add(female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(backHPointsList[index])).FirstOrDefault()); } hPointBackOfHead = female.GetComponentsInChildren <Transform>().Where(x => x.name.Contains(headHPoint)).FirstOrDefault(); bpKokanTarget = female.GetComponentsInChildren <Transform>().Where(x => x.name.Equals(bp_kokan_target)).FirstOrDefault(); if (bpKokanTarget != null) { Console.WriteLine("BP Target Found " + bpKokanTarget.name); frontHPoints[0] = bpKokanTarget; } if (frontHPoints.Count == frontHPointsList.Length && backHPoints.Count == backHPointsList.Length && hPointBackOfHead != null) { bHPointsFound = true; constrainPoints = new ConstrainPoints(frontHPoints, backHPoints, hPointBackOfHead); } foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>().Where(x => x.name.Contains("cf_J_Vagina"))) { db.m_Colliders.Clear(); } Console.WriteLine("bHPointsFound " + bHPointsFound); /* for (int i = 0; i < colliderList.Length; i++) * { * DynamicBone db = female.GetComponentsInChildren<DynamicBone>().Where(x => x.m_Root.name.Equals(dynamicBonesList[i])).FirstOrDefault(); * DynamicBoneCollider dbc = female.GetComponentsInChildren<DynamicBoneCollider>().Where(x => x.name.Equals(colliderList[i])).FirstOrDefault(); * * if (dbc == null) * { * Transform colliderTransform = female.GetComponentsInChildren<Transform>().Where(x => x.name.Contains(colliderList[i])).FirstOrDefault(); * * if (colliderTransform != null) * { * dbc = colliderTransform.gameObject.AddComponent(typeof(DynamicBoneCollider)) as DynamicBoneCollider; * dbc.m_Bound = DynamicBoneColliderBase.Bound.Inside; * dbc.m_Direction = DynamicBoneColliderBase.Direction.Y; * dbc.m_Height = colliderHeightList[i]; * dbc.m_Radius = colliderRadiusList[i]; * } * } * * if (db != null && dbc != null) * { * db.m_Colliders.Add(dbc); * * Console.WriteLine(dbc.name + " collider radius " + dbc.m_Radius + ", height: " + dbc.m_Height); * * foreach (DynamicBoneColliderBase dbcb in db.m_Colliders) * Console.WriteLine(db.m_Root.name + " collider " + dbcb.name); * } * else * { * if (db == null) * Console.WriteLine(dynamicBonesList[i] + " bone not found for " + female.name); * if (dbc == null) * Console.WriteLine(colliderList[i] + " collider not found for " + female.name); * } * } */ List <DynamicBone> dbList = new List <DynamicBone>(); foreach (DynamicBone db in female.GetComponentsInChildren <DynamicBone>().Where(x => x.name.Contains("cf_J_Vagina"))) { if (db != null) { dbList.Add(db); } } kokanBones = dbList; } } inHScene = true; Console.WriteLine("AddColliders done."); }