Example #1
0
    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);
    }
Example #2
0
    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;
    }
Example #3
0
 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);
 }
Example #4
0
 private bool SelectZone(ZoneBase zone, bool selectSimilar)
 {
     if (zone != null)
     {
         Loc.GetGameController().ShowZonePanel(zone);
         return(true);
     }
     return(false);
 }
Example #5
0
    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));
    }
Example #6
0
    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);
    }
Example #7
0
    public void GenerateSoundWave(Vector3 position, float radius, ZoneBase room)
    {
        //var enems = room.FindInvestigatorsInRadius(position, radius);

        //foreach (var e in enems)
        //{
        //    e.OnSoundListen(position);
        //}
    }
Example #8
0
    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);
    }
Example #9
0
    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);
        }
    }
Example #10
0
 public void SetCurrentZone(ZoneBase room) => currentZone = room;
Example #11
0
 internal void ShowZonePanel(ZoneBase zone)
 {
     DestroyZonePanel();
     _currentZoneInfoPanel = Instantiate(ZoneInfoPanelPrefab, UI.transform);
     _currentZoneInfoPanel.Show(zone);
 }
Example #12
0
 private void MoveZoneLabel(ZoneBase zone)
 {
     MoveZoneLabel(zone, Zones[zone]);
 }
Example #13
0
 public void Refresh(ZoneBase zone)
 {
     Destroy(Zones[zone].gameObject);
     Zones[zone] = DrawZone(zone);
 }
Example #14
0
    //////////////////////////////////////////////////////////////
    /// FUNCTIONS
    //////////////////////////////////////////////////////////////

    public void Initialize(ZoneBase sadsadsa)
    {
    }