Exemplo n.º 1
0
 /// <summary>
 /// If the current active interaction trigger is the one passed as a parameter, stops considering it active.
 /// Otherwise, doesn't do anything, since it means that the trigger trying to unregister was already overwritten by
 /// another and subsequently disabled.
 /// </summary>
 /// <param name="trigger">Trigger that wants to unregister. If it's the currently active trigger, interaction with
 /// it is disabled and the current trigger is nullified. Otherwise, doesn't do anything.</param>
 public void UnregisterTrigger(IInteractionTrigger trigger)
 {
     if (currentTrigger == trigger)
     {
         currentTrigger.DisableInteraction();
         currentTrigger = null;
         HideActionAvailablePrompt();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Registers trigger as ready for interaction. Will override the current active trigger, if any.
 /// the current one.
 /// </summary>
 /// <param name="trigger">Trigger to be marked as ready for interaction with the player</param>
 /// <param name="interactionType">Type of interaction the current trigger allows</param>
 public void RegisterTrigger(IInteractionTrigger trigger, Interaction.Type interactionType)
 {
     if (currentTrigger != null)
     {
         currentTrigger.DisableInteraction();
     }
     currentTrigger = trigger;
     currentTrigger.EnableInteraction();
     ShowActionAvailablePrompt();
 }
Exemplo n.º 3
0
 void Awake()
 {
     elementImage = gameObject.GetComponent <SpriteRenderer>();
     trigger      = gameObject.GetComponent <IInteractionTrigger>();
 }