Exemple #1
0
        public override void Perform(object obj)
        {
            Tilemap tilemap = GetTilemap(obj);

            if (tilemap == null)
            {
                return;
            }

            // Find or create a camera view in tilemap editing mode
            CamViewPlugin camViewPlugin = DualityEditorApp.GetPlugin <CamViewPlugin>();

            if (camViewPlugin == null)
            {
                return;
            }
            CamView.CamView camView = camViewPlugin.CreateOrSwitchCamView(typeof(TilemapEditorCamViewState));
            if (camViewPlugin == null)
            {
                return;
            }

            // Select the tilemap in question. The tilemap editor will react.
            DualityEditorApp.Select(this, new ObjectSelection(tilemap));

            // See if we can find a renderer that uses the tilemap and focus on it.
            TilemapRenderer renderer = Scene.Current
                                       .FindComponents <TilemapRenderer>()
                                       .FirstOrDefault(r => r.ActiveTilemap == tilemap);

            if (renderer != null)
            {
                DualityEditorApp.Highlight(this, new ObjectSelection(renderer), HighlightMode.Spatial);
            }
        }
        public override void Perform(object obj)
        {
            HexMap hexmap = GetHexmap(obj);

            if (hexmap == null)
            {
                return;
            }

            // Find or create a camera view in tilemap editing mode
            CamViewPlugin camViewPlugin = DualityEditorApp.GetPlugin <CamViewPlugin>();

            if (camViewPlugin == null)
            {
                return;
            }
            CamView camView = camViewPlugin.CreateOrSwitchCamView(typeof(HexMapCamViewState));

            if (camViewPlugin == null)
            {
                return;
            }

            DualityEditorApp.Select(this, new ObjectSelection(hexmap));

            DualityEditorApp.Highlight(this, new ObjectSelection(hexmap), HighlightMode.Spatial);
        }