void OnGUI() { EditorGUILayout.LabelField("Player Components"); if (GUILayout.Button("Base Locomotion")) { var curComponent = new EF_Base_Locomotion(); if (OnAdd != null) { AddComponentArgs args = new AddComponentArgs(); args.aComponent = curComponent; OnAdd(this, args); } this.Close(); } if (GUILayout.Button("FPS Locomotion")) { var curComponent = new EF_FPS_Locomotion(); if (OnAdd != null) { AddComponentArgs args = new AddComponentArgs(); args.aComponent = curComponent; OnAdd(this, args); } this.Close(); } if (GUILayout.Button("Base Jump")) { var curComponent = new EF_Base_Jump(); if (OnAdd != null) { AddComponentArgs args = new AddComponentArgs(); args.aComponent = curComponent; OnAdd(this, args); } this.Close(); } if (GUILayout.Button("Base Thrusters")) { var curComponent = new EF_Base_Thruster(); if (OnAdd != null) { AddComponentArgs args = new AddComponentArgs(); args.aComponent = curComponent; OnAdd(this, args); } this.Close(); } if (GUILayout.Button("Close", GUILayout.Height(25), GUILayout.ExpandWidth(true))) { this.Close(); } }
public void AddComponent(object sender, AddComponentArgs args) { // Debug.Log("Adding Component"); if (args != null) { if (args.aComponent != null) { m_Compnents.Add(args.aComponent); args.aComponent.parentConfig = this; AssetDatabase.AddObjectToAsset(args.aComponent, this); AssetDatabase.SaveAssets(); } } }