Пример #1
0
 public void SelectToolboxTile(ToolboxTileTemplate selectedTile)
 {
     HideProperties();
     EditorTileManager.Instance.HideEditorHighlight();
     HighlightSelectedTileTemplate(selectedTile.assetCode);
     tileTemplate = selectedTile;
 }
Пример #2
0
        public void OnPointerClick(PointerEventData eventData)
        {
            if (isEditable)
            {
                //When player is editing tiles
                if (ToolboxManager.Instance.selectedTileType == ToolBoxTileType.Tile)
                {
                    ToolboxTileTemplate template = ToolboxManager.Instance.tileTemplate;
                    if (string.IsNullOrEmpty(template.assetCode))
                    {
                        Debug.Log("User want to select this tile");
                        MapEditorTileProperty.Instance.ShowProperty(this);
                        EditorTileManager.Instance.ShowEditorHighlight(transform.position);
                    }
                    else
                    {
                        //User wants to replace this tile with another one

                        //Only replace when user pick different template
                        if (!template.assetCode.Equals(this.assetCode))
                        {
                            assetCode = template.assetCode;
                            this.gameObject.GetComponent <Renderer>().material = template.GetMaterial();
                        }
                    }
                }
            }
        }
Пример #3
0
        public void SelectToolboxSpawner(ToolBoxSpawnerTemplate selectedSpawner)
        {
            HideProperties();
            EditorTileManager.Instance.HideEditorHighlight();
            HighlightSelectedSpawnerTemplate(selectedSpawner.assetCode);
            tileTemplate = selectedSpawner;

            if (string.IsNullOrEmpty(selectedSpawner.assetCode))
            {
                EditorTileManager.Instance.DisableSpawnerSpawnDetection();
            }
            else
            {
                EditorTileManager.Instance.EnableSpawnerSpawnDetection();
            }
        }
Пример #4
0
        public void SelectToolboxMapFeature(ToolboxMapFeatureTemplate selectedMF)
        {
            HideProperties();
            EditorTileManager.Instance.HideEditorHighlight();
            HighlightSelectedMFTemplate(selectedMF.assetCode);
            tileTemplate = selectedMF;

            if (string.IsNullOrEmpty(selectedMF.assetCode))
            {
                EditorTileManager.Instance.DisableMapFeatureSpawnDetection();
            }
            else
            {
                EditorTileManager.Instance.EnableMapFeatureSpawnDetection();
            }
        }
Пример #5
0
        void HighlightSelectedTileTemplate(string assetCode)
        {
            int count = parentTemplateTile.childCount;

            for (int i = 0; i < count; i++)
            {
                ToolboxTileTemplate tileTemplate = parentTemplateTile.GetChild(i).gameObject.GetComponent <ToolboxTileTemplate>();
                if (tileTemplate != null)
                {
                    if (tileTemplate.assetCode.Equals(assetCode))
                    {
                        tileTemplate.SetImageSelect();
                    }
                    else
                    {
                        tileTemplate.SetImageUnselect();
                    }
                }
            }
        }