Esempio n. 1
0
    /// <summary>
    /// Raises the passed in <see cref="GameObjectGameEvent"/>, after confirming
    /// the name is valid.
    /// </summary>
    /// <param name="eventName">The name of the event.</param>
    /// <param name="value">The string value the event is passing in with.</param>
    public void RaiseGameObjectEvent(string eventName, GameObject value)
    {
        //Raise the Int event if not null, else print an error.
        GameObjectGameEvent gameObjectEvent = this.GetGameObjectEvent(eventName);

        if (!gameObjectEvent)
        {
            Debug.LogError("ERROR: Invalid String Event name: " + eventName + ". Double check Event Constants/your spelling.");
        }
        else
        {
            this.GetGameObjectEvent(eventName).Raise(value);
        }
    }
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();
        EditorGUILayout.HelpBox("This Game-Event passes along a GameObject", MessageType.Info, true);
        EditorGUILayout.HelpBox("The receiver of this event can potentially manipulate the GameObject that has been sent", MessageType.Warning, true);
        GameObjectGameEvent e = (GameObjectGameEvent)target;

        GUI.enabled       = Application.isPlaying;
        e.debugGameObject = (GameObject)EditorGUILayout.ObjectField("Debug Object", e.debugGameObject, typeof(GameObject), true);
        if (GUILayout.Button("Raise"))
        {
            e.Raise(e.debugGameObject);
            e.DebugMessage();
        }
    }