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); } } }
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; }