void Start() { FieldGenerate(DungeonGenerator2.Generate(//new Vector2Int(_width, _height))); RoomType.Room, roomSettings, new Vector2Int(_width, _height), new Vector2Int(_width / 2, _height / 2))); }
private System.Collections.IEnumerator DungeonGenerator2_GenerateDungeonUsingSeedCoroutine(On.DungeonGenerator2.orig_GenerateDungeonUsingSeedCoroutine orig, DungeonGenerator2 self, int level, int randomSeed, Amplitude.StaticString shipName) { if (shipName == GetName()) { DynData <DungeonGenerator2> d = new DynData <DungeonGenerator2>(self); d.Set <int>("randomSeed", randomSeed); Log("Calling GenerateDungeonUsingSeedCoroutine!"); yield return(typeof(DungeonGenerator2).GetMethod("GenerateDungeonCoroutine", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(self, new object[] { level, new Amplitude.StaticString(DungeonPodWrapper.Value) })); yield break; } Log("Calling Original GenerateDungeonUsingSeedCoroutine!"); yield return(orig(self, level, randomSeed, shipName)); }
private static IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, StaticString shipName) { // Preferably, sort all SeedCollections in Collections by most current file SeedCollection collection = GetMostCurrentSeeds(shipName, level); if (collection != null) { if (collection.Enabled) { if (collection.EnqueNotification) { SingletonManager.Get <Dungeon>(false).EnqueueNotification("Using Seeds: " + collection.GetSeedForShipLevel(shipName, level)); } collection.SetSeedForShipLevel(shipName, level); } if (collection.AddNewSeeds) { if (collection.GetSeedsForShip(shipName) == null) { collection.Add(shipName); } collection.Add(shipName, level, new SeedData()); if (collection.EnqueNotification) { SingletonManager.Get <Dungeon>(false).EnqueueNotification("Added Seeds: " + collection.GetSeedForShipLevel(shipName, level)); } } } yield return(orig(self, level, shipName)); }
private System.Collections.IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, Amplitude.StaticString shipName) { if (new DynData <DungeonGenerator2>(self).Get <bool>("IsGeneratingForRuntime")) { GameConfig c = GameConfig.GetGameConfig(); if (capRoomsWrapper.Value && (int)c.DungeonRoomCountMax.GetValue() != maxRoomWrapper.Value) { mod.Log("Setting DungeonRoomCountMax to: " + maxRoomWrapper.Value); CurveDefinedValue v = c.DungeonRoomCountMax; mod.Log("Original: " + v.GetValue()); CurveOperation op = v.CurveOperation; mod.Log("Setting Max for CurveOperation..."); typeof(CurveOperation).GetProperty("Max").SetValue(op, (float)maxRoomWrapper.Value, null); //new DynData<CurveOperation>(op).Set<float>("Max", maxRoomWrapper.Value); mod.Log("Setting curveoperation..."); mod.Log("CurveOperation Max: " + op.Max); //new DynData<CurveDefinedValue>(v).Set("CurveOperation", op); typeof(CurveDefinedValue).GetProperty("CurveOperation").SetValue(v, op, null); mod.Log("CurveDefinedValue.CurveOperation.Max: " + v.CurveOperation.Max); mod.Log("Setting DungeonRoomCountMax..."); //new DynData<GameConfig>(c).Set("DungeonRoomCountMax", v); typeof(GameConfig).GetProperty("DungeonRoomCountMax").SetValue(c, v, null); mod.Log("Final value: " + c.DungeonRoomCountMax.GetValue()); // Need to also set min to be the same... mod.Log("Setting DungeonRoomCountMin to: " + maxRoomWrapper.Value); CurveDefinedValue m = c.DungeonRoomCountMin; mod.Log("Original min: " + m.GetValue()); CurveOperation op2 = m.CurveOperation; typeof(CurveOperation).GetProperty("Max").SetValue(op2, (float)maxRoomWrapper.Value, null); typeof(CurveDefinedValue).GetProperty("CurveOperation").SetValue(m, op2, null); typeof(GameConfig).GetProperty("DungeonRoomCountMin").SetValue(c, m, null); mod.Log("Final min: " + c.DungeonRoomCountMin.GetValue()); } } yield return(orig(self, level, shipName)); }
private IEnumerator DungeonGenerator2_GenerateDungeonCoroutine(On.DungeonGenerator2.orig_GenerateDungeonCoroutine orig, DungeonGenerator2 self, int level, Amplitude.StaticString shipName) { SeedData seeds = TASInput.seeds.GetSeedForShipLevel(shipName, level); if (seeds != null) { // Then we need to set the seed accordingly! seeds.SetSeedData(); mod.Log("Set seed to: " + seeds + " for level: " + level); } else { // Add the seed! SeedData data = new SeedData(); mod.Log("Creating new SeedData for level: " + level + " with data: " + data); TASInput.AddSeed(level, data); } yield return(orig(self, level, shipName)); }