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()); }
public void ChangeOrder(Layer layer) { LayerOption s = layers.Find(l => l.Layer.Name == layer.Name); if (s == null) { return; } s.transform.SetSiblingIndex(layer.SortingOrder); }
public void DeleteSelectedLayer() { if (selectedOption == null) { return; } LevelManager.Instance.Level.DeleteLayer(selectedOption.Layer); Destroy(selectedOption.gameObject); selectedOption = null; collisionLayerDropdown.interactable = false; }
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; }