private void LateUpdate() { foreach (ShapeGroup shapeGroup in shapeGroups) { shapeGroup.UpdateKeys(); } // OLD if (isChanging) { actualShape = Mathf.Lerp(originalShape, targetShape, AdvGame.Interpolate(startTime, deltaTime, AC.MoveMethod.Linear, null)); if (Time.time > startTime + deltaTime) { isChanging = false; actualShape = targetShape; } if (skinnedMeshRenderer) { skinnedMeshRenderer.SetBlendShapeWeight(shapeKey, actualShape); } } }
protected void UpdateTargets(bool onStart = false) { if (!target) { return; } if (autoControlPitch || autoControlSpin) { if (Time.time > autoControlStartTime + autoControlTime) { autoControlPitch = autoControlSpin = false; } else { if (autoControlPitch) { pitch = Mathf.Lerp(pitch, autoPitchAngle, AdvGame.Interpolate(autoControlStartTime, autoControlTime, autoMoveMethod, autoMoveCurve)); } if (autoControlSpin) { spin = Mathf.Lerp(spin, autoSpinAngle, AdvGame.Interpolate(autoControlStartTime, autoControlTime, autoMoveMethod, autoMoveCurve)); } } } else if (onStart || CanAcceptInput()) { if (allowMouseWheelZooming && minDistance < maxDistance) { if (Input.GetAxis("Mouse ScrollWheel") < 0f) { deltaDistance = Mathf.Lerp(deltaDistance, Mathf.Min(spinSpeed, maxDistance - distance), spinAccleration / 5f * Time.deltaTime); } else if (Input.GetAxis("Mouse ScrollWheel") > 0f) { deltaDistance = Mathf.Lerp(deltaDistance, -Mathf.Min(spinSpeed, distance - minDistance), spinAccleration / 5f * Time.deltaTime); } else { deltaDistance = Mathf.Lerp(deltaDistance, 0f, spinAccleration * Time.deltaTime); } distance += deltaDistance; distance = Mathf.Clamp(distance, minDistance, maxDistance); } if (KickStarter.playerInput.IsCursorLocked() || !toggleCursor) { if (!isDragControlled) { inputMovement = new Vector2(KickStarter.playerInput.InputGetAxis(spinAxis), KickStarter.playerInput.InputGetAxis(pitchAxis)); } else { if (KickStarter.playerInput.GetDragState() == DragState._Camera) { if (KickStarter.playerInput.IsCursorLocked()) { inputMovement = KickStarter.playerInput.GetFreeAim(); } else { inputMovement = KickStarter.playerInput.GetDragVector(); } } else { inputMovement = Vector2.zero; } } if (spinLock != RotationLock.Locked) { if (Mathf.Approximately(inputMovement.x, 0f)) { deltaSpin = Mathf.Lerp(deltaSpin, 0f, spinDeceleration * Time.deltaTime); } else { float scaleFactor = 1f; if (inputAffectsSpeed) { scaleFactor *= Mathf.Abs(inputMovement.x); if (isDragControlled) { scaleFactor /= 1000f; } } if (inputMovement.x > 0f) { deltaSpin = Mathf.Lerp(deltaSpin, spinSpeed * scaleFactor, spinAccleration * Time.deltaTime * inputMovement.x); } else if (inputMovement.x < 0f) { deltaSpin = Mathf.Lerp(deltaSpin, -spinSpeed * scaleFactor, spinAccleration * Time.deltaTime * -inputMovement.x); } } if (spinLock == RotationLock.Limited) { if ((invertSpin && deltaSpin > 0f) || (!invertSpin && deltaSpin < 0f)) { if (maxSpin - spin < 5f) { deltaSpin *= (maxSpin - spin) / 5f; } } else if ((invertSpin && deltaSpin < 0f) || (!invertSpin && deltaSpin > 0f)) { if (maxSpin + spin < 5f) { deltaSpin *= (maxSpin + spin) / 5f; } } } if (invertSpin) { spin += deltaSpin; } else { spin -= deltaSpin; } if (spinLock == RotationLock.Limited) { spin = Mathf.Clamp(spin, -maxSpin, maxSpin); } } else { if (alwaysBehind) { spin = Mathf.LerpAngle(spin, target.eulerAngles.y + spinOffset, spinAccleration * Time.deltaTime); } } if (pitchLock != RotationLock.Locked) { if (Mathf.Approximately(inputMovement.y, 0f)) { deltaPitch = Mathf.Lerp(deltaPitch, 0f, pitchDeceleration * Time.deltaTime); } else { float scaleFactor = 1f; if (inputAffectsSpeed) { scaleFactor *= Mathf.Abs(inputMovement.y); if (isDragControlled) { scaleFactor /= 1000f; } } if (inputMovement.y > 0f) { deltaPitch = Mathf.Lerp(deltaPitch, pitchSpeed * scaleFactor, pitchAccleration * Time.deltaTime * inputMovement.y); } else if (inputMovement.y < 0f) { deltaPitch = Mathf.Lerp(deltaPitch, -pitchSpeed * scaleFactor, pitchAccleration * Time.deltaTime * -inputMovement.y); } } if (pitchLock == RotationLock.Limited) { if ((invertPitch && deltaPitch > 0f) || (!invertPitch && deltaPitch < 0f)) { if (maxPitch - pitch < 5f) { deltaPitch *= (maxPitch - pitch) / 5f; } } else if ((invertPitch && deltaPitch < 0f) || (!invertPitch && deltaPitch > 0f)) { if (minPitch - pitch > -5f) { deltaPitch *= (minPitch - pitch) / -5f; } } } if (invertPitch) { pitch += deltaPitch; } else { pitch -= deltaPitch; } if (pitchLock == RotationLock.Limited) { pitch = Mathf.Clamp(pitch, minPitch, maxPitch); } } } } else { if (spinLock != RotationLock.Free) { if (alwaysBehind) { spin = Mathf.LerpAngle(spin, target.eulerAngles.y + spinOffset, spinAccleration * Time.deltaTime); } } } if (pitchLock == RotationLock.Locked) { pitch = maxPitch; } float finalSpin = spin; float finalPitch = pitch; if (alwaysBehind && spinLock == RotationLock.Limited) { finalSpin += target.eulerAngles.y; } else if (!targetIsPlayer) { if (spinLock != RotationLock.Locked) { finalSpin += target.eulerAngles.y; } if (pitchLock != RotationLock.Locked) { finalPitch += target.eulerAngles.x; } } Quaternion rotation = Quaternion.Euler(finalPitch, finalSpin, roll); targetRotation = rotation; centrePosition = target.position + (Vector3.up * verticalOffset) + (rotation * Vector3.right * horizontalOffset); targetPosition = centrePosition - (rotation * Vector3.forward * distance); SetFocalPoint(); }
private IEnumerator _UpdateMovement() { while (isMoving) { if (Time.time < moveStartTime + moveChangeTime) { if (transformType == TransformType.Translate || transformType == TransformType.CopyMarker) { if (moveMethod == MoveMethod.Curved) { transform.localPosition = Vector3.Slerp(startPosition, endPosition, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } else { transform.localPosition = AdvGame.Lerp(startPosition, endPosition, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } } if (transformType == TransformType.Rotate || transformType == TransformType.CopyMarker) { if (doEulerRotation) { if (moveMethod == MoveMethod.Curved) { transform.localEulerAngles = Vector3.Slerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } else { transform.localEulerAngles = AdvGame.Lerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } } else { if (moveMethod == MoveMethod.Curved) { transform.localRotation = Quaternion.Slerp(startRotation, endRotation, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } else { transform.localRotation = AdvGame.Lerp(startRotation, endRotation, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } } } if (transformType == TransformType.Scale || transformType == TransformType.CopyMarker) { if (moveMethod == MoveMethod.Curved) { transform.localScale = Vector3.Slerp(startScale, endScale, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } else { transform.localScale = AdvGame.Lerp(startScale, endScale, AdvGame.Interpolate(moveStartTime, moveChangeTime, moveMethod, timeCurve)); } } } else { EndMovement(); } yield return(new WaitForFixedUpdate()); } StopCoroutine("_UpdateMovement"); }
/** * The Player's "Update" function, called by StateHandler. */ public override void _Update() { bool jumped = false; if (KickStarter.playerInput.InputGetButtonDown("Jump") && KickStarter.stateHandler.gameState == GameState.Normal && motionControl == MotionControl.Automatic) { if (!KickStarter.playerInput.IsJumpLocked) { jumped = Jump(); } } if (hotspotDetector) { hotspotDetector._Update(); } if (activePath && !pausePath) { if (IsTurningBeforeWalking()) { if (charState == CharState.Move) { charState = CharState.Decelerate; } else if (charState == CharState.Custom) { charState = CharState.Idle; } } else if ((KickStarter.stateHandler && KickStarter.stateHandler.gameState == GameState.Cutscene && !lockedPath) || (KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick) || (KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.StraightToCursor && KickStarter.settingsManager.singleTapStraight) || IsMovingToHotspot()) { charState = CharState.Move; } if (!lockedPath) { CheckIfStuck(); } } else if (activePath == null && (KickStarter.stateHandler.gameState == GameState.Cutscene || KickStarter.stateHandler.gameState == GameState.DialogOptions) && charState == CharState.Move) { charState = CharState.Decelerate; } if (isJumping && !jumped) { if (IsGrounded()) { isJumping = false; } } if (isTilting) { actualTilt = Mathf.Lerp(actualTilt, targetTilt, AdvGame.Interpolate(tiltStartTime, tiltSpeed, MoveMethod.Smooth, null)); if (Mathf.Abs(targetTilt - actualTilt) < 2f) { isTilting = false; } } base._Update(); if (isTilting) { UpdateTilt(); } }
public void UpdateKeys() { if (smr == null) { return; } foreach (ShapeKey shapeKey in shapeKeys) { if (changeTime > 0f) { float newValue = Mathf.Lerp(shapeKey.value, shapeKey.targetValue, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); shapeKey.SetValue(newValue, smr); if ((startTime + changeTime) < Time.time) { changeTime = 0f; } } else { shapeKey.SetValue(shapeKey.targetValue, smr); } } }
/** * Re-calculates the intensity value. This is public so that it can be called every frame by the StateHandler component. */ public void _Update() { if (highlightState != HighlightState.None) { if (direction == 1) { // Add highlight highlight = Mathf.Lerp(minHighlight, maxHighlight, AdvGame.Interpolate(fadeStartTime, fadeTime, MoveMethod.Linear, null)); if (highlight >= maxHighlight) { highlight = maxHighlight; if (highlightState == HighlightState.Flash) { direction = 0; fadeStartTime = flashHoldTime; } else if (highlightState == HighlightState.Pulse) { direction = -1; fadeStartTime = Time.time; } else { highlightState = HighlightState.On; } } } else if (direction == -1) { // Remove highlight highlight = Mathf.Lerp(maxHighlight, minHighlight, AdvGame.Interpolate(fadeStartTime, fadeTime, AC.MoveMethod.Linear, null)); if (highlight <= 1f) { highlight = 1f; if (highlightState == HighlightState.Pulse) { direction = 1; fadeStartTime = Time.time; } else { highlightState = HighlightState.None; } } } else if (direction == 0) { // Flash pause fadeStartTime -= Time.deltaTime; if (fadeStartTime <= 0f) { direction = -1; highlight = maxHighlight; fadeStartTime = Time.time; } } if (brightenMaterials) { UpdateMaterials(); } } else { if (highlight != minHighlight) { highlight = minHighlight; if (brightenMaterials) { UpdateMaterials(); } } } }
private void Update() { if (positionChangeTime > 0f) { if (Time.time < positionStartTime + positionChangeTime) { if (positionMethod == MoveMethod.Curved) { transform.localPosition = Vector3.Slerp(startPosition, endPosition, AdvGame.Interpolate(positionStartTime, positionChangeTime, positionMethod, positionTimeCurve)); } else { transform.localPosition = AdvGame.Lerp(startPosition, endPosition, AdvGame.Interpolate(positionStartTime, positionChangeTime, positionMethod, positionTimeCurve)); } } else { transform.localPosition = endPosition; positionChangeTime = 0f; } } if (rotateChangeTime > 0f) { if (Time.time < rotateStartTime + rotateChangeTime) { if (doEulerRotation) { if (rotateMethod == MoveMethod.Curved) { transform.localEulerAngles = Vector3.Slerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } else { transform.localEulerAngles = AdvGame.Lerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } } else { if (rotateMethod == MoveMethod.Curved) { transform.localRotation = Quaternion.Slerp(startRotation, endRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } else { transform.localRotation = AdvGame.Lerp(startRotation, endRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } } } else { if (doEulerRotation) { transform.localEulerAngles = endEulerRotation; } else { transform.rotation = endRotation; } rotateChangeTime = 0f; } } if (scaleChangeTime > 0f) { if (Time.time < scaleStartTime + scaleChangeTime) { if (scaleMethod == MoveMethod.Curved) { transform.localScale = Vector3.Slerp(startScale, endScale, AdvGame.Interpolate(scaleStartTime, scaleChangeTime, scaleMethod, scaleTimeCurve)); } else { transform.localScale = AdvGame.Lerp(startScale, endScale, AdvGame.Interpolate(scaleStartTime, scaleChangeTime, scaleMethod, scaleTimeCurve)); } } else { transform.localScale = endScale; scaleChangeTime = 0f; } } }
private void Update() { if (positionChangeTime > 0f) { if (Time.time < positionStartTime + positionChangeTime) { if (inWorldSpace) { transform.position = (positionMethod == MoveMethod.Curved) ? Vector3.Slerp(startPosition, endPosition, AdvGame.Interpolate(positionStartTime, positionChangeTime, positionMethod, positionTimeCurve)) :AdvGame.Lerp(startPosition, endPosition, AdvGame.Interpolate(positionStartTime, positionChangeTime, positionMethod, positionTimeCurve)); } else { transform.localPosition = (positionMethod == MoveMethod.Curved) ? Vector3.Slerp(startPosition, endPosition, AdvGame.Interpolate(positionStartTime, positionChangeTime, positionMethod, positionTimeCurve)) :AdvGame.Lerp(startPosition, endPosition, AdvGame.Interpolate(positionStartTime, positionChangeTime, positionMethod, positionTimeCurve)); } } else { if (inWorldSpace) { transform.position = endPosition; } else { transform.localPosition = endPosition; } positionChangeTime = 0f; } } if (rotateChangeTime > 0f) { if (Time.time < rotateStartTime + rotateChangeTime) { if (doEulerRotation) { if (inWorldSpace) { transform.eulerAngles = (rotateMethod == MoveMethod.Curved) ? Vector3.Slerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)) : AdvGame.Lerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } else { transform.localEulerAngles = (rotateMethod == MoveMethod.Curved) ? Vector3.Slerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)) : AdvGame.Lerp(startEulerRotation, endEulerRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } } else { if (inWorldSpace) { transform.rotation = (rotateMethod == MoveMethod.Curved) ? Quaternion.Slerp(startRotation, endRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)) : AdvGame.Lerp(startRotation, endRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } else { transform.localRotation = (rotateMethod == MoveMethod.Curved) ? Quaternion.Slerp(startRotation, endRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)) : AdvGame.Lerp(startRotation, endRotation, AdvGame.Interpolate(rotateStartTime, rotateChangeTime, rotateMethod, rotateTimeCurve)); } } } else { if (doEulerRotation) { if (inWorldSpace) { transform.eulerAngles = endEulerRotation; } else { transform.localEulerAngles = endEulerRotation; } } else { if (inWorldSpace) { transform.rotation = endRotation; } else { transform.localRotation = endRotation; } } if (character != null) { character.SetLookDirection(character.TransformRotation * Vector3.forward, true); character.StopTurning(); } rotateChangeTime = 0f; } } if (scaleChangeTime > 0f) { if (Time.time < scaleStartTime + scaleChangeTime) { if (scaleMethod == MoveMethod.Curved) { transform.localScale = Vector3.Slerp(startScale, endScale, AdvGame.Interpolate(scaleStartTime, scaleChangeTime, scaleMethod, scaleTimeCurve)); } else { transform.localScale = AdvGame.Lerp(startScale, endScale, AdvGame.Interpolate(scaleStartTime, scaleChangeTime, scaleMethod, scaleTimeCurve)); } } else { transform.localScale = endScale; scaleChangeTime = 0f; } } }
public void _LateUpdate() { if (KickStarter.settingsManager && KickStarter.settingsManager.IsInLoadingScene()) { return; } if (KickStarter.stateHandler.gameState == GameState.Normal) { if (attachedCamera) { if (lastNavCamera != attachedCamera) { lastNavCamera2 = lastNavCamera; } lastNavCamera = attachedCamera; } } if (attachedCamera && (!(attachedCamera is GameCamera25D))) { if (!isSmoothChanging) { transform.rotation = attachedCamera.transform.rotation; transform.position = attachedCamera.transform.position; focalDistance = attachedCamera.focalDistance; if (attachedCamera is GameCamera2D) { GameCamera2D cam2D = (GameCamera2D)attachedCamera; perspectiveOffset = cam2D.perspectiveOffset; if (!_camera.orthographic) { _camera.projectionMatrix = AdvGame.SetVanishingPoint(_camera, perspectiveOffset); } else { _camera.orthographicSize = attachedCamera._camera.orthographicSize; } } else { _camera.fieldOfView = attachedCamera._camera.fieldOfView; if (cursorAffectsRotation) { SetlookAtTransformation(); transform.LookAt(lookAtTransform, attachedCamera.transform.up); } } } else { // Move from one GameCamera to another if (Time.time < startTime + changeTime) { if (attachedCamera is GameCamera2D) { GameCamera2D cam2D = (GameCamera2D)attachedCamera; perspectiveOffset.x = AdvGame.Lerp(startPerspectiveOffset.x, cam2D.perspectiveOffset.x, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); perspectiveOffset.y = AdvGame.Lerp(startPerspectiveOffset.y, cam2D.perspectiveOffset.y, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); _camera.ResetProjectionMatrix(); } if (moveMethod == MoveMethod.Curved) { // Don't slerp y position as this will create a "bump" effect Vector3 newPosition = Vector3.Slerp(startPosition, attachedCamera.transform.position, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); newPosition.y = Mathf.Lerp(startPosition.y, attachedCamera.transform.position.y, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); transform.position = newPosition; transform.rotation = Quaternion.Slerp(startRotation, attachedCamera.transform.rotation, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); } else { transform.position = AdvGame.Lerp(startPosition, attachedCamera.transform.position, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); transform.rotation = AdvGame.Lerp(startRotation, attachedCamera.transform.rotation, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); } focalDistance = AdvGame.Lerp(startFocalDistance, attachedCamera.focalDistance, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); _camera.fieldOfView = AdvGame.Lerp(startFOV, attachedCamera._camera.fieldOfView, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); _camera.orthographicSize = AdvGame.Lerp(startOrtho, attachedCamera._camera.orthographicSize, AdvGame.Interpolate(startTime, changeTime, moveMethod, timeCurve)); if (attachedCamera is GameCamera2D && !_camera.orthographic) { _camera.projectionMatrix = AdvGame.SetVanishingPoint(_camera, perspectiveOffset); } } else { LookAtCentre(); isSmoothChanging = false; } } if (cursorAffectsRotation) { lookAtTransform.localPosition = Vector3.Lerp(lookAtTransform.localPosition, lookAtTarget, Time.deltaTime * 3f); } } else if (attachedCamera && (attachedCamera is GameCamera25D)) { transform.position = attachedCamera.transform.position; transform.rotation = attachedCamera.transform.rotation; } // Shake if (shakeIntensity > 0f) { if (shakeMove) { shakePosition = Random.insideUnitSphere * shakeIntensity * 0.5f; } shakeRotation = new Vector3 ( Random.Range(-shakeIntensity, shakeIntensity) * 0.2f, Random.Range(-shakeIntensity, shakeIntensity) * 0.2f, Random.Range(-shakeIntensity, shakeIntensity) * 0.2f ); shakeIntensity = Mathf.Lerp(shakeStartIntensity, 0f, AdvGame.Interpolate(shakeStartTime, shakeDuration, MoveMethod.Linear, null)); transform.position += shakePosition; transform.localEulerAngles += shakeRotation; } else if (shakeIntensity < 0f) { StopShaking(); } }
/** * Re-calculates the intensity value. This is public so that it can be called every frame by the StateHandler component. */ public void _Update() { if (highlightState != HighlightState.None) { if (direction > 0) { // Add highlight highlight = Mathf.Lerp(minHighlight, maxHighlight, AdvGame.Interpolate(fadeStartTime, fadeTime, MoveMethod.Linear, null)); if (highlight >= maxHighlight) { highlight = maxHighlight; switch (highlightState) { case HighlightState.Flash: direction = 0; fadeStartTime = flashHoldTime; break; case HighlightState.Pulse: direction = -1; fadeStartTime = Time.time; break; default: highlightState = HighlightState.On; break; } } } else if (direction < 0) { // Remove highlight highlight = Mathf.Lerp(maxHighlight, minHighlight, AdvGame.Interpolate(fadeStartTime, fadeTime, AC.MoveMethod.Linear, null)); if (highlight <= 1f) { highlight = 1f; if (highlightState == HighlightState.Pulse) { direction = 1; fadeStartTime = Time.time; } else { highlightState = HighlightState.None; } } } else { // Flash pause fadeStartTime -= Time.deltaTime; if (fadeStartTime <= 0f) { direction = -1; highlight = maxHighlight; fadeStartTime = Time.time; } } UpdateMaterials(); } else { if (!Mathf.Approximately(highlight, minHighlight)) { highlight = minHighlight; UpdateMaterials(); } } }
private void FixedUpdate() { if (KickStarter.stateHandler && KickStarter.stateHandler.playerIsOff) { return; } if (activePath && !pausePath) { if (IsTurningBeforeWalking()) { charState = CharState.Idle; } else if ((KickStarter.stateHandler && KickStarter.stateHandler.gameState == GameState.Cutscene && !lockedPath) || (KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick) || (KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.StraightToCursor && KickStarter.settingsManager.singleTapStraight) || IsMovingToHotspot()) { charState = CharState.Move; } if (!lockedPath) { CheckIfStuck(); } } else if (activePath == null && KickStarter.stateHandler.gameState == GameState.Cutscene && charState == CharState.Move) { charState = CharState.Decelerate; } if (isJumping) { if (IsGrounded()) { isJumping = false; } } if (isTilting) { actualTilt = Mathf.Lerp(actualTilt, targetTilt, AdvGame.Interpolate(tiltStartTime, tiltSpeed, MoveMethod.Smooth, null)); if (Mathf.Abs(targetTilt - actualTilt) < 2f) { isTilting = false; } } _FixedUpdate(); if (IsUFPSPlayer()) { if (isTilting) { UltimateFPSIntegration.SetRotation(new Vector2(actualTilt, newRotation.eulerAngles.y)); } else { UltimateFPSIntegration.SetPitch(newRotation.eulerAngles.y); } } else if (isTilting) { UpdateTilt(); } if (IsUFPSPlayer() && activePath != null && charState == CharState.Move) { UltimateFPSIntegration.Teleport(transform.position); } }