protected virtual void HandleFalling() { if (bodyPhysics != null && bodyPhysics.IsFalling()) { currentlyFalling = true; } if (bodyPhysics != null && !bodyPhysics.IsFalling() && currentlyFalling) { currentlyFalling = false; currentSpeed = 0f; } }
protected virtual void HandleFalling() { if (bodyPhysics && bodyPhysics.IsFalling()) { touchAxis = Vector2.zero; wasFalling = true; } if (bodyPhysics && !bodyPhysics.IsFalling() && wasFalling) { touchAxis = Vector2.zero; wasFalling = false; strafeSpeed = 0f; movementSpeed = 0f; } }
protected virtual void CheckFalling() { if (bodyPhysics != null && bodyPhysics.IsFalling() && ObjectHeightChange()) { if (!affectOnFalling) { if (storedAxis == Vector2.zero) { storedAxis = new Vector2(currentAxis.x, currentAxis.y); } currentAxis = Vector2.zero; } currentlyFalling = true; } if (bodyPhysics != null && !bodyPhysics.IsFalling() && currentlyFalling) { currentAxis = (IsInAction() ? storedAxis : Vector2.zero); storedAxis = Vector2.zero; currentlyFalling = false; } }
protected virtual void CheckFalling() { if (bodyPhysics && bodyPhysics.IsFalling() && ObjectHeightChange()) { if (!affectOnFalling) { if (storedTouchpadAxis == Vector2.zero) { storedTouchpadAxis = new Vector2(touchpadAxis.x, touchpadAxis.y); } touchpadAxis = Vector2.zero; } currentlyFalling = true; } if (bodyPhysics && !bodyPhysics.IsFalling() && currentlyFalling) { touchpadAxis = (ValidPrimaryButton() && TouchpadTouched() ? storedTouchpadAxis : Vector2.zero); storedTouchpadAxis = Vector2.zero; currentlyFalling = false; } }
protected virtual void CheckForJump() { if (leftButtonReleased && rightButtonReleased && !bodyPhysics.IsFalling()) { Vector3 leftDir = leftStartAimPosition - leftReleasePosition; Vector3 rightDir = rightStartAimPosition - rightReleasePosition; Vector3 localJumpDir = leftDir + rightDir; Vector3 worldJumpDir = playArea.transform.TransformVector(localJumpDir); Vector3 jumpVector = worldJumpDir * velocityMultiplier; if (jumpVector.magnitude > velocityMax) { jumpVector = jumpVector.normalized * velocityMax; } bodyPhysics.ApplyBodyVelocity(jumpVector, true, true); UnAim(); OnSlingshotJumped(); } }