Пример #1
0
 private void init()
 {
     LoadTileSetManager();
     m_Object = new SerializedObject(target);
     newMapSize = m_Object.FindProperty("NewMapSize");
     previewSize = m_Object.FindProperty("PreviewSize");
     selectedLayer = m_Object.FindProperty("SelectedLayerIndex");
     showEdit = m_Object.FindProperty("ShowEdit");
     m_Object.Update();
     previewSize.floatValue = Mathf.Clamp(previewSize.floatValue, minPreviewSize, maxPreviewSize);
     m_Object.ApplyModifiedProperties();
     tileMap = (TileMap)target;
     tileMap.NewMapSize = tileMap.MapSize;
     savedTool = Tools.current;
     showTileWindow = true;
     showTileWindow = true;
     tileSelectMode = TileSelectMode.TileSet;
     skin = AssetDatabase.LoadAssetAtPath("Assets/Tile Editor/GUI/Editor Skin.guiskin", typeof(GUISkin)) as GUISkin;
     Undo.undoRedoPerformed += OnUndoRedo;
     initTileLayerList();
 }
Пример #2
0
 public static TileLayer CreateLayer(TileMap tileMap)
 {
     GameObject go = new GameObject("Tile Layer");
     TileLayer layer = go.AddComponent(typeof(TileLayer)) as TileLayer;
     layer.Tiles = new Tile[(int)(tileMap.MapSize.x * tileMap.MapSize.y)];
     layer.transform.parent = tileMap.transform;
     go.transform.position = tileMap.transform.position;
     return layer;
 }