Exemplo n.º 1
0
 public GameBoard(int width, int height)
 {
     Height     = height;
     Width      = width;
     TileArea   = new TileArea(Width, Height);
     ObjectArea = new GameObjectArea(Width, Height);
 }
Exemplo n.º 2
0
    public EditorTileAreaEntry WithNewTileAreaComponent()
    {
        TileArea = new TileArea("New area");
        GameManager.Instance.CurrentEditorLevel.TileAreas.Add(TileArea.Id, TileArea);

        return(this);
    }
Exemplo n.º 3
0
 protected override void InitialiseEditorTileAreas(MazeLevelData mazeLevelData)
 {
     for (int i = 0; i < mazeLevelData.TileAreas.Count; i++)
     {
         SerialisableTileArea serialisableTileArea = mazeLevelData.TileAreas[i];
         TileArea             newTileArea          = new TileArea(serialisableTileArea);
         TileAreas.Add(newTileArea.Id, newTileArea);
     }
 }
    public virtual void PlaceEnemySpawnpoint(List <string> tileAreaIds = null, Dictionary <string, TileArea> globalTileAreas = null)
    {
        EnemySpawnpoint enemySpawnpoint = (EnemySpawnpoint)InstantiateTileAttributeGO <EnemySpawnpoint>();

        Tile.SetWalkable(true);
        Tile.TryMakeMarkable(true);
        Tile.AddAttribute(enemySpawnpoint);

        MazeLevelGameplayManager.Instance.EnemyCharacterSpawnpoints.Add(enemySpawnpoint);

        if (tileAreaIds != null && globalTileAreas != null)
        {
            for (int i = 0; i < tileAreaIds.Count; i++)
            {
                TileArea tileArea = globalTileAreas[tileAreaIds[i]];
                enemySpawnpoint.AddTileArea(tileArea);
            }
        }
    }
Exemplo n.º 5
0
    private void RedrawDropdownOptions()
    {
        MazeTile        selectedTile    = EditorTileSelector.Instance.CurrentlySelectedTile as MazeTile;
        EnemySpawnpoint enemySpawnpoint = selectedTile?.TryGetEnemySpawnpoint();

        for (int i = 1; i < _tileAreaNamesDropdown.options.Count; i++)
        {
            string   areaId           = _tileAreaIdByDropdownOption[_tileAreaNamesDropdown.options[i]];
            TileArea tileArea         = GameManager.Instance.CurrentEditorLevel.TileAreas[areaId];
            string   originalAreaName = tileArea.Name;
            if (enemySpawnpoint.TileAreas.Contains(tileArea))
            {
                _tileAreaNamesDropdown.options[i].text = $"(X) {originalAreaName}";
            }
            else
            {
                _tileAreaNamesDropdown.options[i].text = originalAreaName;
            }
        }
    }
Exemplo n.º 6
0
    private void AddTileAreaToSpawnpoint()
    {
        if (_tileAreaNamesDropdown.value == 0)
        {
            return;
        }

        MazeTile        selectedTile    = EditorTileSelector.Instance.CurrentlySelectedTile as MazeTile;
        EnemySpawnpoint enemySpawnpoint = selectedTile?.TryGetEnemySpawnpoint();

        if (enemySpawnpoint == null)
        {
            Logger.Log("could not find enemySpawnpoint on the selected tile");
            return;
        }

        string currentlySelectedTileAreaId = GetIdCurrentSelectedTileArea();

        TileArea tileAreaInList = enemySpawnpoint.TileAreas.FirstOrDefault(tileArea => tileArea.Id == currentlySelectedTileAreaId);
        TileArea tileArea       = GameManager.Instance.CurrentEditorLevel.TileAreas[currentlySelectedTileAreaId];

        if (tileAreaInList == null)
        {
            Logger.Log("did not find the area in the list, so we add it");

            enemySpawnpoint.AddTileArea(tileArea);
        }
        else
        {
            Logger.Log($"The currently selected tile area is {tileAreaInList.Name}");
            enemySpawnpoint.RemoveTileArea(tileArea);
        }

        _assignedAreasText.text = GenerateAssignedAreasText(enemySpawnpoint);

        RedrawDropdownOptions();

        _tileAreaNamesDropdown.value = 0;
    }
Exemplo n.º 7
0
    public void SetSelectedTile(EditorMazeTile tile)
    {
        Logger.Log("Set selected tile");
        TileArea selectedTileArea = TileAreaActionHandler.Instance.SelectedTileAreaEntry?.TileArea;

        if (selectedTileArea == null)
        {
            return;
        }

        if (tile.GetTileArea(selectedTileArea) == null)
        {
            Logger.Log("set selected tile. Overlay mode blue");
            tile.SetTileOverlayImage(TileOverlayMode.Blue);
            tile.AddTileArea(selectedTileArea);
        }
        else
        {
            Logger.Log("unset selected tile. Overlay mode Empty");
            tile.SetTileOverlayImage(TileOverlayMode.Empty);
            tile.RemoveTileArea(selectedTileArea);
        }
    }
Exemplo n.º 8
0
        public void addArea(Point size, Point offset)
        {
            TileArea area = new TileArea(this, size, offset);

            for (int x = 0; x < size.X; ++x)
            {
                for (int y = 0; y < size.Y; ++y)
                {
                    Point temp = new Point(offset.X + x, offset.Y + y);
                    TileStatus status = getTile(temp);
                    if (status == TileStatus.INVALID)
                    {
                        area.setTile(temp, TileStatus.OPEN);
                    }
                    else
                    {
                        area.setTile(temp, status);
                    }
                }
            }

            areas_.Add(area);
        }
Exemplo n.º 9
0
 public EditorTileAreaEntry WithTileAreaComponent(TileArea tileArea)
 {
     TileArea = tileArea;
     return(this);
 }
Exemplo n.º 10
0
 public EnterCommand(Key key, MovementArea movementArea,
                     GameObjectArea objectArea, TileArea tileArea) :
     base(key, movementArea, objectArea)
 {
     this.tileArea = tileArea;
 }
Exemplo n.º 11
0
 public GameOverControl(TileArea tileArea)
 {
     this.tileArea = tileArea;
 }
Exemplo n.º 12
0
 public void RemoveTileArea(TileArea tileArea)
 {
     TileAreas.Remove(tileArea);
 }
Exemplo n.º 13
0
 public void AddTileArea(TileArea tileArea)
 {
     TileAreas.Add(tileArea);
 }
Exemplo n.º 14
0
 public SerialisableTileArea(TileArea tileArea)
 {
     Name = tileArea.Name;
     Id   = tileArea.Id;
 }