示例#1
0
 protected virtual void onInteractableOffRange(InteractableInterface interactable, Collider2D collider)
 {
     // Reset current interactable
     // Note : Does not matters too as not being used.
     if (currentInteractable != null)
     {
         currentInteractable = null;
     }
 }
    private void OnTriggerExit2D(Collider2D collision)
    {
        InteractableInterface interactable = collision.gameObject.GetComponent <InteractableInterface>();

        if (interactable != null)
        {
            onTriggerExited.Invoke(interactable, myCollider);
        }
    }
示例#3
0
 protected virtual void onInteractableInRange(InteractableInterface interactable, Collider2D collider)
 {
     // if the current interactable is null and new interactable is interactable do interact the interactable object
     // Note : currently we are not using currentInteractable so it does not matters if we check null on that.
     if (currentInteractable == null && interactable.canInteract(gameObject))
     {
         interactable.interact(gameObject);
     }
 }