/// <summary> /// Zooms the gameplay to imitate Intralism's zoom method. /// </summary> /// <param name="gameplayEngine">The gameplay engine to modify.</param> private void HandleIntralizooms(GameplayEngine gameplayEngine) { FindNextEvent(gameplayEngine); // If the next event is less than the current time // then deactivate this event as it is no longer needed. // This is similar to how Intralism handles PlayerDistance, where it has a // local PlayerDistance that is what the player sees, and a semi-constant "PlayerDistance" // That is changed by the most recent SetPlayerDistance map event. Active = !(nextEvent != null && nextEvent.Time < gameplayEngine.Time); // Get smoothDeltaTime and return if there was no change in deltaTime double smoothDeltaTime = PulsarcTime.SmoothDeltaTime; if (smoothDeltaTime == 0 || !Active) { return; } // Resize the crosshair gameplayEngine.Crosshair.Resize( PulsarcMath.Lerp( // Starting position (current position) currentZoomLevel, // Ending position (zoomLevel) ZoomLevel, // Amount to lerp by (Pulsarc: deltaTime(ms) / 200 = Intralism: deltaTime(s) * 5) (float)smoothDeltaTime / 200f)); }
private void updateFocus() { float selectedFocus = GetSettingsScreen().SelectedFocus; if (currentFocus != selectedFocus) { currentFocus = PulsarcMath.Lerp(currentFocus, selectedFocus, (float)PulsarcTime.DeltaTime / 100f); float diff = lastFocus - currentFocus; lastFocus = currentFocus; foreach (SettingsGroup settings in Groups) { settings.Move(new Vector2(0, 200 * diff)); } } }
/// <summary> /// The card moving in and out depending on its selected state. /// TODO: Fix vertical movement /// </summary> public void AdjustClickDistance() { if (!SelectedAndMoving && !NotSelectedAndMoving && !IncorrectPosition) { return; } // If clicked, smoothly move to the clicked distance if (SelectedAndMoving) { currentSelectDistance = PulsarcMath.Lerp( currentSelectDistance, selectedDistance, (float)PulsarcTime.DeltaTime / 100f); } // Else if not clicked and currentClickDistacne is greater than 0, smoothly move to 0 else if (NotSelectedAndMoving) { currentSelectDistance = PulsarcMath.Lerp(currentSelectDistance, 0, (float)PulsarcTime.DeltaTime / 100f); } // If it has the wrong position, correct it's position. if (IncorrectPosition) { ChangePosition(PersonalStartPosition.X, Position.Y); if (IsSelected) { MoveInAssignedDirection(-selectedDistance); } return; } float diff = lastSelectDistance - currentSelectDistance; lastSelectDistance = currentSelectDistance; MoveInAssignedDirection(diff); }