Beispiel #1
0
    void drawCustomInspector(string tag, GameObject obj)
    {
        string tagClass = "Custom" + char.ToUpper(tag[0]) + tag.Substring(1);


        switch (tagClass)
        {
        case "CustomEnemy":
            CustomEnemy.OnCustomInspectorGUI(obj);
            break;

        case "CustomTest":
            CustomTest.OnCustomInspectorGUI(obj);
            break;
        }

        /*
         * Possible Future Implementation -
         *  Pre-define the 'Custom' part like do now
         *  Convert String->Class So can call: "CustomTag".OnCustomInspectorGUI(obj)
         *      "OnCustomInspectorGUI" would be a Pre-defined method common to all Custom classes
         *      'obj' would be the GameObject passed into method where class type is found in component
         *
         * Error Checking -
         *  When pass obj to OnCustomInspectorGUI and try to 'find' component, it won't be found
         *      This means 1. Improper Tag on Object, 2. Script missing on Object
         */
    }
 // Use this for initialization
 void Start()
 {
     parent = GetComponentInParent <CustomEnemy>();
 }