Пример #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            AdjacentConfiguration obj = property.objectReferenceValue as AdjacentConfiguration;
            float center_y            = position.y + position.height / 2f;
            float center_x            = position.x + position.width / 2f;

            GUIStyle style = new GUIStyle(EditorStyles.toolbarButton);

            style.stretchHeight = true;
            style.stretchWidth  = true;
            style.fixedHeight   = 0;
            style.fixedWidth    = 0;

            EditorGUI.BeginProperty(position, label, property);
            //draw hexagon blend tile orientation
            BlendTile tile       = obj.tile;
            Rect      point_rect = new Rect(0, 0, POINT_LENGTH, POINT_LENGTH);
            Rect      adj_rect   = new Rect(0, 0, ADJ_LENGTH, ADJ_LENGTH);

            for (int d = 0; d < 6; d++)
            {
                //calculate hexagon rect positions
                point_rect.x = center_x + point_center[d].x - (POINT_LENGTH / 2f);
                point_rect.y = center_y + point_center[d].y - (POINT_LENGTH / 2f);
                adj_rect.x   = center_x + adj_center[d].x - (ADJ_LENGTH / 2f) + HORZ_OFFSET;
                adj_rect.y   = center_y + adj_center[d].y - (ADJ_LENGTH / 2f) + VERT_OFFSET;
                //draw uninteractive toggle
                int hpoint_index = MeshGeneration.ND[obj.shift, d];
                EditorGUI.Toggle(point_rect, tile.IsHighPoint(hpoint_index), EditorStyles.radioButton);
                //draw adjacent blend option popup
                obj[d] = (AdjBlendTile)EditorGUI.EnumPopup(adj_rect, obj[d], style);
            }
            property.serializedObject.ApplyModifiedProperties();
            EditorGUI.EndProperty();
        }
Пример #2
0
 public void Init()
 {
     config = ScriptableObject.CreateInstance <AdjacentConfiguration>();
     config.Init();
 }