private ZoneLabel DrawZone(ZoneBase newZone) { var sprite = Loc.GetZoneController().ZoneSprite; var room = false; if (newZone is RoomZone) { sprite = Loc.GetZoneController().RoomSprite; room = true; } else if (newZone is StorageZone) { sprite = Loc.GetZoneController().StorageSprite; } foreach (var cell in newZone.ZoneCells.GetCells()) { SetZoneCellTile(newZone, sprite, cell); if (room) { Loc.GetStructureController().CreateRoof(cell); } } var label = Instantiate(ZoneLabelPrefab, transform); label.name = newZone.Name; label.Text.text = newZone.Name; MoveZoneLabel(newZone, label); return(label); }
internal void Show(ZoneBase selectedZone) { gameObject.SetActive(true); CurrentZone = selectedZone; RoomPanel.Hide(); StoragePanel.Hide(); AreaPanel.Hide(); if (CurrentZone is RoomZone rz) { RoomPanel.Show(rz); } else if (CurrentZone is StorageZone sz) { StoragePanel.Show(sz); } else if (CurrentZone is AreaZone ar) { AreaPanel.Show(ar); } Name.text = CurrentZone.Name; }
private void MoveZoneLabel(ZoneBase zone, ZoneLabel label) { var(bottomLeft, bottomRight, topLeft, topRight) = Loc.GetMap().GetCorners(zone.ZoneCells.GetCells()); label.transform.localPosition = new Vector3((bottomLeft.X + bottomRight.X + topLeft.X + topRight.X) / 4f, (bottomLeft.Z + bottomRight.Z + topLeft.Z + topRight.Z) / 4f, 0); label.transform.localPosition += new Vector3(0.5f, 0.5f); }
private bool SelectZone(ZoneBase zone, bool selectSimilar) { if (zone != null) { Loc.GetGameController().ShowZonePanel(zone); return(true); } return(false); }
private void AssignAndPopulateZone(string faction, Cell[] cells, ZoneBase newZone) { ClearZonesFromCells(cells); newZone.ZoneCells.AddCells(cells.ToList()); newZone.Name = name; newZone.FactionName = faction; Zones.Add(newZone, DrawZone(newZone)); }
private void SetZoneCellTile(ZoneBase newZone, string sprite, Cell cell) { var tile = ScriptableObject.CreateInstance <Tile>(); tile.sprite = Loc.GetSpriteStore().GetSprite(sprite); tile.color = newZone.ColorString.GetColorFromHex(); ZoneTilemap.SetTile(new Vector3Int(cell.X, cell.Z, 0), tile); }
public void GenerateSoundWave(Vector3 position, float radius, ZoneBase room) { //var enems = room.FindInvestigatorsInRadius(position, radius); //foreach (var e in enems) //{ // e.OnSoundListen(position); //} }
public void GenerateSoundWave(Inspectable insp, float radius, ZoneBase room) { //Debug.Log("Insp", insp); //Debug.Log("Roombase", room); ////var enems = room.FindInvestigatorsInRadius(insp.posToInspect.position, radius); //Debug.Log(enems.Count); //enems[Random.Range(0, enems.Count)].OnSoundListen(insp); }
public void Delete(ZoneBase zone) { foreach (var cell in zone.ZoneCells.GetCells()) { ZoneTilemap.SetTile(new Vector3Int(cell.X, cell.Z, 0), null); } Destroy(Zones[zone].gameObject); Zones.Remove(zone); if (zone is RoomZone rz) { RoomZones.Remove(rz); } else if (zone is StorageZone sz) { StorageZones.Remove(sz); } else if (zone is AreaZone rez) { AreaZones.Remove(rez); } }
public void SetCurrentZone(ZoneBase room) => currentZone = room;
internal void ShowZonePanel(ZoneBase zone) { DestroyZonePanel(); _currentZoneInfoPanel = Instantiate(ZoneInfoPanelPrefab, UI.transform); _currentZoneInfoPanel.Show(zone); }
private void MoveZoneLabel(ZoneBase zone) { MoveZoneLabel(zone, Zones[zone]); }
public void Refresh(ZoneBase zone) { Destroy(Zones[zone].gameObject); Zones[zone] = DrawZone(zone); }
////////////////////////////////////////////////////////////// /// FUNCTIONS ////////////////////////////////////////////////////////////// public void Initialize(ZoneBase sadsadsa) { }