Example #1
0
        public void MoveTileToLayer(TileObject tile, TagLayer layer, bool allowMultiLayer = false)
        {
            if (!tiles.Contains(tile))
            {
                Debug.LogWarning("Atlas doesnt contain tile " + tile.name, this); return;
            }
            if (layer.layerObjects.Contains(tile))
            {
                Debug.Log("Layer already contains tile " + tile.name, this); return;
            }

            if (!allowMultiLayer)
            {
                foreach (var lay in layers)
                {
                    if (lay != layer)
                    {
                        if (lay.layerObjects.Contains(tile))
                        {
                            lay.layerObjects.Remove(tile);
                        }
                    }
                }
            }

            layer.layerObjects.Add(tile);
            UnityEditor.EditorUtility.SetDirty(this);
        }
Example #2
0
        public TagLayer AddTagLayer()
        {
            var newLayer = new TagLayer("Layer", UnityEngine.Random.ColorHSV(0f, 1f, 0.5f, 0.5f, 0.6f, 0.8f), Vector3.one);

            layers.Add(newLayer);
            return(newLayer);
        }
Example #3
0
 public void RemoveTileFromLayer(TileObject tile, TagLayer layer)
 {
     if (layer.layerObjects.Contains(tile))
     {
         layer.layerObjects.Remove(tile);
     }
     UnityEditor.EditorUtility.SetDirty(this);
 }
Example #4
0
 public void RemoveLayer(TagLayer layer)
 {
     layers.Remove(layer);
     UnityEditor.EditorUtility.SetDirty(this);
 }