Пример #1
0
    // at each physics update: //
    public override void physicsUpdate()
    {
        if (operations.isOperated() && !currentlySweeping)
        {
            beginSweepVia(operations.firstRelevantController());
        }
        else if
        (
            currentlySweeping &&
            (
                (isCancelable && operations.isOperated()) ||

                (limitSweepDuration && (timeSince(sweepStartingTime) > sweepDurationLimit)) ||

                MoonMotionBody.isWithinDistanceOf(currentTargetPosition, endingThresholdDistance) ||

                endIfOverswept.and(MoonMotionBody.isMoreDistantInSameDirectionalityAs(currentTargetPosition, sweepStartingPosition)) ||

                MoonMotionPlayer.isCollidedWith(sweepEndingLayerMask)
            )
        )
        {
            stopSweep();
        }

        if (currentlySweeping)
        {
            MoonMotionPlayer.applyMistargetedAttractionFrom
            (
                currentTargetPosition,
                controllerSweepingPosition,
                forceMagnitude
            );
        }
    }
Пример #2
0
    // at each physics update: //
    public override void physicsUpdate()
    {
        if (operations.isOperated() && DashingTargeting.targetedObject)
        {
            beginDashTo(DashingTargeting.targetingRaycastHit);
        }
        else if
        (
            currentlyDashing &&
            (
                (isCancelable && !DashingTargeting.targetedObject && operations.isOperated()) ||

                endUponTargetCollision.and(MoonMotionPlayer.isCollidedWith(potentialCurrentTargetCollider)) ||

                MoonMotionPlayer.isCollidedWith(dashEndingLayerMask) ||

                endIfOverdashed.and(MoonMotionBody.isMoreDistantInSameDirectionalityAs(currentTargetPosition, dashStartingPosition)) ||

                MoonMotionBody.isWithinDistanceOf(currentTargetPosition, endingThresholdDistance)
            )
        )
        {
            stopDash();
        }

        if (currentlyDashing)
        {
            MoonMotionPlayer.applyMistargetedAttractionFrom
            (
                currentTargetPosition,
                dashStartingPosition,
                forceMagnitude
            );
        }
    }
Пример #3
0
    // method: determine the layer of the object first found by raycasting down relative to the player body's position on the floor by the set range and from the set raise relative to the player body's position on the floor – if no objects are hit, then '-1' is returned (which will not pass layer recognition checking) //
    private int firstRaycastedLayer()
    {
        HashSet <Collider> raycastedColliders = MoonMotionBody.raycastedCollidersAlong(MoonMotionBody.downward, Distinctivity.absolute, Infinity.asAFloat, RaycastQuery.unlimitedHitsAndAllPositionalColliders, QueryTriggerInteraction.Ignore, recognizedGroundTerrainLayers.inUnionWith(recognizedNongroundTerrainLayers));

        if (raycastedColliders.hasAny())
        {
            return(raycastedColliders.first().layerIndex());
        }

        return(-1);
    }
Пример #4
0
 public static Vector3 displacementForSettingBodyPositionTo(object targetPosition_PositionProvider)
 => MoonMotionBody.displacementTo(targetPosition_PositionProvider.providePosition());