예제 #1
0
        public void AddLayer(Layer layer)
        {
            GameObject  layerOb = Instantiate(layerOptionPrefab, layerParent);
            LayerOption option  = layerOb.GetComponent <LayerOption> ();

            option.Initialize(layer);
            layers.Add(option);
            layer.ChangeSortingOrder(layerOb.transform.GetSiblingIndex());
        }
예제 #2
0
        public void ChangeOrder(Layer layer)
        {
            LayerOption s = layers.Find(l => l.Layer.Name == layer.Name);

            if (s == null)
            {
                return;
            }

            s.transform.SetSiblingIndex(layer.SortingOrder);
        }
예제 #3
0
        public void DeleteSelectedLayer()
        {
            if (selectedOption == null)
            {
                return;
            }

            LevelManager.Instance.Level.DeleteLayer(selectedOption.Layer);

            Destroy(selectedOption.gameObject);

            selectedOption = null;
            collisionLayerDropdown.interactable = false;
        }
예제 #4
0
        public void SelectOption(LayerOption option)
        {
            if (selectedOption == option)
            {
                return;
            }

            Image image = option.GetComponent <Image> ();

            layerNormalColor = image.color;
            image.color      = layerSelectedColor;

            if (selectedOption != null)
            {
                selectedOption.GetComponent <Image> ().color = layerNormalColor;
            }

            selectedOption = option;

            string collisionLayer = LayerMask.LayerToName(selectedOption.Layer.CollisionLayer);

            collisionLayerDropdown.value        = collisionLayerDropdown.options.FindIndex(o => o.text == collisionLayer);
            collisionLayerDropdown.interactable = true;
        }