Beispiel #1
0
    // Every time we access a different tile, check if there is an enemy spawnpoint on it
    public void CheckForEnemySpawnpointOnTile()
    {
        MazeTile        selectedTile    = EditorTileSelector.Instance.CurrentlySelectedTile as MazeTile;
        EnemySpawnpoint enemySpawnpoint = selectedTile?.TryGetEnemySpawnpoint();

        if (enemySpawnpoint == null)
        {
            _tileAreaNamesDropdown.gameObject.SetActive(false);
            _assignedAreasText.gameObject.SetActive(false);
        }
        else
        {
            _tileAreaNamesDropdown.gameObject.SetActive(true);
            _assignedAreasText.gameObject.SetActive(true);

            RedrawAssignedAreasTest(enemySpawnpoint);
            RedrawDropdownOptions();
        }
    }
Beispiel #2
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;
            }
        }
    }
Beispiel #3
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;
    }