void CreateListener(EnemyEvent _event) { EnemyEventListener listener = new EnemyEventListener { _Event = _event }; eventSystem.listeners.Add(listener); }
public override void OnInspectorGUI() { DrawDefaultInspector(); EnemyEvent _event = (EnemyEvent)target; enemy = EditorGUILayout.ObjectField(enemy, typeof(Enemy), true) as Enemy; if (GUILayout.Button("Raise")) { _event.Raise(enemy); } }
void DrawEventAssignment() { GUILayout.BeginVertical(); GUILayout.Label("Add Event"); assignedEvent = (EnemyEvent)EditorGUILayout.ObjectField( assignedEvent, typeof(EnemyEvent), false); if (GUILayout.Button("Add")) { if (assignedEvent) { CreateListener(assignedEvent); assignedEvent = null; } } GUILayout.EndVertical(); }