コード例 #1
0
ファイル: FromMapEditor.cs プロジェクト: wwnje/MapStepping
        private void OnEnable()
        {
            _fromMap = (FromMap)target;
            tileMap  = _fromMap.tileMap;

            tileSize = _fromMap.TileSize;

            maxV3Int = new Vector3Int(tileSize - 1, tileSize - 1, 0);

            // 菱形地图轮廓
            leftV3IntForPos   = new Vector3Int(0, tileSize - 1, 0) + new Vector3Int(0, 1, 0);;
            bottomV3IntForPos = Vector3Int.zero;
            rightV3IntForPos  = new Vector3Int(tileSize - 1, 0, 0) + new Vector3Int(1, 0, 0);
            topV3IntForPos    = new Vector3Int(tileSize - 1, tileSize - 1, 0) + new Vector3Int(1, 1, 0);

            leftPos   = tileMap.CellToWorld(leftV3IntForPos);
            bottomPos = tileMap.CellToWorld(bottomV3IntForPos);
            rightPos  = tileMap.CellToWorld(rightV3IntForPos);
            topPos    = tileMap.CellToWorld(topV3IntForPos);

            labelSize = new Vector2(EditorGUIUtility.singleLineHeight * 2, EditorGUIUtility.singleLineHeight * 2);

            guiStyle = new GUIStyle
            {
                alignment = TextAnchor.MiddleCenter
            };
        }