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.
48 lines
1.2 KiB
48 lines
1.2 KiB
using UnityEditor; |
|
using UnityEngine; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using System.Reflection; |
|
|
|
namespace Fungus |
|
{ |
|
|
|
[CustomEditor (typeof(RandomInteger))] |
|
public class RandomIntegerEditor : 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(); |
|
|
|
RandomInteger t = target as RandomInteger; |
|
|
|
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(IntegerVariable))); |
|
|
|
EditorGUILayout.PropertyField(minValueProp); |
|
EditorGUILayout.PropertyField(maxValueProp); |
|
|
|
serializedObject.ApplyModifiedProperties(); |
|
} |
|
} |
|
|
|
}
|
|
|