public SpawnTrapsInRoguelikeBagman(OpenGatesAtRoomClear xRoomClearBag, DynamicEnvironmentCodex.ObjectTypes enTrap, Rectangle recSpawnRec, int iInterval) { this.xRoomClear = xRoomClearBag; this.enTrap = enTrap; this.recSpawnRec = recSpawnRec; this.iInterval = iInterval; }
// Static methods /// <summary> /// Allocates a new DynamicEnvironmentCodex.ObjectTypes value, and sets the delegate used to build dynamic environments of that type. /// <para> The delegate is where you instantiate your dynamic environment object and return it, so that it can be used by SoG. </para> /// <para> You can either use an existing class, or make your own class that derives from DynamicEnvironment (for example, public MyAmazingBarrel : DynamicEnvironment { ... }) </para> /// </summary> public static DynamicEnvironmentCodex.ObjectTypes CreateDynamicEnvironmentEntry(ContentManager xContent, DynEnvBuilderPrototype xBuilder) { DynamicEnvironmentCodex.ObjectTypes enNext = ModLibrary.DynEnvTypeNext; ModLibrary.DynEnvDetails.Add(enNext, new ModDynEnvData(enNext) { InstanceBuilder = xBuilder, xContent = xContent }); return(enNext); }
// // Harmony Patches // /// <summary> Patches GetObjectInstance so that it can create instances of modded Dynamic Environments. </summary> private static bool GetObjectInstance_PrefixPatch(ref DynamicEnvironment __result, DynamicEnvironmentCodex.ObjectTypes enType, Level.WorldRegion enOverrideRegion) { if (!enType.IsModEnv()) { return(true); // Execute original methods } ModDynEnvData xData = ModLibrary.DynEnvDetails[enType]; __result = xData.InstanceBuilder(xData.xContent); Console.WriteLine("Lmaooo" + (__result == null)); Console.WriteLine("Lmaooo" + __result.GetType().ToString()); __result.enType = enType; __result.bNetworkSynchEnabled = false; Console.WriteLine("Lmaooo" + (__result == null)); if (__result.xRenderComponent != null) { __result.xRenderComponent.GetCurrentAnimation().Reset(); } Console.WriteLine("Lmaooo" + (__result == null)); return(false); // Skip original method }
public static bool IsModEnv(this DynamicEnvironmentCodex.ObjectTypes enType) { return(enType >= ModLibrary.DynEnvTypeStart && enType < ModLibrary.DynEnvTypeNext); }
// DynamicEnvironmentCodex.ObjectTypes extensions public static bool IsSoGEnv(this DynamicEnvironmentCodex.ObjectTypes enType) { return(Enum.IsDefined(typeof(DynamicEnvironmentCodex.ObjectTypes), enType)); }
public ModDynEnvData(DynamicEnvironmentCodex.ObjectTypes enType) { this.enType = enType; }