public IEnumerator ActivateRoutine(RogueUI ui, PCEvent pc, int level) { this.pc = pc; this.ui = ui; rightFace.hpBar.gameObject.SetActive(false); rightFace.mpBar.gameObject.SetActive(false); rightFace.cdBar.gameObject.SetActive(false); PopulateBookData(); bookBox.Populate(bookData); bookBox.selection = 0; PopulateScrollBoxForSelectedBook(); levelText.text = "Cleared floor " + level + " with " + pc.gold + " gold. " + "Craft spellbooks and challenge next floor! Press [ESC] when done."; PopulateTools(); textbox.textbox.GetComponent <CanvasGroup>().alpha = 1.0f; ui.rightDisplayEnabled = true; UpdateDescriptionForSelectedBook(); yield return(CoUtils.RunTween(GetComponent <CanvasGroup>().DOFade(1.0f, 1.0f))); yield return(textbox.EnableRoutine(null, false)); descriptionNameBox.transform.parent.GetComponent <CanvasGroup>().alpha = 1.0f; yield return(SelectBookRoutine()); }
public IEnumerator RawNextMapRoutine() { bool swapped = false; pc.GetComponent <MapEvent>().SetLocation(new Vector2Int(0, 0)); activeMap.GetComponent <BattleController>().Clear(); MapGenerator oldGen = activeMap.GetComponent <MapGenerator>(); Map oldMap = activeMap; int level = oldGen.level; MapGenerator newGen = activeMap.gameObject.AddComponent <MapGenerator>(); newGen.GenerateMesh(oldGen); Destroy(oldGen); activeMap.GetComponent <LineOfSightEffect>().Erase(); if (activeMap != oldMap) { swapped = true; pc.GetComponent <CharaEvent>().facing = EightDir.N; Destroy(oldGen.gameObject); activeMap.AddEvent(pc.GetComponent <MapEvent>()); } MapCamera cam = FindObjectOfType <MapCamera>(); if (cam.target != pc.GetComponent <MapEvent3D>()) { cam.target = activeMap.GetEventNamed("ZoomTarget").GetComponent <MapEvent3D>(); } activeMap.GetComponent <LineOfSightEffect>().RegenSitemap(activeMap.GetComponent <TacticsTerrainMesh>()); RogueUI ui = FindObjectOfType <RogueUI>(); ui.narrator.Clear(); if (level == 0 && !seenTutorial) { seenTutorial = true; yield return(ui.TutorialRoutine()); } yield return(ui.EditSpellsRoutine()); Vector2Int loc = activeMap.GetEventNamed("TeleStart").location; EightDir dir = pc.GetComponent <CharaEvent>().facing; loc += dir.XY() * -2; pc.GetComponent <MapEvent>().SetLocation(loc); activeMap.GetComponent <LineOfSightEffect>().RecalculateVisibilityMap(); if (swapped) { StartCoroutine(activeMap.GetComponent <BattleController>().BattleRoutine()); } }