private ShrineController shrineController; //the shrineController of the currrent shrine //updates the UI with the details provided public void UpdateUI(Shrine shrine, ShrineController controller) { this.shrine = shrine; shrineController = controller; currentChoice = shrine.choices[shrine.activeChoice]; title.text = shrine.name; description.text = shrine.description; offer.text = currentChoice.description; sacrificeOption.text = "Sacrifice " + currentChoice.sacrificeAmount; sacrificeIcon.sprite = currentChoice.sacrificeSprite; }
private void OnEnable() { activeShrine = null; activeDemon = null; activeMenu = null; }
public void SetActiveShrine(ShrineController shrine) { activeShrine = shrine; }
public void SetActiveShrine(ShrineController newActiveShrine) { shrineController = newActiveShrine; }
private void Save() { if (!boundaries) { return; } //save = new Boundaries(); Scene scene = new Scene(); scene.parts = new List <Part>(); foreach (Transform part in boundaries.transform) { if (part.gameObject.name.Contains("Background")) { foreach (Transform background in part) { foreach (BackgroundType type in Enum.GetValues(typeof(BackgroundType))) { if (background.gameObject.name.Contains(type.ToString())) { scene.background = type; scene.bgPosition = background.localPosition; break; } } } } else if (part.gameObject.name.Contains("Part")) { Part newPart = new Part(); newPart.position = part.localPosition; newPart.levels = new List <Level>(); foreach (Transform level in part) { Level newLevel = new Level(); newLevel.relPosition = level.localPosition; newLevel.regions = new List <Region>(); newLevel.cameraLimits = new List <Limits>(); foreach (Transform region in level) { if (region.gameObject.name.Contains("Limit")) { Limits newLimit = new Limits(); newLimit.type = (Commandments.LimitsType)region.localScale.z; newLimit.relPosition = region.localPosition; newLimit.point1 = region.GetComponent <EdgeCollider2D>().points[0]; newLimit.point2 = region.GetComponent <EdgeCollider2D>().points[1]; newLevel.cameraLimits.Add(newLimit); } if (region.gameObject.name.Contains("Region")) { Region newRegion = new Region(); newRegion.relPosition = region.localPosition; newRegion.subRegions = new List <ContinuosRegion>(); newRegion.walls = new List <Wall>(); newRegion.shrines = new List <ShrineController>(); newRegion.chest = new List <ChestController>(); newRegion.misc = new List <MiscController>(); newRegion.yokai = new List <YokaiController>(); foreach (Transform subRegion in region) { if (subRegion.gameObject.name.Contains("grounds")) { foreach (Transform grounds in subRegion) { ContinuosRegion newSubRegion = new ContinuosRegion(); newSubRegion.relPosition = grounds.localPosition; newSubRegion.grounds = new List <Ground>(); newSubRegion.inverted = grounds.localScale.y == -1; newSubRegion.rotated = grounds.eulerAngles.z == 180; Floor floor = region.GetComponent <Floor>(); if (floor) { newSubRegion.accelRatio = floor.accelTimeRatio; newSubRegion.speedRatio = floor.maxSpeedRatio; } foreach (Commandments.Element element in Enum.GetValues(typeof(Commandments.Element))) { if (grounds.gameObject.name.Contains(element.ToString())) { newSubRegion.element = element; break; } } foreach (Transform ground in grounds) { foreach (GroundType id in Enum.GetValues(typeof(GroundType))) { foreach (GroundSize size in Enum.GetValues(typeof(GroundSize))) { if ((ground.gameObject.name.StartsWith(id.ToString() + size.ToString()))) { Ground newGround = new Ground(); newSubRegion.type = id; newGround.size = size; newSubRegion.grounds.Add(newGround); break; } } } } newRegion.subRegions.Add(newSubRegion); } } else if (subRegion.gameObject.name.Contains("walls")) { foreach (Transform walls in subRegion) { Wall wall = new Wall(); wall.relPosition = walls.localPosition; wall.elements = new List <WallSize>(); wall.inverted = walls.localScale.x == -1; wall.rotated = walls.eulerAngles.z == 180; foreach (Commandments.Element element in Enum.GetValues(typeof(Commandments.Element))) { if (walls.gameObject.name.Contains(element.ToString())) { wall.element = element; break; } } foreach (Transform wallsize in walls) { foreach (WallType id in Enum.GetValues(typeof(WallType))) { foreach (WallSize size in Enum.GetValues(typeof(WallSize))) { if (wallsize.gameObject.name.StartsWith(id.ToString() + size.ToString())) { wall.elements.Add(size); wall.type = id; break; } } } } newRegion.walls.Add(wall); } } else if (subRegion.gameObject.name.Contains("shrines")) { foreach (Transform shrines in subRegion) { Shrine shrine = shrines.GetComponentInChildren <Shrine>(); if (shrine) { ShrineController newController = new ShrineController(); newController.type = shrine.id; newController.pos = shrines.localPosition; newRegion.shrines.Add(newController); } } } else if (subRegion.gameObject.name.Contains("chests")) { foreach (Transform chest in subRegion) { Chest chestObj = chest.GetComponentInChildren <Chest>(); if (chestObj) { ChestController newController = new ChestController(); newController.type = chestObj.type; newController.pos = chest.localPosition; newRegion.chest.Add(newController); } } } else if (subRegion.gameObject.name.Contains("misc")) { foreach (Transform obj in subRegion) { foreach (MiscType id in Enum.GetValues(typeof(MiscType))) { foreach (Commandments.Element element in Enum.GetValues(typeof(Commandments.Element))) { if ((obj.gameObject.name.StartsWith(id.ToString())) && (obj.gameObject.name.Contains(element.ToString()))) { MiscController newController = new MiscController(); newController.type = id; newController.element = element; newController.pos = obj.localPosition; newRegion.misc.Add(newController); break; } } } } } else if (subRegion.gameObject.name.Contains("yokais")) { foreach (Transform obj in subRegion) { foreach (Beastiary.YokaiID id in Enum.GetValues(typeof(Beastiary.YokaiID))) { if (obj.gameObject.name.StartsWith(id.ToString())) { YokaiController newController = new YokaiController(); newController.type = id; newController.pos = obj.localPosition; Enemy script = obj.gameObject.GetComponentInChildren <Enemy>(); if (script) { newController.pos = script.editorStartPosition - subRegion.position; } newRegion.yokai.Add(newController); break; } } } } } newLevel.regions.Add(newRegion); } } newPart.levels.Add(newLevel); } scene.parts.Add(newPart); } } if (scene.parts.Count < 1) { return; } save.scenes[asd] = scene; save.Save("Assets/Resources/JSON/fireBoundaries.json"); }