This is comment for paste
PlayerInteractCode
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OnTriggerEnter2D(Collider2D collision)
- {
- // Get x/y values for movement if the character isn't colliding with anything
- if (!base.IsOwner)
- {
- return;
- }
- // Check if the collided object is interactable
- IInteractable interactableObjectColliding = collision.GetComponent<IInteractable>();
- if (interactableObjectColliding != null)
- {
- interactableObjectName = collision.gameObject.name;
- interactableObject = collision.GetComponent<IInteractable>();
- LogManager.Instance.Log($"{gameObject.name} is near {interactableObjectName}");
- }
- }
- private void OnTriggerExit2D(Collider2D collision)
- {
- // Get x/y values for movement if the character isn't colliding with anything
- if (!base.IsOwner)
- {
- return;
- }
- // Check if the collided object is interactable
- IInteractable interactableObjectColliding = collision.GetComponent<IInteractable>();
- if (interactableObjectColliding != null)
- {
- LogManager.Instance.Log($"{gameObject.name} is no longer near {interactableObjectName}");
- interactableObjectName = null;
- interactableObject = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment