示例#1
0
    private void SnapToMovingPlatformInMidair()
    {
        if (!isJumping)
        {
            return;
        }
        if (currentPlatformRepresentation == null)
        {
            return;
        }
        if (!currentPlatformRepresentation.location.isMovingBetweenLanes)
        {
            return;
        }
        if (!IsCloseEnoughForSnapping(currentPlatformRepresentation))
        {
            return;
        }

        Vector3 targetPosition          = currentJumpAnimation.targetPosition;
        Vector3 currentPlatformPosition = currentPlatformRepresentation.gameObject.transform.position;

        targetPosition.x = currentPlatformPosition.x;
        currentJumpAnimation?.ChangeTargetPosition(targetPosition);
    }