Beispiel #1
0
    /// <summary>
    /// The Custom Inspector you will see in a custom location
    /// in which this static function is called.
    /// (IE: In MultiObjectWindow.cs)
    /// </summary>
    /// <param name="obj">GameObject with the script Enemy attached</param>
    public static void OnCustomInspectorGUI(GameObject obj)
    {
        Enemy e = obj.GetComponent <Enemy>();

        // Produce error or e = null ?
        if (e == null)
        {
            CustomAPI.ErrorGUI(obj, typeof(Enemy));
        }
        else
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            addCVX(e);

            e.maxHP = (int)EditorGUILayout.Knob(new Vector2(25, 25), (float)e.maxHP, minMaxHP, maxMaxHP, "maxHP",
                                                Color.white, Color.cyan, true, GUILayout.MaxWidth(75));
            if (e.currentHP > e.maxHP)
            {
                e.currentHP = e.maxHP;
            }
            e.currentHP = (int)EditorGUILayout.Knob(new Vector2(25, 25), (float)e.currentHP, 0, e.maxHP, "curHP",
                                                    Color.white, Color.cyan, true, GUILayout.MaxWidth(75));


            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
    }
Beispiel #2
0
    /// <summary>
    /// The Custom Inspector you will see in a custom location
    /// in which this static function is called.
    /// (IE: In MultiObjectWindow.cs)
    /// </summary>
    /// <param name="obj">GameObject with the script Enemy attached</param>
    public static void OnCustomInspectorGUI(GameObject obj)
    {
        Test comp = obj.GetComponent <Test>();

        // Produce error or e = null ?
        if (comp == null)
        {
            CustomAPI.ErrorGUI(obj, typeof(Test));
        }
        else
        {
            addCVX(comp);
            GUILayout.Label("Goodbye World");
        }
    }