コード例 #1
0
ファイル: AbstractValue.cs プロジェクト: xTCry/LevelGenerator
    //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);
            }
        }
    }