public void OnRelease() { if (currentGrabItem != null) { currentGrabItem.Release(currentInput); currentGrabItem = null; CallAnimationTrigger?.Invoke("", null); PlayAudio?.Invoke("Release", 0f); } }
public void OnDash() { if (canDash) { Debug.Log("I am being called."); dashTimer = currentDashLength; resetDashTimer = currentDashResetLength; canDash = false; CallAnimationTrigger?.Invoke("", null); } }
public void OnGrab() { if (character == null) { return; } Ray ray = new Ray(this.transform.position, lookDirection.normalized * character.GetInteractionRange()); RaycastHit2D hitBox = Physics2D.CircleCast(ray.GetPoint(character.GetInteractionRange() / 2), character.GetInteractionRange() / 2, lookDirection.normalized, character.GetInteractionRange(), interactionLayer); if (hitBox) { RaycastHit2D hitInfo = Physics2D.Raycast(this.transform.position, hitBox.transform.position - this.transform.position, character.GetInteractionRange(), interactionLayer); if (hitInfo) { IGrabbable item = hitInfo.transform.gameObject.GetComponentInParent <IGrabbable>(); if (item != null) { currentGrabItem = item.Grab(motor, hitInfo.point); CallAnimationTrigger?.Invoke("", null); PlayAudio?.Invoke("Grab", 0f); } } } }