// method: begin a sweep via the given sweeping controller // private void beginSweepVia(Controller sweepingController) { if (zeroVelocitiesBefore) { MoonMotionPlayer.zeroVelocities(); } potentialSweepStartingTime = time; potentialControllerSweepingPosition = sweepingController.position(); potentialSweepStartingPosition = MoonMotionBody.position; potentialCurrentTargetPosition = sweepingController.position.positionAlong ( ( operations.firstOperatedOperation().inputs.has(Controller.Input.touchpad) ? sweepingController.relativeTouchpadDirectionWhereZeroesIsForward : sweepingController.forward() ).withVectralYZeroed(), sweepDistance ); SkiingSettings.singleton.heldVersusToggled = false; if (togglesSkiing) { Skier.enableSkiing(); } }
// 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 ); } }
// 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 ); } }
// method: begin a dash to the given provided raycast hit // private void beginDashTo(object raycastHit_RaycastHitProvider) { if (zeroVelocitiesBefore) { MoonMotionPlayer.zeroVelocities(); } if (temporarilyLockYPosition) { lastYPositionLockednessBeforeDashing = MoonMotionPlayer.positionYLockedness; MoonMotionPlayer.lockPositionY(); } RaycastHit raycastHit = raycastHit_RaycastHitProvider.provideRaycastHit(); potentialDashStartingPosition = MoonMotionBody.position; potentialCurrentTargetPosition = raycastHit.position(); potentialCurrentTargetCollider = raycastHit.collider; SkiingSettings.singleton.heldVersusToggled = false; if (togglesSkiing) { Skier.enableSkiing(); } }
// method: stop the current sweep, if any // private void stopSweep() { SkiingSettings.singleton.heldVersusToggled = false; if (togglesSkiing) { Skier.disableSkiing(); } potentialCurrentTargetPosition = null; if (zeroVelocitiesAfter) { MoonMotionPlayer.zeroVelocities(); } }
// method: stop the current dash, if any // private void stopDash() { SkiingSettings.singleton.heldVersusToggled = false; if (togglesSkiing) { Skier.disableSkiing(); } potentialCurrentTargetPosition = null; if (temporarilyLockYPosition) { MoonMotionPlayer.setPositionYLockednessTo(lastYPositionLockednessBeforeDashing); } if (zeroVelocitiesAfter) { MoonMotionPlayer.zeroVelocities(); } }
// at the start: // private void Start() { // track the locomotions managed by the hand's Locomotions Cycler as being managed by both Locomotions Cyclers // foreach (LocomotionCombination locomotionCombination in combinations) { foreach (GameObject cyclerManagedLocomotion in locomotionCombination.array) { if (!managedLocomotions.Contains(cyclerManagedLocomotion)) { managedLocomotions.Add(cyclerManagedLocomotion); } } } // track the locomotions that are descendants of the hand as being managed by both Locomotions Cyclers // foreach (GameObject handDescendantLocomotion in gameObject.lodalObjectsWithI <ILocomotion>()) { if (managedLocomotions.doesNotHave(handDescendantLocomotion)) { managedLocomotions.include(handDescendantLocomotion); } } // track the locomotions that are descendants of the player as being managed by both Locomotions Cyclers // foreach (GameObject playerDescendantLocomotion in MoonMotionPlayer.lodalObjectsWithI <ILocomotion>()) { if (managedLocomotions.doesNotHave(playerDescendantLocomotion)) { managedLocomotions.include(playerDescendantLocomotion); } } // track the other Locomotions Cycler instance // other = (leftInstance ? right : left); // refresh the locomotions // refreshLocomotions(); }