コード例 #1
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.LabelField("Please use the Monster Editor Window to modify stats");
        EditorGUILayout.LabelField("You must also open the prefeb editor");
        if (GUILayout.Button("Open Window"))
        {
            EnemyEntityEditor.MenuCreateWindow();
        }
        //The string labels can be changed without issue
        Entity temp = (Entity)serializedObject.FindProperty("entity").objectReferenceValue;

        //HACK
        //if temp is null say so and bail
        if (temp == null)
        {
            EditorGUILayout.LabelField("No enemy data");
        }
        EditorGUILayout.LabelField("Health: " + temp.hitPoints);
        EditorGUILayout.LabelField("Endurance: " + temp.endurance);
        EditorGUILayout.LabelField("Magic: " + temp.mana);
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Strength: " + temp.strength);
        EditorGUILayout.LabelField("Constitution: " + temp.constitution);
        EditorGUILayout.LabelField("Intelligence: " + temp.intelligence);
        EditorGUILayout.LabelField("Willpower: " + temp.willpower);
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Physical Armor: " + temp.physicalArmor);
        EditorGUILayout.LabelField("Magic armor: " + temp.magicArmor);
    }
コード例 #2
0
 public override void OnInspectorGUI()
 {
     EditorGUILayout.LabelField("Please use the Entity Editor Window");
     if (GUILayout.Button("Open Window"))
     {
         EnemyEntityEditor.MenuCreateWindow();
     }
 }
コード例 #3
0
 public static void CodeReload()
 {
     //detects if the window is alread opened and grabs it.
     //Code recompiles causes the instance reference to be lost.
     if (EditorWindow.HasOpenInstances <EnemyEntityEditor>())
     {
         instance = EditorWindow.GetWindow <EnemyEntityEditor>("", false);
         instance.UpdateSlection();
     }
 }
コード例 #4
0
 public static void MenuCreateWindow()
 {
     if (instance == null)
     {
         instance = CreateWindow <EnemyEntityEditor>();
     }
     else
     {
         EditorWindow.FocusWindowIfItsOpen <EnemyEntityEditor>();
     }
     instance.UpdateSlection();
 }