Пример #1
0
        void OnEnable()
        {
            _blackTexture           = MakeTex(4, 4, EditorGUIUtility.isProSkin ? new Color(0.18f, 0.18f, 0.18f) : new Color(0.88f, 0.88f, 0.88f));
            _blackTexture.hideFlags = HideFlags.DontSave;
            _headerTexture          = Resources.Load <Texture2D> ("EditorHeader");
            blackStyle = new GUIStyle();
            blackStyle.normal.background = _blackTexture;

            selectionModeOptions  = new string[] { "None", "Territories", "Cells" };
            overlayModeOptions    = new string[] { "Overlay", "Ground" };
            topologyOptions       = new string[] { "Irregular", "Box", "Hexagonal" };
            topologyOptionsValues = new int[] {
                (int)GRID_TOPOLOGY.Irregular,
                (int)GRID_TOPOLOGY.Box,
                (int)GRID_TOPOLOGY.Hexagonal
            };

            grid = (Grid2D)target;
            if (grid.territories == null)
            {
                grid.Init();
            }

            colorSelection    = new Color(1, 1, 0.5f, 0.85f);
            cellColor         = Color.white;
            cellSelectedIndex = -1;
            isDirty           = serializedObject.FindProperty("isDirty");

            HideEditorMesh();
        }