public static bool Prefix(UnityToSimulation __instance, ref MapModel map) { map.mapWideBloonSpeed = 5; //map.areas[0].polygon. for (int p = 0; p < map.paths.Count; p++) { Il2CppReferenceArray <PointInfo> arr = new Il2CppReferenceArray <PointInfo>(map.paths[p].points.Count); for (int i = 0; i < map.paths[p].points.Count; i++) { PointInfo pointinfo = map.paths[p].points[i]; var vec = pointinfo.point; //map.paths[0].points[i] pointinfo.point = new Assets.Scripts.Simulation.SMath.Vector3(vec.x + ((float)r.NextDouble() * 10), vec.y + ((float)r.NextDouble() * 10), vec.z); arr[i] = pointinfo; } map.paths[p].points = arr; } return(true); }
internal static void Prefix(UnityToSimulation __instance) { IGameInstance gameInstance = NGameInstance.GetGame(); int currentRound = __instance.simulation.GetSpawnedRound() + 1; var o = new GameEvents.RoundStartEvent(gameInstance, currentRound); //Create RoundStartEvent instance EventRegistry.instance.DispatchEvent(ref o); //Dispatch it }
internal static void Postfix(BloonToSimulation __instance, UnityToSimulation sim, ulong id, Vector3 position, float distanceTravelled, float pathTotalDistance, BloonModel def) { SessionData.bloonTracker.TrackBloonToSim(__instance); }
public static bool Prefix(UnityToSimulation __instance, ref MapModel map) { if (!isCustom(lastMap)) { return(true); } Texture2D tex = null; string filePath = @"Mods\Maps\" + lastMap + ".png"; byte[] fileData = File.ReadAllBytes(filePath); fileData = Resize(fileData, 1652, 1064); if (File.Exists(filePath)) { //fileData = File.ReadAllBytes(filePath); //float divx = 2; //float divy = 1.21f; //int marginx = 190; //int marginy = 430; float divx = 2; float divy = 1.21f; int marginx = 450; int marginy = 890; Bitmap old = new Bitmap(Image.FromStream(new MemoryStream(fileData)));//new Bitmap(filePath); Bitmap newImage = new Bitmap(old.Width + marginx, old.Height + marginy); //var paddingColor = new System.Drawing.Color(255, 255, 255); using (var graphics = System.Drawing.Graphics.FromImage(newImage)) { //graphics.Clear(paddingColor); int x = (int)((newImage.Width - old.Width) / divx); int y = (int)((newImage.Height - old.Height) / divy); graphics.DrawImage(old, x, y); using (MemoryStream ms = new MemoryStream()) { newImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png); fileData = ms.ToArray(); } } tex = new Texture2D(2, 2); ImageConversion.LoadImage(tex, fileData); } var ob2 = GameObject.Find("MuddyPuddlesTerrain"); ob2.GetComponent <Renderer>().material.mainTexture = tex; //ob2.GetComponent<Renderer>().material.mainTextureOffset = new Vector2(0, 0); //ob2.GetComponent<Renderer>().material.mainTextureScale = new Vector2(1, 1); foreach (var ob in UnityEngine.Object.FindObjectsOfType <GameObject>()) { if (ob.name.Contains("Candy") || ob.name.Contains("Gift") || ob.name.Contains("Snow") || ob.name.Contains("Ripples") || ob.name.Contains("Grass") || ob.name.Contains("Christmas") || ob.name.Contains("WhiteFlower") || ob.name.Contains("Tree") || ob.name.Contains("Rock") || ob.name.Contains("Shadow") || ob.name.Contains("WaterSplashes"))// || ob.name.Contains("Body") || ob.name.Contains("Ouch") || ob.name.Contains("Statue")|| ob.name.Contains("Chute") || ob.name.Contains("Jump") || ob.name.Contains("Timer") || ob.name.Contains("Wheel") || ob.name.Contains("Body") || ob.name.Contains("Axle") || ob.name.Contains("Leg") || ob.name.Contains("Clock") || { if (ob.name != "MuddyPuddlesTerrain") { ob.transform.position = new Vector3(1000, 1000, 1000); } } //if (ob.name.Contains("Tree")) // GameObject.Destroy(ob); } //foreach (var ob in UnityEngine.Object.FindObjectsOfType<GameObject>()) //{ // if (ob.GetComponent<Renderer>()) // { // if (ob.name.Contains("Candy") || ob.name.Contains("Statue") || ob.name.Contains("Body") || ob.name.Contains("Chute") || ob.name.Contains("Gift") || ob.name.Contains("Snow") || ob.name.Contains("Jump") || ob.name.Contains("Timer") || ob.name.Contains("Ripples") || ob.name.Contains("Clock") || ob.name.Contains("Grass") || ob.name.Contains("Christmas") || ob.name.Contains("WhiteFlower") || ob.name.Contains("Tree") || ob.name.Contains("Rock") || ob.name.Contains("Wheel") || ob.name.Contains("Body") || ob.name.Contains("Axle") || ob.name.Contains("Shadow") || ob.name.Contains("Leg") || ob.name.Contains("WaterSplashes") || ob.name.Contains("Ouch")) // ob.transform.position = new Vector3(1000, 1000, 1000); // if (ob.name.Contains("Statue")) // GameObject.Destroy(ob); // } //} //cube.GetComponent<Renderer>().material = GameObject.Find("OuchTerrainGrateless").GetComponent<Renderer>().material; //cube.GetComponent<Renderer>().material.mainTexture = tex; MapData mapdata = listOfMaps.Where(x => x.name == lastMap).First(); map.areas = mapdata.areas; map.spawner = mapdata.spawner; map.paths = mapdata.paths; if (GameObject.Find("Rain")) { GameObject.Find("Rain").active = false; } return(true); }
public static List <Projectile> GetAllProjectiles(this UnityToSimulation unityToSimulation) { return(InGame.instance.GetAllObjectsOfType <Projectile>()); }
/// <summary> /// Custom API method that changes the game's round set to a custom RoundSetModel. /// </summary> /// <param name="roundSet">New Round Set Model to use</param> public static void SetRoundSet(this UnityToSimulation unityToSimulation, RoundSetModel roundSet) { Api.SessionData.RoundSet = roundSet; }