You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
10 years ago
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Reflection;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
|
|
||
|
[CustomEditor (typeof(RandomFloat))]
|
||
|
public class RandomFloatEditor : CommandEditor
|
||
|
{
|
||
|
protected SerializedProperty variableProp;
|
||
|
protected SerializedProperty minValueProp;
|
||
|
protected SerializedProperty maxValueProp;
|
||
|
|
||
|
protected virtual void OnEnable()
|
||
|
{
|
||
|
variableProp = serializedObject.FindProperty("variable");
|
||
|
minValueProp = serializedObject.FindProperty("minValue");
|
||
|
maxValueProp = serializedObject.FindProperty("maxValue");
|
||
|
}
|
||
|
|
||
|
public override void DrawCommandGUI()
|
||
|
{
|
||
|
serializedObject.Update();
|
||
|
|
||
|
RandomFloat t = target as RandomFloat;
|
||
|
|
||
|
FungusScript fungusScript = t.GetFungusScript();
|
||
|
if (fungusScript == null)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
VariableEditor.VariableField(variableProp,
|
||
|
new GUIContent("Variable", "Variable to use in operation"),
|
||
|
t.GetFungusScript(),
|
||
|
(v) => (v.GetType() == typeof(FloatVariable)));
|
||
|
|
||
|
EditorGUILayout.PropertyField(minValueProp);
|
||
|
EditorGUILayout.PropertyField(maxValueProp);
|
||
|
|
||
|
serializedObject.ApplyModifiedProperties();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|