Пример #1
0
    private void PlaceTileModifierVariation()
    {
        if (EditorCanvasUI.Instance.SelectedTileModifierContainer == null)
        {
            if (PersistentGameManager.CurrentSceneType == SceneType.Maze)
            {
                EditorModificationPanelContainer.Instance.SelectMazeTileModificationPanel();
            }
            else
            {
                EditorModificationPanelContainer.Instance.SelectOverworldTileModificationPanel();
            }
        }

        EditorTileModifierCategory editorMazeTileModifierCategory = EditorManager.SelectedTileModifierCategory;

        GameManager.Instance.CurrentEditorLevel.TilesByLocation.TryGetValue(CurrentlySelectedTile.GridLocation, out Tile tile);
        EditorSelectedTileModifierContainer selectedTileModifierContainer = EditorCanvasUI.Instance.SelectedTileModifierContainer;

        if (editorMazeTileModifierCategory == EditorTileModifierCategory.Attribute)
        {
            List <IEditorTileModifier>  attributes = selectedTileModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.Attribute];
            EditorTileAttributeModifier attribute  = attributes[EditorManager.SelectedTileAttributeModifierIndex] as EditorTileAttributeModifier;
            PlaceTileAttributeVariation(tile, attribute);
        }
        else if (editorMazeTileModifierCategory == EditorTileModifierCategory.Background)
        {
            List <IEditorTileModifier>   backgrounds = selectedTileModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.Background];
            EditorTileBackgroundModifier background  = backgrounds[EditorManager.SelectedTileBackgroundModifierIndex] as EditorTileBackgroundModifier;
            PlaceMazeTileBackgroundVariation(tile, background);
        }
    }
Пример #2
0
    private void PlaceMazeTileBackgroundVariation(Tile tile, EditorTileBackgroundModifier background)
    {
        if (background == null)
        {
            Logger.Error($"Could not find the background type {background.GetType()}");
        }

        background.PlaceBackgroundVariation <Tile>(tile);
    }
Пример #3
0
    private void PlaceTileModifier()
    {
        if (EditorCanvasUI.Instance.SelectedTileModifierContainer == null)
        {
            if (PersistentGameManager.CurrentSceneType == SceneType.Maze)
            {
                EditorModificationPanelContainer.Instance.SelectMazeTileModificationPanel();
            }
            else
            {
                EditorModificationPanelContainer.Instance.SelectOverworldTileModificationPanel();
            }
        }

        EditorTileModifierCategory          editorTileModifierType        = EditorManager.SelectedTileModifierCategory;
        EditorSelectedTileModifierContainer selectedTileModifierContainer = EditorCanvasUI.Instance.SelectedTileModifierContainer;

        GameManager.Instance.CurrentEditorLevel.TilesByLocation.TryGetValue(CurrentlySelectedTile.GridLocation, out Tile tile);

        if (editorTileModifierType == EditorTileModifierCategory.Attribute)
        {
            List <IEditorTileModifier>  attributes = selectedTileModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.Attribute];
            EditorTileAttributeModifier attribute  = attributes[EditorManager.SelectedTileAttributeModifierIndex] as EditorTileAttributeModifier;
            PlaceTileAttribute(tile, attribute);
        }
        else if (editorTileModifierType == EditorTileModifierCategory.Background)
        {
            List <IEditorTileModifier>   backgrounds = selectedTileModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.Background];
            EditorTileBackgroundModifier background  = backgrounds[EditorManager.SelectedTileBackgroundModifierIndex] as EditorTileBackgroundModifier;
            PlaceTileBackground(tile, background);
        }
        else if (editorTileModifierType == EditorTileModifierCategory.TransformationTriggerer)
        {
            List <IEditorTileModifier>       transformationTriggerers = selectedTileModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.TransformationTriggerer];
            EditorTileTransformationModifier transformationTriggerer  = transformationTriggerers[EditorManager.SelectedTileTransformationTriggererIndex] as EditorTileTransformationModifier;
            PlaceTransformationTriggerer(tile, transformationTriggerer);
        }
        else if (editorTileModifierType == EditorTileModifierCategory.Area)
        {
            List <IEditorTileModifier> areaModifiers    = selectedTileModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.Area];
            EditorTileAreaModifier     tileAreaModifier = areaModifiers[EditorManager.SelectedTileAreaModifierIndex] as EditorTileAreaModifier;
            AddToSelectedArea(tile, tileAreaModifier);
        }
        else
        {
            Logger.Error($"EditorMazeTileModifierType {editorTileModifierType} not yet implemented");
        }
    }
    public override void SetSelectedModifier(int modifierIndex)
    {
        List <IEditorTileModifier> currentlyAvailableTileBackgrounds = _editorSelectedModifierContainer.CurrentlyAvailableTileModifiers[EditorTileModifierCategory.Background];

        if (currentlyAvailableTileBackgrounds.Count == 0)
        {
            EditorManager.SelectedTileBackgroundModifierIndex = 0;
            return;
        }

        EditorTileBackgroundModifier background = currentlyAvailableTileBackgrounds[modifierIndex] as EditorTileBackgroundModifier;

        _editorSelectedModifierContainer.SelectedModifierLabel.text    = GetSelectedModifierLabel(background.Name);
        _editorSelectedModifierContainer.SelectedModifierSprite.sprite = background.GetSprite();
        EditorManager.SelectedTileBackgroundModifierIndex = modifierIndex;

        EditorManager.SelectedTileModifier = background;
    }