static void makeSeeking(UnhollowerBaseLib.Il2CppReferenceArray <AttackModel> attacks, string name) { foreach (var attack in attacks) { if (!doesNotTargetBloons.Any(attack.name.Contains)) { foreach (var proj in attack.GetAllProjectiles()) { if (proj.HasBehavior <ArriveAtTargetModel>()) { continue; } if (name.ToLower().Contains("boomerang")) { //proj.RemoveBehavior<TrackTargetWithinTimeModel>(); proj.RemoveBehavior <FollowPathModel>(); proj.AddBehavior(new TravelStraitModel("lol", 175, 2)); } if (proj.HasBehavior <TravelStraitModel>()) { proj.AddBehavior(seeking); } } } } }
public BackingFieldOrArray(UnhollowerBaseLib.Il2CppReferenceArray <UnityEngine.Object> array) #endif { _field = null; _array = array; _source = BackingSource.Array; }
public static UnhollowerBaseLib.Il2CppReferenceArray <T> AddToArr <T>(UnhollowerBaseLib.Il2CppReferenceArray <T> arr, T value) where T : UnhollowerBaseLib.Il2CppObjectBase { List <T> list = new List <T>(arr); list.Add(value); return(list.ToArray()); }
private void pollSongState() { if (this.songPlaying) { string songClass = "custom"; if (this.songData.IsCoreSong()) { songClass = "ost"; } if (this.songData.dlc) { songClass = "dlc"; } if (this.songData.extrasSong) { songClass = "extras"; } // We don't want to calculate the ticks to the end of the song, it keeps playing! // Instead get the last target (plus its length) as the end ticks UnhollowerBaseLib.Il2CppReferenceArray <SongCues.Cue> cues = AudicaGameStateManager.songCues.mCues.cues; SongCues.Cue endCue = cues[cues.Length - 1]; float songEndTicks = endCue.tick + endCue.tickLength; float currentTick = AudicaGameStateManager.scoreKeeper.mLastTick; float totalTimeMs = this.songCalculator.SongLengthMilliseconds; float currentTimeMs = this.songCalculator.GetSongPositionMilliseconds(currentTick); float remainingTimeMs = totalTimeMs - currentTimeMs; this.songState.songId = this.songData.songID; this.songState.songName = this.songData.title; this.songState.songArtist = this.songData.artist; this.songState.songAuthor = this.songData.author; this.songState.difficulty = KataConfig.GetDifficultyName(AudicaGameStateManager.config.GetDifficulty()); this.songState.classification = songClass; this.songState.songLength = TimeSpan.FromMilliseconds(Convert.ToInt64(totalTimeMs)).ToString(); this.songState.timeElapsed = TimeSpan.FromMilliseconds(Convert.ToInt64(currentTimeMs)).ToString(); this.songState.timeRemaining = TimeSpan.FromMilliseconds(Convert.ToInt64(remainingTimeMs)).ToString(); this.songState.progress = currentTimeMs / totalTimeMs; this.songState.currentTick = currentTick; this.songState.ticksTotal = songEndTicks; this.songState.songSpeed = KataConfig.GetCueDartSpeedMultiplier(); // TODO: not a clue what this value actually is but it's not the speed multiplier! this.songState.health = AudicaGameStateManager.scoreKeeper.GetHealth(); this.songState.score = AudicaGameStateManager.scoreKeeper.mScore; this.songState.scoreMultiplier = AudicaGameStateManager.scoreKeeper.GetRawMultiplier(); this.songState.streak = AudicaGameStateManager.scoreKeeper.GetStreak(); this.songState.highScore = AudicaGameStateManager.scoreKeeper.GetHighScore(); this.songState.isNoFailMode = AudicaGameStateManager.prefs.NoFail.mVal; this.songState.isPracticeMode = AudicaGameStateManager.config.practiceMode; this.songState.isFullComboSoFar = AudicaGameStateManager.scoreKeeper.GetIsFullComboSoFar(); this.songState.modifiers = AudicaGameStateManager.modifiers.GetCurrentModifiers() .Select((GameplayModifiers.Modifier mod) => GameplayModifiers.GetModifierString(mod)) .ToList <string>(); } }
public static T SearchList <T>(UnhollowerBaseLib.Il2CppReferenceArray <T> list, string name) where T : MonoBehaviour { IEnumerable <T> elem = list.Where(t => t.name == name); if (elem.Count() > 0) { return(elem.First()); } return(null); }
/// <summary> /// Get the MainMenu game object /// </summary> public static GameObject GetUI(this MainMenu mainMenu) { try { Scene scene = SceneManager.GetSceneByName("MainMenuUi"); UnhollowerBaseLib.Il2CppReferenceArray <GameObject> rootGameObjects = scene.GetRootGameObjects(); GameObject ui = rootGameObjects[0]; return(ui); } catch (Exception) { return(null); } }
void Start() { brain = GetComponent <AIBrain>(); OriginalDeathSounds = brain.behaviour.sfx.death; if (brain.puppetMaster.muscles[brain.puppetMaster.GetMuscleIndex(HumanBodyBones.Head)] != null) { brain.puppetMaster.muscles[brain.puppetMaster.GetMuscleIndex(HumanBodyBones.Head)].IgnoreAngularLimits(false); } attack = new Attack(); attack.damage = 99999; NeckBreakForce = MelonPrefs.GetFloat("ByeByeBones", "NeckBreakForce"); }
private void Precalc() { this.song = SongDataHolder.I.songData; UnhollowerBaseLib.Il2CppReferenceArray <SongCues.Cue> cues = AudicaGameStateManager.songCues.mCues.cues; SongCues.Cue endCue = cues[cues.Length - 1]; float endTick = endCue.tick + endCue.tickLength; this.songLengthMs = 0; for (int i = 0; i < song.tempos.Length; i++) { float startChunkTick = song.tempos[i].tick; float endChunkTick = endTick; // if it's NOT the last tempo change, grab the tick from the next one instead. if (i != song.tempos.Length - 1) { endChunkTick = song.tempos[i + 1].tick; } // complete chunk length in ticks float chunkTickLength = endChunkTick - startChunkTick; // ms accumulator float chunkMilliseconds = GetTicksMillisconds(chunkTickLength, song.tempos[i].tempo); this.songLengthMs += chunkMilliseconds; // cache ChunkCache chunk = new ChunkCache(); chunk.startTick = startChunkTick; chunk.endTick = endChunkTick; chunk.lengthMs = chunkMilliseconds; this.chunkCache.Add(chunk); } }
internal static void AddBreakDownComponent(GameObject gameObject, BreakDownDefinition objDef) { BreakDown breakDown = gameObject.AddComponent <BreakDown>(); BreakDown.m_BreakDownObjects.Add(breakDown); RCUtils.SetLayer(gameObject, vp_Layer.InteractiveProp); //Object yields if (objDef.yield != null && objDef.yield.Length > 0 && Settings.options.objectYields) { List <GameObject> itemYields = new List <GameObject>(); List <int> numYield = new List <int>(); foreach (BreakDownYield yield in objDef.yield) { if (yield.item.Trim() != "") { //GameObject yieldItem = Resources.Load("GEAR_" + yield.item).Cast<GameObject>(); GameObject yieldItem = null; UnityEngine.Object yieldItemObj = Resources.Load("GEAR_" + yield.item); if (yieldItemObj != null) { yieldItem = yieldItemObj.Cast <GameObject>(); itemYields.Add(yieldItem); numYield.Add(yield.num); } else { Debug.Log("[remove-clutter] Yield GEAR_" + yield.item + " couldn't be loaded."); } } } breakDown.m_YieldObject = itemYields.ToArray(); breakDown.m_YieldObjectUnits = numYield.ToArray(); } else { breakDown.m_YieldObject = new GameObject[0]; breakDown.m_YieldObjectUnits = new int[0]; } //Time to harvest if (objDef.minutesToHarvest > 0 && !Settings.options.fastBreakDown) { breakDown.m_TimeCostHours = objDef.minutesToHarvest / 60; } else { breakDown.m_TimeCostHours = 1f / 60; } //Harvest sound /*MetalSaw * WoodSaw * Outerwear * MeatlSmall * Generic * Metal * MeatlMed * Cardboard * WoodCedar * NylonCloth * Plants * Paper * Wood * Wool * Leather * WoodReclaimedNoAxe * WoodReclaimed * Cloth * MeatLarge * WoodSmall * WoodFir * WoodAxe */ if (objDef.sound.Trim() != "" && objDef.sound != null) { breakDown.m_BreakDownAudio = "Play_Harvesting" + objDef.sound; } else { breakDown.m_BreakDownAudio = "Play_HarvestingGeneric"; } //Display name if (Settings.options.showObjectNames) { String rawName = objDef.filter.Replace("_", string.Empty); String[] objWords = Regex.Split(rawName, @"(?<!^)(?=[A-Z])"); String objName = String.Join(" ", objWords); breakDown.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = objName }; } else { breakDown.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = "GAMEPLAY_BreakDown" }; } //Required Tools if (objDef.requireTool == true && Settings.options.toolsNeeded) { breakDown.m_RequiresTool = true; } if (objDef.tools != null && objDef.tools.Length > 0 && Settings.options.toolsNeeded) { Il2CppSystem.Collections.Generic.List <GameObject> itemTools = new Il2CppSystem.Collections.Generic.List <GameObject>(); foreach (String tool in objDef.tools) { GameObject selectedTool = null; if (tool.ToLower() == "knife") { selectedTool = Resources.Load("GEAR_Knife").Cast <GameObject>(); } else if (tool.ToLower() == "hacksaw") { selectedTool = Resources.Load("GEAR_Hacksaw").Cast <GameObject>(); } else if (tool.ToLower() == "hatchet") { selectedTool = Resources.Load("GEAR_Hatchet").Cast <GameObject>(); } else if (tool.ToLower() == "hammer") { selectedTool = Resources.Load("GEAR_Hammer").Cast <GameObject>(); } if (selectedTool != null) { itemTools.Add(selectedTool); } else { Debug.Log("[remove-clutter] Tool " + tool + " couldn't be loaded or doesn't exist."); } } UnhollowerBaseLib.Il2CppReferenceArray <GameObject> toolsArray = new UnhollowerBaseLib.Il2CppReferenceArray <GameObject>(itemTools.ToArray()); if (toolsArray.Length > 0) { breakDown.m_UsableTools = toolsArray; } else { Debug.Log("[remove-clutter] Tools array is empty."); breakDown.m_RequiresTool = false; breakDown.m_UsableTools = new GameObject[0]; } } else { breakDown.m_UsableTools = new GameObject[0]; } }
internal AssetLoadedContext(AssetLoadedParameters parameters, AssetBundle bundle, UnhollowerBaseLib.Il2CppReferenceArray <UnityEngine.Object> assets) #endif { Parameters = parameters; Bundle = bundle; _backingField = new BackingFieldOrArray(assets); }
internal ResourceLoadedContext(ResourceLoadedParameters parameters, UnhollowerBaseLib.Il2CppReferenceArray <UnityEngine.Object> assets) #endif { Parameters = parameters; _backingField = new BackingFieldOrArray(assets); }
public static bool Button(GUIContent content, GUIStyle style, UnhollowerBaseLib.Il2CppReferenceArray <GUILayoutOption> options) => throw new NotImplementedException();
public static void Label(string text, GUIStyle style, UnhollowerBaseLib.Il2CppReferenceArray <GUILayoutOption> options)
/****** SETUP ******/ internal static void AddGameLights() { if (AmbientLights.config == null || !AmbientLights.config.ready) { return; } //if (AmbientLights.debugVer) // Debug.Log("[ambient-lights] InteriorLightingManager initialized."); //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Game Lights init"); ALUtils.Log("Game Lights Manager initialized."); if (gameLightsList != null) { gameLightsList.Clear(); } if (gameExtraLightsList != null) { gameExtraLightsList.Clear(); } if (gameSpotLightsList != null) { gameSpotLightsList.Clear(); } if (gameExtraLightsColors != null) { gameExtraLightsColors.Clear(); } if (gameExtraLightsIntensity != null) { gameExtraLightsIntensity.Clear(); } if (gameWindows != null) { gameWindows.Clear(); } theSun = null; sunlight = null; //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Add Game Lights"); ALUtils.Log("Adding game lights.", false); gameLights = new GameObject(); List <InteriorLightingGroup> lightGroups = new List <InteriorLightingGroup>(); InteriorLightingGroup[] lightGroupsArr = null; if (mngr != null) { lightGroupsArr = mngr.m_LightGroupList.ToArray(); foreach (InteriorLightingGroup lightGroup in lightGroupsArr) { lightGroups.Add(lightGroup); } } int pCount = 0; int sCount = 0; int wCount = 0; int eCount = 0; int lCount = 0; //Add sun if (!AmbientLights.currentScene.ToLower().Contains("cave") && Settings.options.trueSun) { //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Add sun"); ALUtils.Log("Creating sun", false); theSun = new GameObject(); theSun.name = "AmbientLightsSun"; sunlight = theSun.AddComponent <Light>(); sunlight.type = LightType.Directional; sunlight.shadows = LightShadows.Soft; sunlight.shadowStrength = 1f; sunlight.shadowNormalBias = 0; sunlight.shadowBias = 0; sunlight.shadowResolution = UnityEngine.Rendering.LightShadowResolution.VeryHigh; sunlight.cullingMask &= ~(1 << 7); sunlight.intensity = 1f; theSun.transform.position = new Vector3(0, 2f, 0); sunlight.transform.parent = theSun.transform; Vector3 sunRotation = new Vector3(10f, 10f, 0); theSun.transform.localRotation = Quaternion.Euler(sunRotation); PrepareSceneShadows(); } //Window Lights //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Window lights"); ALUtils.Log("Adding window lights", false); foreach (InteriorLightingGroup group in lightGroups) { List <Light> lights = new List <Light>(); Light[] groupLights = group.GetLights().ToArray(); foreach (Light gLight in groupLights) { if (gLight != null) { lights.Add(gLight); } else { //if (AmbientLights.debugVer) // Debug.Log("[ambient-lights] gLight is null."); ALUtils.Log("gLight is null", false); } } foreach (Light light in lights) { GameObject lightMark; //Add lights to list and to debug object if (light.type == LightType.Point) { lightMark = GameObject.CreatePrimitive(PrimitiveType.Sphere); (lightMark.GetComponent(UnhollowerRuntimeLib.Il2CppType.Of <SphereCollider>()).Cast <Collider>()).enabled = false; light.gameObject.name += "_XPZ_GameLight"; gameLightsList.Add(light); pCount++; } else if (light.type == LightType.Spot) { lightMark = GameObject.CreatePrimitive(PrimitiveType.Cube); lightMark.transform.rotation = light.gameObject.transform.rotation; sCount++; light.gameObject.name += "_XPZ_SpotLight"; gameSpotLightsList.Add(light); } else { lightMark = GameObject.CreatePrimitive(PrimitiveType.Cylinder); } lightMark.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f); lightMark.transform.position = light.gameObject.transform.position; lightMark.transform.parent = gameLights.transform; foreach (Renderer rend in lightMark.GetComponentsInChildren <Renderer>()) { rend.material.color = light.color; rend.receiveShadows = false; } } } //Main Ambient Light //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Main Ambient Light"); ALUtils.Log("Adding main ambient light", false); if (mngr != null) { gameAmbientLight = mngr.m_AmbientLight; } else { TodAmbientLight[] array = UnityEngine.Object.FindObjectsOfType <TodAmbientLight>(); if (array.Length > 0) { gameAmbientLight = array[0]; } } if (gameAmbientLight != null) { defaultColorDay = gameAmbientLight.m_AmbientIndoorsDay; defaultColorNight = gameAmbientLight.m_AmbientIndoorsNight; gameAmbientLight.name += "_XPZ_AmbientLight"; //if (AmbientLights.debugVer) // Debug.Log("[ambient-lights] Ambient light found."); ALUtils.Log("Main ambient light found", false); } else { //if (AmbientLights.debugVer) // Debug.Log("[ambient-lights] Ambient light NOT found."); ALUtils.Log("Main ambient light missing", false); } //Loose Lights //With Manager //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Managed Loose Lights"); ALUtils.Log("Adding managed loose lights", false); List <Light> looseLights = new List <Light>(); List <Light> looseLightsMidday = new List <Light>(); Light[] lLightsArr = null; if (mngr != null && mngr.m_LooseLightList != null) { lLightsArr = mngr.m_LooseLightList.ToArray(); } Light[] lLightsMidArr = null; if (mngr != null && mngr.m_LooseLightsMiddayList != null) { lLightsMidArr = mngr.m_LooseLightsMiddayList.ToArray(); } List <Light> extraLights = new List <Light>(); List <Color> extraLightsColor = new List <Color>(); if (lLightsArr != null) { foreach (Light l in lLightsArr) { if (!l.gameObject.name.Contains("XPZ_SpotLight") && !l.gameObject.name.Contains("XPZ_GameLight")) { l.gameObject.name += "_XPZ_GameLight"; extraLights.Add(l); lCount++; } } } if (lLightsMidArr != null) { foreach (Light l in lLightsMidArr) { if (!l.gameObject.name.Contains("XPZ_SpotLight") && !l.gameObject.name.Contains("XPZ_GameLight")) { l.gameObject.name += "_XPZ_GameLight"; extraLights.Add(l); lCount++; } } } foreach (Light light in extraLights) { extraLightsColor.Add(light.color); gameExtraLightsColors.Add(light.color); gameExtraLightsIntensity.Add(light.intensity); gameExtraLightsList.Add(light); } //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Unmanaged Loose Lights"); ALUtils.Log("Adding unmanaged loose lights", false); //No Manager UnhollowerBaseLib.Il2CppReferenceArray <UnityEngine.Object> sclights = UnityEngine.Object.FindObjectsOfType(UnhollowerRuntimeLib.Il2CppType.Of <Light>()); foreach (UnityEngine.Object lightItem in sclights) { Light light = lightItem.Cast <Light>(); if (!light.gameObject.name.Contains("XPZ_GameLight") && !light.gameObject.name.Contains("XPZ_Light") && light.type == LightType.Point) { light.gameObject.name += "_XPZ_GameLight"; gameExtraLightsList.Add(light); gameExtraLightsColors.Add(light.color); gameExtraLightsIntensity.Add(light.intensity); eCount++; } else if (!light.gameObject.name.Contains("XPZ_SpotLight") && !light.gameObject.name.Contains("XPZ_GameLight") && light.type == LightType.Spot) { if (light.cookie && light.cookie.ToString().Contains("Window")) { light.gameObject.name += "_XPZ_SpotLight"; gameSpotLightsList.Add(light); } else { light.gameObject.name += "_XPZ_GameLight"; gameExtraLightsList.Add(light); gameExtraLightsColors.Add(light.color); gameExtraLightsIntensity.Add(light.intensity); eCount++; } } } //Add fill lights to debug object //if (AmbientLights.debugVer) // MelonLoader.MelonLogger.Log("[AL] Add to debug"); ALUtils.Log("Adding fill lights to debug object", false); foreach (Light light in gameExtraLightsList) { GameObject eLightMark; eLightMark = GameObject.CreatePrimitive(PrimitiveType.Sphere); //eLightMark.GetComponent(typeof(SphereCollider)).Cast<Collider>().enabled = false; eLightMark.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f); eLightMark.transform.position = light.gameObject.transform.position; eLightMark.transform.parent = gameLights.transform; foreach (Renderer rend in eLightMark.GetComponentsInChildren <Renderer>()) { rend.material.color = light.color; rend.receiveShadows = false; } } int weCount = GetWindows(); if (!AmbientLights.showGameLights) { gameLights.SetActive(false); } //MelonLoader.MelonModLogger.Log("[AL] Done Preparing"); //if (AmbientLights.debugVer) // Debug.Log("[ambient-lights] Gamelights setup done. Window Lights:" + pCount + ". Spotlights:" + sCount + ". Loose Lights:" + lCount + ". Windows:" + wCount + ". Windows outside lighting groups:" + weCount + ". Extra Lights:" + eCount); ALUtils.Log("Gamelights setup complete. Window Lights:" + pCount + ". Spotlights:" + sCount + ". Loose Lights:" + lCount + ". Windows:" + wCount + ". Windows outside lighting groups:" + weCount + ". Extra Lights:" + eCount, false); AmbientLights.SetupGameLights(); gameLightsReady = true; }