示例#1
0
        //Generates world with Battle with Terrable at the start, and the world dot for eden.
        static void CreatePacifist(WorldBar bar, int numSteps)
        {
            //Lot of stuff the same as boss world generator, but with only 1 zone dot per step.
            List <ZoneDot> zoneDotList1  = new List <ZoneDot>();
            int            num1          = 100;
            var            num2          = 2;
            RectTransform  rectTransform = null;

            for (int index1 = 1; index1 <= num2; ++index1)
            {
                rectTransform = new GameObject("ZoneStep").AddComponent <RectTransform>();
                List <ZoneDot> zoneDotList2 = new List <ZoneDot>();
                Vector3        vector3      = bar.zoneDotContainer.transform.position - new Vector3((float)((double)bar.width / 2.0 - (double)bar.width / (double)(Mathf.Clamp(numSteps, 2, numSteps) - 1) * (double)index1) * bar.zoneDotContainer.lossyScale.x, 0.0f, 0.0f);
                rectTransform.localScale = bar.zoneDotContainer.lossyScale;
                rectTransform.SetParent(bar.zoneDotContainer, true);
                rectTransform.transform.position = vector3;
                rectTransform.sizeDelta          = new Vector2(10f, (float)num1);
                ZoneDot zoneDot = UnityEngine.Object.Instantiate <ZoneDot>(bar.zoneDotPrefab, bar.transform.position, bar.transform.rotation, rectTransform.transform);

                zoneDot.stepNum = index1;

                zoneDotList2.Add(zoneDot);

                zoneDot.worldBar = bar;

                zoneDot.idCtrl = bar.idCtrl;

                zoneDot.btnCtrl = bar.btnCtrl;

                zoneDot.transform.name = "ZoneDot - Step: " + (object)index1;


                if (index1 == 1)
                {
                    //Terrable does not spawn in Boss zones, only battle ones (idk why)
                    zoneDot.SetType(ZoneType.Battle);
                }
                else if (index1 == 2)
                {
                    zoneDot.worldName = "Genocide";
                    zoneDot.imageName = "WorldEden";
                    zoneDot.SetType(ZoneType.World);
                }


                zoneDot.verticalSpacing = bar.defaultVerticalSpacing;

                zoneDot.transform.position = vector3 + new Vector3(0.0f, 0.0f, 0.0f);

                bar.currentZoneSteps.Add(zoneDotList2);
                zoneDotList1.Add(zoneDot);
                bar.currentZoneDots.Add(zoneDot);
            }
            bar.currentZoneDots[0].AddNextDot(bar.currentZoneDots[1]);

            bar.currentZoneDots[1].previousDots.Add(bar.currentZoneDots[0]);
        }
    public void RunManualGeneration()
    {
        List <ZoneDot> previousDots = new List <ZoneDot>();

        column_uses.Clear();
        for (int i = 0; i < bar.currentZoneSteps.Count; i++)
        {
            column_uses.Add(i, new Dictionary <string, int>());
        }

        World world = bar.runCtrl.currentWorld;

        foreach (var gen in manualZoneGenerators)
        {
            if (total_uses.ContainsKey(gen.activationKey) && total_uses[gen.activationKey] >= gen.maxWorldActivations)
            {
                continue;
            }
            List <int> validColumns = gen.columns.Where((column) => (column_uses.ContainsKey(column) && !(column_uses[column].ContainsKey(gen.activationKey) && column_uses[column][gen.activationKey] < gen.maxColumnActivations))).ToList();
            while (validColumns.Count > 0)
            {
                var column = validColumns[0];
                var step   = bar.currentZoneSteps[column];
                validColumns.RemoveAt(0);
                var basicWorldsUsed = false;
                while (AttemptGen(column, gen))
                {
                    ZoneDot dot = CreateDot(column, gen);
                    if (dot.type == ZoneType.World)
                    {
                        if (gen.automaticWorldSelection)
                        {
                            if (stringList.Count > 0)
                            {
                                basicWorldsUsed = true;
                            }
                            else if (basicWorldsUsed)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }

        foreach (ZoneDot dot in bar.currentZoneDots)
        {
            foreach (ZoneDot otherDot in bar.currentZoneDots)
            {
                Connect(dot, otherDot);
            }
        }

        Debug.Log("Manual generation complete.");
    }
    public ZoneDot CreatePrevDot(ZoneDot dot, ZoneGenerator gen, bool add = true)
    {
        var newDot = CreateDot(dot.stepNum + 1, gen);

        if (add)
        {
            AddBefore(newDot, dot);
        }
        return(newDot);
    }
    public ZoneDot CreateNextDot(ZoneDot dot, ZoneGenerator gen, bool add = true)
    {
        var newDot = CreateDot(dot.stepNum + 1, gen);

        if (add)
        {
            AddAfter(newDot, dot);
        }
        return(newDot);
    }
示例#5
0
        static bool Prefix(RunCtrl __instance, ZoneDot zoneDot)
        {
            var num = 2;

            if (__instance.currentZoneDot.stepNum == num)
            {
                __instance.currentRun.zoneNum = 1000;
            }
            return(true);
        }
 public bool Connect(ZoneDot dot, ZoneDot otherDot)
 {
     if (dot != otherDot)
     {
         var  source1 = source.ContainsKey(dot) ? source[dot] : null;
         var  source2 = source.ContainsKey(otherDot) ? source[otherDot] : null;
         bool b1      = false;
         if (source1 != null)
         {
             b1 = true;
             if (source1.connectConds.Count == 0)
             {
                 source1.AddDefaultConnectRules();
             }
             foreach (var cond in source1.connectConds)
             {
                 if (!cond(dot, otherDot, source2 == null))
                 {
                     b1 = false;
                     break;
                 }
             }
         }
         bool b2 = false;
         if (source2 != null)
         {
             b2 = true;
             if (source2.connectConds.Count == 0)
             {
                 source2.AddDefaultConnectRules();
             }
             foreach (var cond in source2.connectConds)
             {
                 if (!cond(otherDot, dot, source1 == null))
                 {
                     b2 = false;
                     break;
                 }
             }
         }
         if (b1 || b2)
         {
             if (dot.stepNum > otherDot.stepNum)
             {
                 return(AddAfter(dot, otherDot));
             }
             else if (dot.stepNum < otherDot.stepNum)
             {
                 return(AddBefore(dot, otherDot));
             }
         }
     }
     return(false);
 }
示例#7
0
 static bool Prefix(RunCtrl __instance, ZoneDot zoneDot)
 {
     if (zoneDot.type == ZoneType.World)
     {
         if (CustomWorldGenerator.refreshWorldDots.Contains(zoneDot))
         {
             __instance.currentRun.unvisitedWorldNames.Add(__instance.currentWorld.nameString);
         }
         __instance.currentRun.zoneNum = 10000;
     }
     return(true);
 }
    static bool Prefix(ref RunCtrl __instance, ref ZoneDot zoneDot)
    {
        Debug.Log((object)("GOING TO NEXT WORLD... " + zoneDot.worldName + " cur zone num : " + (object)__instance.currentRun.zoneNum + "  and the zone= " + (object)__instance.currentWorld.numZones + " BossExecs= " + (object)__instance.currentRun.bossExecutions + " unvis world nums:" + (object)__instance.currentRun.unvisitedWorldNames.Count));
        ++__instance.currentRun.worldTierNum;

        int count = 0;

        foreach (string worldName in __instance.currentRun.visitedWorldNames)
        {
            if (!LuaPowerData.GenocideLenientStages.Contains(worldName))
            {
                count++;
            }
        }

        if (__instance.currentRun.shopkeeperKilled)
        {
            ++count;
        }
        if (__instance.currentRun.unvisitedWorldNames.Count > 0)
        {
            __instance.currentRun.visitedWorldNames.Add(zoneDot.worldName);
            __instance.currentRun.unvisitedWorldNames.Remove(zoneDot.worldName);
        }
        else if (S.I.BETA)
        {
            zoneDot.worldName = "Beta";
        }
        else if (__instance.currentRun.bossExecutions == 0)
        {
            zoneDot.worldName = "Pacifist";
            __instance.currentRun.pacifist = true;
        }
        else if (__instance.currentRun.bossExecutions < count)
        {
            zoneDot.worldName             = "Normal";
            __instance.currentRun.neutral = true;
        }
        else if (__instance.currentRun.bossExecutions >= count)
        {
            __instance.currentRun.genocide = true;
            zoneDot.worldName = "Genocide";
        }
        __instance.progressBar.transform.SetParent(Camera.main.transform);
        __instance.currentRun.worldName = zoneDot.worldName;
        __instance.ResetWorld(zoneDot.worldName, -1);
        __instance.currentRun.zoneNum = 0;
        zoneDot = __instance.worldBar.currentZoneDots[0];

        return(false);
    }
示例#9
0
        //Generates world with only Serif boss.
        static void CreateGenocide(WorldBar bar, int numSteps)
        {
            List <ZoneDot> zoneDotList1  = new List <ZoneDot>();
            int            num1          = 100;
            RectTransform  rectTransform = null;

            rectTransform = new GameObject("ZoneStep").AddComponent <RectTransform>();

            List <ZoneDot> zoneDotList2 = new List <ZoneDot>();

            Vector3 vector3 = bar.zoneDotContainer.transform.position - new Vector3((float)((double)bar.width / 2.0 - (double)bar.width / (double)(Mathf.Clamp(numSteps, 2, numSteps) - 1) * 1) * bar.zoneDotContainer.lossyScale.x, 0.0f, 0.0f);

            rectTransform.localScale = bar.zoneDotContainer.lossyScale;

            rectTransform.SetParent(bar.zoneDotContainer, true);

            rectTransform.transform.position = vector3;

            rectTransform.sizeDelta = new Vector2(10f, (float)num1);

            ZoneDot zoneDot = UnityEngine.Object.Instantiate <ZoneDot>(bar.zoneDotPrefab, bar.transform.position, bar.transform.rotation, rectTransform.transform);



            zoneDot.stepNum = 1;



            zoneDotList2.Add(zoneDot);


            zoneDot.worldBar = bar;


            zoneDot.idCtrl = bar.idCtrl;


            zoneDot.btnCtrl = bar.btnCtrl;


            zoneDot.SetType(ZoneType.Boss);

            bar.currentZoneDots.Add(zoneDot);

            bar.currentZoneSteps.Add(zoneDotList2);

            zoneDot.transform.position = vector3 + new Vector3(0.0f, 0.0f, 0.0f);
        }
    //================================================================================================================================================================================================================================================================================================

    public bool ApplyPostProcess(ZoneDot dot)
    {
        bool edited = false;

        foreach (var gen in postProcess)
        {
            if (AttemptGen(dot, gen))
            {
                gen.effect(dot);
                edited = true;
            }
        }
        foreach (ZoneDot otherDot in bar.currentZoneDots)
        {
            if (Connect(dot, otherDot))
            {
                edited = true;
            }
        }
        return(edited);
    }
    public bool AddBefore(ZoneDot dot, ZoneDot root)
    {
        int b = 2;

        if (!root.previousDots.Contains(dot))
        {
            root.previousDots.Add(dot);
        }
        else
        {
            b--;
        }
        if (!dot.nextDots.Contains(root))
        {
            dot.nextDots.Add(root);
        }
        else
        {
            b--;
        }
        return(b > 0);
    }
    //================================================================================================================================================================================================================================================================================================

    protected bool AttemptGen(ZoneDot dot, ZoneGenerator zoneGen)
    {
        if (!(column_uses[dot.stepNum].ContainsKey(zoneGen.activationKey) && zoneGen.maxColumnActivations <= column_uses[dot.stepNum][zoneGen.activationKey]) && !(total_uses.ContainsKey(zoneGen.activationKey) && zoneGen.maxWorldActivations <= total_uses[zoneGen.activationKey]))
        {
            if (zoneGen.CanActivate(dot))
            {
                if (zoneGen is PostProcessZoneGenerator)
                {
                    var   gen  = zoneGen as PostProcessZoneGenerator;
                    float prob = probabilities.ContainsKey(gen) ? probabilities[gen] : gen.probability;
                    if (prob >= bar.runCtrl.NextWorldRand(0, 100))
                    {
                        if (!probabilities.ContainsKey(gen))
                        {
                            probabilities.Add(gen, gen.probability);
                        }
                        probabilities[gen] /= gen.probabilityReductionFactor;
                        return(true);
                    }
                    else if (gen.probabilityReductionOnFail)
                    {
                        if (!probabilities.ContainsKey(gen))
                        {
                            probabilities.Add(gen, gen.probability);
                        }
                        probabilities[gen] /= gen.probabilityReductionFactor;
                    }
                }
                else
                {
                    return(true);
                }
            }
        }
        return(false);
    }
示例#13
0
        //Generates custom world bar if boss rush is selected.
        static bool Prefix(WorldBar __instance, int numSteps)
        {
            //Value set by button on main menu
            //IDK, Might help with music erros.
            S.I.muCtrl.StopIntroLoop();
            //Delete all previous zone dots.
            foreach (Component component in __instance.zoneDotContainer)
            {
                UnityEngine.Object.Destroy((UnityEngine.Object)component.gameObject);
            }
            //Clear deleted zone dots from lists/
            __instance.currentZoneDots.Clear();
            __instance.currentZoneSteps.Clear();

            //From original code.
            if (__instance.btnCtrl.hideUICounter < 1)
            {
                __instance.detailPanel.gameObject.SetActive(true);
            }

            //__instance.ResetZoneVars(); //This line is part of original code, but not necessary often.

            //If else to decide which generation function to use.
            if (__instance.runCtrl.currentWorld.nameString == "Genocide")
            {
                //These music pauses might not do anything.
                S.I.muCtrl.PauseIntroLoop(true);
                CreateGenocide(__instance, numSteps);
            }
            else if (__instance.runCtrl.currentWorld.nameString == "Pacifist")
            {
                S.I.muCtrl.PauseIntroLoop(true);
                CreatePacifist(__instance, numSteps);
            }
            else if (__instance.runCtrl.currentWorld.nameString == "Normal")
            {
                S.I.muCtrl.PauseIntroLoop(true);
                CreateNormal(__instance, numSteps);
            }
            else
            {
                S.I.muCtrl.PauseIntroLoop(true);
                CreateBossWorld(__instance, numSteps);
            }
            //IDK what this does but i guess its important
            __instance.runCtrl.currentRun.lastWorldGenOrigin = __instance.runCtrl.currentRun.currentWorldGen;

            //Draw lines in ui
            foreach (ZoneDot currentZoneDot in __instance.currentZoneDots)
            {
                Debug.Log("connect the dots!");
                ZoneDot zoneDot = currentZoneDot;
                zoneDot.CreateLines();
            }
            //Debug.Log("Hello");

            //Set selection marker for ui.
            __instance.selectionMarker.transform.position = __instance.currentZoneDots[0].transform.position;
            //Dont call original function.
            return(false);
        }
示例#14
0
        //Generates world with a normal boss.
        static void CreateBossWorld(WorldBar bar, int numSteps)
        {
            //List of all remaining normal worlds.
            List <string> stringList = new List <string>((IEnumerable <string>)bar.runCtrl.currentRun.unvisitedWorldNames);
            //From original code
            int num1 = 100;

            //If testing final bosses, make it think there are no more remaining worlds.
            if (final_test)
            {
                stringList.Clear();
            }
            //Number of zone steps to generate. Add two more if before final world.
            int num2 = 3;
            //Per step list of zone dots.
            List <ZoneDot> zoneDotList3 = new List <ZoneDot>();
            //
            RectTransform rectTransform = null;

            for (int index1 = 1; index1 <= num2; ++index1)
            {
                //Bunch of stuff which makes it look right. From original function.
                rectTransform = new GameObject("ZoneStep").AddComponent <RectTransform>();
                List <ZoneDot> zoneDotList2 = new List <ZoneDot>();
                Vector3        vector3      = bar.zoneDotContainer.transform.position - new Vector3((float)((double)bar.width / 2.0 - (double)bar.width / (double)(Mathf.Clamp(numSteps, 2, numSteps) - 1) * (double)index1) * bar.zoneDotContainer.lossyScale.x, 0.0f, 0.0f);
                rectTransform.localScale = bar.zoneDotContainer.lossyScale;
                rectTransform.SetParent(bar.zoneDotContainer, true);
                rectTransform.transform.position = vector3;
                rectTransform.sizeDelta          = new Vector2(10f, (float)num1);



                var max    = 0;
                int count  = bar.runCtrl.currentRun.unvisitedWorldNames.Count;
                int index3 = final_test ? 3 : stringList.Count;
                if (index1 == num2 - 1)
                {
                    //Create zone dot from prefab.
                    ZoneDot zoneDot = UnityEngine.Object.Instantiate <ZoneDot>(bar.zoneDotPrefab, bar.transform.position, bar.transform.rotation, rectTransform.transform);
                    //Specify step of dot.
                    zoneDot.stepNum = index1;
                    //List2 is the step list.
                    zoneDotList2.Add(zoneDot);
                    //Zone dot needs to know its world bar.
                    zoneDot.worldBar = bar;
                    //Set ctrls
                    zoneDot.idCtrl  = bar.idCtrl;
                    zoneDot.btnCtrl = bar.btnCtrl;
                    //Set name of dot.
                    zoneDot.transform.name = "ZoneDot - Step: " + (object)index1;
                    //Use world selection spacing for everything.
                    zoneDot.verticalSpacing = bar.defaultVerticalSpacing;
                    //zoneDot.verticalSpacing += 7f;
                    //Decide what row comes next
                    zoneDot.SetType(ZoneType.Boss);
                    zoneDot.transform.position = vector3 + new Vector3(0.0f, ((float)(max - 1) / 2f - 0 * zoneDot.verticalSpacing) * bar.rect.localScale.y, 0.0f);
                    zoneDotList3.Add(zoneDot);
                }
                else if (index1 == 1)
                {
                    //Create zone dot from prefab.
                    ZoneDot zoneDot = UnityEngine.Object.Instantiate <ZoneDot>(bar.zoneDotPrefab, bar.transform.position, bar.transform.rotation, rectTransform.transform);
                    //Specify step of dot.
                    zoneDot.stepNum = index1;
                    //List2 is the step list.
                    zoneDotList2.Add(zoneDot);
                    //Zone dot needs to know its world bar.
                    zoneDot.worldBar = bar;
                    //Set ctrls
                    zoneDot.idCtrl  = bar.idCtrl;
                    zoneDot.btnCtrl = bar.btnCtrl;
                    //Set name of dot.
                    zoneDot.transform.name = "ZoneDot - Step: " + (object)index1;
                    //Use world selection spacing for everything.
                    zoneDot.verticalSpacing = bar.defaultVerticalSpacing;
                    //zoneDot.verticalSpacing += 7f;
                    //Decide what row comes next
                    zoneDot.SetType(ZoneType.Campsite);
                    zoneDot.transform.position = vector3 + new Vector3(0.0f, ((float)(max - 1) / 2f - 0 * zoneDot.verticalSpacing) * bar.rect.localScale.y, 0.0f);
                    zoneDotList3.Add(zoneDot);
                }
                else
                {
                    for (int loop_index = 0; loop_index < index3 || loop_index < 1; loop_index++)
                    {
                        //Create zone dot from prefab.
                        ZoneDot zoneDot = UnityEngine.Object.Instantiate <ZoneDot>(bar.zoneDotPrefab, bar.transform.position, bar.transform.rotation, rectTransform.transform);
                        //Specify step of dot.
                        zoneDot.stepNum = index1;
                        //List2 is the step list.
                        zoneDotList2.Add(zoneDot);
                        //Zone dot needs to know its world bar.
                        zoneDot.worldBar = bar;
                        //Set ctrls
                        zoneDot.idCtrl  = bar.idCtrl;
                        zoneDot.btnCtrl = bar.btnCtrl;
                        //Set name of dot.
                        zoneDot.transform.name = "ZoneDot - Step: " + (object)index1 + " - " + (object)loop_index;
                        //Use world selection spacing for everything.
                        zoneDot.verticalSpacing = bar.defaultVerticalSpacing;
                        //Decide what row comes next
                        //Use random next boss world.
                        if (stringList.Count > 0 && !final_test)
                        {
                            int world_index = bar.runCtrl.NextWorldRand(0, stringList.Count);
                            zoneDot.worldName = stringList[Math.Min(world_index, stringList.Count - 1)];
                            zoneDot.world     = bar.runCtrl.worlds[zoneDot.worldName];
                            zoneDot.imageName = zoneDot.world.iconName;
                            stringList.Remove(stringList[Math.Min(world_index, stringList.Count - 1)]);
                        }
                        //Final world
                        else
                        {
                            //bar.runCtrl.savedBossKills is the correct variable for this type of thing.
                            if ((!final_test && bar.runCtrl.savedBossKills >= 7) || (final_test && loop_index == 1))
                            {
                                zoneDot.worldName = "Genocide";
                                zoneDot.imageName = "WorldWasteland";
                            }
                            else if ((!final_test && bar.runCtrl.savedBossKills >= 1) || (final_test && loop_index == 2))
                            {
                                zoneDot.worldName = "Normal";
                                zoneDot.imageName = "WorldWasteland";
                            }
                            else
                            {
                                zoneDot.worldName = "Pacifist";
                                zoneDot.imageName = "WorldWasteland";
                            }
                        }
                        //Set world stuff.
                        zoneDot.world = bar.runCtrl.worlds[zoneDot.worldName];
                        zoneDot.SetType(ZoneType.World);
                        zoneDot.transform.position = vector3 + new Vector3(0.0f, ((float)(max - 1) - (float)(loop_index - 1)) * zoneDot.verticalSpacing * bar.rect.localScale.y, 0.0f);
                        zoneDotList3.Add(zoneDot);
                    }
                }
                bar.currentZoneSteps.Add(zoneDotList2);
                foreach (ZoneDot dot in zoneDotList3)
                {
                    bar.currentZoneDots.Add(dot);
                }
                //Clear temp list.
                zoneDotList3.Clear();
            }
            //Decide connections.
            for (int i = 0; i < bar.currentZoneSteps.Count(); i++)
            {
                if (i == num2 - 2)
                {
                    Debug.Log("First Step!");
                    for (int j = 0; j < bar.currentZoneSteps[i + 1].Count(); j++)
                    {
                        Debug.Log("Next Dot!");
                        bar.currentZoneSteps[i][0].AddNextDot(bar.currentZoneSteps[i + 1][j]);
                    }
                }
                else if (i == 0)
                {
                    bar.currentZoneSteps[0][0].AddNextDot(bar.currentZoneSteps[1][0]);
                }
                else
                {
                    Debug.Log("Other Step!");
                    for (int j = 0; j < bar.currentZoneSteps[i].Count(); j++)
                    {
                        Debug.Log("Previous Connection!");
                        bar.currentZoneSteps[i][j].previousDots.Add(bar.currentZoneSteps[i - 1][0]);
                    }
                }
            }
        }
示例#15
0
 protected override IEnumerator SpareC(ZoneDot nextZoneDot)
 {
     SetCustomBossFate(true);
     return(base.SpareC(nextZoneDot));
 }
 public override bool CanActivate(ZoneDot dot)
 {
     return(base.CanActivate(dot) && cond(dot));
 }
 public virtual bool CanActivate(ZoneDot dot)
 {
     return(columns.Contains(dot.stepNum));
 }
    public void RunPostProcessGenerators(bool manual = false)
    {
        post = true;

        World world = bar.runCtrl.currentWorld;

        GetPostProcessGenerators(world);

        column_uses.Clear();
        for (int i = 0; i < bar.currentZoneSteps.Count; i++)
        {
            column_uses.Add(i, new Dictionary <string, int>());
        }

        world.numZones = bar.currentZoneSteps.Count - 1;

        for (int j = 0; j < 4; j++)
        {
            bool b = false;

            for (int i = 0; i < bar.currentZoneDots.Count; i++)
            {
                ZoneDot dot = bar.currentZoneDots[i];
                b = ApplyPostProcess(dot) ? true : b;
            }

            if (!b)
            {
                break;
            }
        }

        foreach (var dot in bar.currentZoneDots)
        {
            dot.nextDots = dot.nextDots.OrderBy <ZoneDot, int>((Func <ZoneDot, int>)(t => t.transform.GetSiblingIndex())).ToList <ZoneDot>();
            dot.ClearLines();
            dot.CreateLines();
        }

        foreach (var dot in bar.currentZoneDots)
        {
            foreach (var otherDot in dot.nextDots)
            {
                if (!otherDot.previousDots.Contains(dot))
                {
                    otherDot.previousDots.Add(dot);
                }
            }
        }

        foreach (var dot in invisDots.Keys)
        {
            if (dot.image != null)
            {
                dot.image.enabled = false;
            }
            if (dot.fgImage != null)
            {
                dot.fgImage.enabled = false;
            }
            if (dot.bgImage != null)
            {
                dot.bgImage.enabled = false;
            }
            foreach (var oDot in dot.previousDots)
            {
                var index = oDot.nextDots.IndexOf(dot);
                if (index != -1)
                {
                    if (oDot.nextLines.Count > index)
                    {
                        var line = oDot.nextLines[oDot.nextDots.IndexOf(dot)];
                        line.GetComponent <Image>().enabled = false;
                        if (!invisLines.ContainsKey(dot))
                        {
                            invisLines.Add(dot, new Dictionary <ZoneDot, RectTransform>());
                        }
                        invisLines[dot].Add(oDot, line);
                        Debug.LogError("Added dot and line to invisLines");
                        oDot.nextDots.Remove(dot);
                        oDot.nextLines.Remove(line);
                    }
                    else
                    {
                        Debug.LogError("Dot Connection Line Error");
                    }
                }
                else
                {
                    Debug.LogError("PreviousDot - NextDot Mismatch");
                }
            }
        }

        if (bar.currentZoneSteps.Count > 0)
        {
            if (bar.currentZoneSteps[0].Count > 0)
            {
                bar.selectionMarker.transform.position = bar.currentZoneSteps[0][0].transform.position;
            }
            else
            {
                Debug.LogError("World Generation did not result in a starting ZoneDot");
            }
        }
        else
        {
            Debug.LogError("World Generation did not result in any zone steps (columns)");
        }
    }
    protected void EditDotWithGen(ZoneDot dot, ZoneGenerator zoneGen)
    {
        if (zoneGen.zoneType == ZoneType.World && !(zoneGen is ManualZoneGenerator && ((ManualZoneGenerator)zoneGen).automaticWorldSelection))
        {
            try
            {
                dot.world     = bar.runCtrl.worlds[zoneGen.worldName];
                dot.worldName = zoneGen.worldName;
                dot.imageName = dot.world.iconName;
                if (zoneGen.refreshCurrentworld)
                {
                    refreshWorldDots.Add(dot);
                }
                else
                {
                    refreshWorldDots.Remove(dot);
                }
            }
            catch
            {
                Debug.LogError("No world exists with name: " + zoneGen.worldName);
            }
        }
        else if (dot.type == ZoneType.World)
        {
            refreshWorldDots.Remove(dot);
        }
        if (zoneGen.dark)
        {
            dot.SetDark();
        }
        dot.SetType(zoneGen.zoneType);
        if (source.ContainsKey(dot))
        {
            source[dot] = zoneGen;
        }
        else
        {
            source.Add(dot, zoneGen);
        }

        if (!column_uses.ContainsKey(dot.stepNum))
        {
            column_uses.Add(dot.stepNum, new Dictionary <string, int>());
        }

        if (!column_uses[dot.stepNum].ContainsKey(zoneGen.activationKey))
        {
            column_uses[dot.stepNum].Add(zoneGen.activationKey, 1);
        }
        column_uses[dot.stepNum][zoneGen.activationKey]++;
        if (!total_uses.ContainsKey(zoneGen.activationKey))
        {
            total_uses.Add(zoneGen.activationKey, 1);
        }
        total_uses[zoneGen.activationKey]++;

        if (invisDots.ContainsKey(dot))
        {
            var key = invisDots[dot];
            if (hiddenSections.ContainsKey(key))
            {
                hiddenSections[key].Remove(dot);
                if (dot.image != null)
                {
                    dot.image.enabled = true;
                }
                if (dot.fgImage != null)
                {
                    dot.fgImage.enabled = true;
                }
                if (dot.bgImage != null)
                {
                    dot.bgImage.enabled = true;
                }
            }
        }
    }
    public ZoneDot CreateDot(int index1, ZoneGenerator gen)
    {
        RectTransform rectTransform = columnTransforms[index1];
        ZoneDot       zoneDot       = UnityEngine.Object.Instantiate <ZoneDot>(bar.zoneDotPrefab, bar.transform.position, bar.transform.rotation, rectTransform.transform);

        zoneDot.stepNum         = index1;
        zoneDot.worldBar        = bar;
        zoneDot.idCtrl          = bar.idCtrl;
        zoneDot.btnCtrl         = bar.btnCtrl;
        zoneDot.transform.name  = "ZoneDot - Step: " + (object)index1;
        zoneDot.verticalSpacing = bar.defaultVerticalSpacing + gen.verticalSpacing;
        var step = bar.currentZoneSteps[index1];

        if (!gen.addFirst)
        {
            step.Add(zoneDot);
        }
        else
        {
            step.Insert(0, zoneDot);
        }
        bar.currentZoneDots.Add(zoneDot);
        if (gen.relativeTransforms)
        {
            if (step.Count == 1)
            {
                zoneDot.transform.position = rectTransform.position;
            }
            else
            {
                if (gen.addFirst)
                {
                    zoneDot.transform.position = step[1].transform.position + new Vector3(0.0f, zoneDot.verticalSpacing * bar.rect.localScale.y, 0.0f);
                }
                else
                {
                    zoneDot.transform.position = step[step.Count - 2].transform.position - new Vector3(0.0f, zoneDot.verticalSpacing * bar.rect.localScale.y, 0.0f);
                }
            }
        }
        else
        {
            for (int i = 0; i < step.Count; i++)
            {
                var dot = step[i];
                dot.transform.localPosition = new Vector3(0.0f, ((float)(step.Count - 1) / 2f - (float)(i)) * zoneDot.verticalSpacing * rectTransform.localScale.y, 0.0f);
            }
        }


        if (gen.zoneType == ZoneType.World && gen is ManualZoneGenerator)
        {
            ManualZoneGenerator manual = (ManualZoneGenerator)gen;
            //Default world stuff
            if (manual.automaticWorldSelection)
            {
                if (stringList.Count > 0)
                {
                    int index3 = bar.runCtrl.NextWorldRand(0, stringList.Count);
                    zoneDot.worldName = stringList[index3];
                    stringList.Remove(stringList[index3]);
                }
                else
                {
                    if (bar.runCtrl.currentRun.bossExecutions >= 7)
                    {
                        zoneDot.worldName = "Genocide";
                        zoneDot.imageName = "WorldWasteland";
                    }
                    else if (bar.runCtrl.currentRun.bossExecutions >= 1)
                    {
                        zoneDot.worldName = "Normal";
                        zoneDot.imageName = "WorldWasteland";
                    }
                    else
                    {
                        zoneDot.worldName = "Pacifist";
                        zoneDot.imageName = "WorldWasteland";
                    }
                }
                zoneDot.world     = bar.runCtrl.worlds[zoneDot.worldName];
                zoneDot.imageName = zoneDot.world.iconName;
            }
        }
        EditDotWithGen(zoneDot, gen);

        return(zoneDot);
    }