public void LoadRoom(DungeonRoom room, HallSector fromSector, bool savedBattle = false) { RaidRoom.LoadRoom(room, savedBattle); LastHallway = fromSector == null ? null : fromSector.Hallway; RaidSceneManager.MapPanel.OnRoomEnter(room, LastHallway); }
public void AddHallSector(HallSector hs) { string query = "INSERT INTO HallSectors (SectorId, HallId, StartRow, EndRow) " + "VALUES (@sectorId, @hallId, @startRow, @endRow)"; using (connection) { SqlCommand command = new SqlCommand(query, connection); command.Parameters.Add("@sectorId", SqlDbType.Int).Value = hs.SectorId; command.Parameters.Add("@hallId", SqlDbType.Int).Value = hs.HallId; command.Parameters.Add("@startRow", SqlDbType.Int).Value = hs.StartRow; command.Parameters.Add("@endRow", SqlDbType.Int).Value = hs.EndRow; command.ExecuteNonQuery(); } HallSectors.Add(hs); }
public void DelHallSector(int Id) { HallSector hallSector = HallSectors.Find(hs => hs.Id == Id); if (hallSector != null) { string query = "DELETE HallSectors WHERE Id = @id"; using (connection) { SqlCommand command = new SqlCommand(query, connection); command.Parameters.Add("@id", SqlDbType.Int).Value = Id; command.ExecuteNonQuery(); } HallSectors.Remove(hallSector); } }
public void SetCurrentIndicator(HallSector hallsector) { if (LastCurrentRoom != null) { LastCurrentRoom.animator.SetBool("IsCurrent", false); LastCurrentRoom = null; } if (LastHallwaySector != null) { LastHallwaySector.RemoveIndicator(hallIndicator); } LastHallwaySector = HallSlots[hallsector.Hallway.Id].RaidMapHallSectorSlots.Find(item => item.Sector.Id == hallsector.Id); if (LastHallwaySector != null) { LastHallwaySector.SetIndicator(hallIndicator); } }
public void EnteredSector(HallSector enterSector) { if (PreviousLastSector == null) { PreviousLastSector = enterSector; LastSector = enterSector; return; } if (enterSector != PreviousLastSector && enterSector != LastSector) { PreviousLastSector = LastSector; LastSector = enterSector; RaidSceneManager.Instanse.AdvanceThroughDungeon(); } else { if (LastSector != enterSector) { PreviousLastSector = LastSector; LastSector = enterSector; } } }
public void LoadHallSectors() { string query = "SELECT * FROM HallSectors"; using (connection) { SqlCommand command = new SqlCommand(query, connection); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { HallSector s = new HallSector() { Id = (int)reader["Id"], SectorId = (int)reader["SectorId"], HallId = (int)reader["HallId"], StartRow = (int)reader["StartRow"], EndRow = (int)reader["EndRow"] }; HallSectors.Add(s); } } }
public void SetSector(HallSector sector) { Sector = sector; UpdateSector(); }
public void AddHall(HallSector hallSector) { Halls.Add(hallSector); }
public void ResetRoundSector(HallSector targetSector) { PreviousLastSector = targetSector; LastSector = targetSector; }
public void LoadSector(HallSector hallSector) { Area = hallSector; switch (Area.Type) { case AreaType.Door: if (Prop == null) { GameObject doorObject = null; if (RaidSceneManager.Raid.Quest.Dungeon == "darkestdungeon") { switch (RaidSceneManager.Raid.Quest.Id) { case "plot_darkest_dungeon_1": doorObject = Resources.Load("Prefabs/Props/SpineDoors/darkestdungeon/quest_1/Door") as GameObject; break; case "plot_darkest_dungeon_2": doorObject = Resources.Load("Prefabs/Props/SpineDoors/darkestdungeon/quest_2/Door") as GameObject; break; case "plot_darkest_dungeon_3": doorObject = Resources.Load("Prefabs/Props/SpineDoors/darkestdungeon/quest_3/Door") as GameObject; break; case "plot_darkest_dungeon_4": doorObject = Resources.Load("Prefabs/Props/SpineDoors/darkestdungeon/quest_4/Door") as GameObject; break; default: goto case "plot_darkest_dungeon_1"; } } else { doorObject = Resources.Load("Prefabs/Props/SpineDoors/" + RaidSceneManager.Raid.Quest.Dungeon + "/Door") as GameObject; } RaidDoor door = Instantiate(doorObject).GetComponent <RaidDoor>(); door.Initialize(this); Prop = door; Prop.RectTransform.SetParent(hallWall.rectTransform, false); } else { (Prop as RaidDoor).Close(); } break; case AreaType.Curio: if (Prop != null) { Destroy(Prop.gameObject); } RaidCurio curio; GameObject curioObject = Resources.Load("Prefabs/Props/SpineCurios/" + (Area.Prop as Curio).StringId) as GameObject; if (curioObject == null) { Debug.LogError("Curio: " + (Area.Prop as Curio).StringId + " not found."); curio = Instantiate(Resources.Load("Prefabs/Props/SpineCurios/_template") as GameObject).GetComponent <RaidCurio>(); } else { curio = Instantiate(curioObject).GetComponent <RaidCurio>(); } curio.Initialize(this); Prop = curio; Prop.RectTransform.SetParent(hallWall.rectTransform, false); if (Area.Knowledge == Knowledge.Completed) { curio.Activate(); } break; case AreaType.Obstacle: if (Prop != null) { Destroy(Prop.gameObject); } if (Area.Knowledge == Knowledge.Completed) { break; } RaidObstacle obstacle; GameObject obstacleObject = Resources.Load("Prefabs/Props/SpineObstacles/" + (Area.Prop as Obstacle).StringId) as GameObject; if (obstacleObject == null) { Debug.LogError("Obstacle: " + (Area.Prop as Obstacle).StringId + " not found."); obstacle = Instantiate(Resources.Load("Prefabs/Props/SpineObstacles/_template") as GameObject).GetComponent <RaidObstacle>(); } else { obstacle = Instantiate(obstacleObject).GetComponent <RaidObstacle>(); } obstacle.Initialize(this); Prop = obstacle; Prop.RectTransform.SetParent(hallWall.rectTransform, false); Prop.RectTransform.SetAsLastSibling(); break; case AreaType.Trap: if (Prop != null) { Destroy(Prop.gameObject); } if (Area.Knowledge == Knowledge.Completed) { break; } RaidTrap trap; GameObject trapObject = Resources.Load("Prefabs/Props/SpineTraps/" + (Area.Prop as Trap).StringId) as GameObject; if (trapObject == null) { Debug.LogError("Trap: " + (Area.Prop as Trap).StringId + " not found."); trap = Instantiate(Resources.Load("Prefabs/Props/SpineTraps/_template") as GameObject).GetComponent <RaidTrap>(); } else { trap = Instantiate(trapObject).GetComponent <RaidTrap>(); } trap.Initialize(this); Prop = trap; Prop.RectTransform.SetParent(hallWall.rectTransform, false); Prop.RectTransform.SetAsLastSibling(); if (Area.Knowledge == Knowledge.Hidden || Area.Knowledge == Knowledge.Visited) { trap.SkeletonAnimation.MeshRenderer.enabled = false; } break; default: if (Prop != null) { Destroy(Prop.gameObject); } break; } UpdateEnviroment(); }
Vector2 GetGridOffset(HallSector sector) { return(new Vector2(baseHallSize * sector.GridX, baseHallSize * sector.GridY)); }
public void OnHallSectorExit(HallSector sector) { RaidMapHallSectorSlot slot = HallSlots[sector.Hallway.Id].RaidMapHallSectorSlots.Find(item => item.Sector.Id == sector.Id); slot.UpdateSector(); }