예제 #1
0
    //Draw a preview Gizmo, if showPreview is enabled
    //For int and float, a disc for the min and max values is drawn
    //For vector3, a box for each min and max value is drawn
#if UNITY_EDITOR
    public override void DrawEditorGizmos()
    {
        if (component != null && showPreview)
        {
            if (IsSelectedOfType(typeof(int)))
            {
                EditorGUIExtension.RadiusDisc(transform.position, minIntVal, Color.red);
                EditorGUIExtension.RadiusDisc(transform.position, maxIntVal, Color.green);
            }
            else if (IsSelectedOfType(typeof(Single)))
            {
                EditorGUIExtension.RadiusDisc(transform.position, minFloatVal, Color.red);
                EditorGUIExtension.RadiusDisc(transform.position, maxFloatVal, Color.green);
            }
            else if (IsSelectedOfType(typeof(Vector3)))
            {
                EditorGUIExtension.DrawPreviewCube(transform.position, minVec3Val, Color.red);
                EditorGUIExtension.DrawPreviewCube(transform.position, maxVec3Val, Color.green);
            }
            else if (IsSelectedOfType(typeof(Vector2)))
            {
                EditorGUIExtension.AreaRect(minVec2Val, transform.position, Color.red);
                EditorGUIExtension.AreaRect(maxVec2Val, transform.position, Color.green);
            }
        }
    }
예제 #2
0
    public void OnSceneGUI()
    {
        if (sArray.areaType == AreaType.SPHERICAL)
        {
            EditorGUIExtension.RadiusDisc(sArray.transform.position, sArray.radius, Color.yellow);
        }

        if (sArray.areaType == AreaType.RECT)
        {
            EditorGUIExtension.AreaRect(sArray.rectArea, sArray.transform.position, Color.yellow);
        }

        if (sArray.areaType == AreaType.ABSTRACTBOUNDS)
        {
            Vector3 bounds = sArray.AbstractBounds.Size;
            Vector3 origin = sArray.AbstractBounds.transform.position;
            Vector2 rect   = new Vector2(bounds.x, bounds.z);
            EditorGUIExtension.AreaRect(rect, origin, Color.yellow);
        }
        //float spacingRadius = sArray.spacing + sArray.PreviewMesh.sharedMesh.bounds.extents.magnitude;
        //RadiusDisc (spacingRadius, Color.black);
    }