Beispiel #1
0
 /// <summary>
 /// Method called to fire the Event. Will trigger all methods subscribed to the specified Event_Trigger.
 /// </summary>
 /// <param name="evnt">The Event_Trigger whose methods you want to trigger</param>
 /// <param name="act">The Character_Action being performed to trigger the event. Used to parse the string value.</param>
 /// <param name="value">A string containing the value of the given Action. May contain Acceptable_Shortcuts</param>
 /// <param name="target">The target of the Character_Action</param>
 public static void Broadcast(Event_Trigger evnt, Character_Action act, string value, GameObject target)
 {
     if (events[evnt] != null)
     {
         events[evnt](act, value, target);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Removes a Method from a specific Event_Trigger.
 /// </summary>
 /// <param name="evnt">The Event_Trigger from which to remove the Action.</param>
 /// <param name="action">The Action to remove.</param>
 public static void RemoveHandler(Event_Trigger evnt, Action <Character_Action, string, GameObject> action)
 {
     if (events[evnt] != null)
     {
         events[evnt] -= action;
     }
     else
     {
         events.Remove(evnt);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Adds a Method to a specific Event_Trigger.
 /// </summary>
 /// <param name="evnt">The Event_Trigger to subscribe to.</param>
 /// <param name="action">The Action to add.</param>
 public static void AddHandler(Event_Trigger evnt, Action <Character_Action, string, GameObject> action)
 {
     if (!events.ContainsKey(evnt))
     {
         events[evnt] = action;
     }
     else
     {
         events[evnt] += action;
     }
 }
    private void Awake()
    {
        if (usesCamEvent && headButtActivation && eventTrigger == null)
        {
            eventTrigger = GetComponent <Event_Trigger>();
            if (eventTrigger == null)
            {
                Debug.LogWarning("This object is marked as using a Cam Event! Either mark 'usesCamEvent' as false or attach an Event_Trigger script to this object!");
            }
        }

        objPrefs    = GetComponent <ObjectPreferences>();
        audioSource = GetComponent <AudioSource>();
    }
Beispiel #5
0
    private void Start()
    {
        gameController = GameController.Instance;
        camControl     = GameObject.Find("Camera_Jig").GetComponent <CamControl>();
        dialogueCam    = GameObject.Find("Dialogue_Cam").GetComponent <DialogueCam>();

        for (int i = 0; i < Frames.Length; i++)
        {
            Frames[i].SetActive(false);
        }

        if (isCamEventActive)
        {
            if (eventTrigger == null)
            {
                eventTrigger = GetComponent <Event_Trigger>();
            }
        }
    }