Пример #1
0
        /// <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));
        }
Пример #2
0
        /// <summary>
        /// Find the difficulty of as map by splitting a 2D List representation
        /// of the beatmap into sections.
        /// </summary>
        /// <param name="columns">A 2D List that represents the beatmap.</param>
        /// <param name="previousStrain"></param>
        /// <returns></returns>
        static public double GetSectionDifficulty(List <List <Arc> > columns, double previousStrain)
        {
            double diff = 0;

            List <double> diffs = new List <double>();

            foreach (List <Arc> arcs in columns)
            {
                if (arcs.Count > 0)
                {
                    List <int> times = new List <int>();

                    foreach (Arc arc in arcs)
                    {
                        times.Add(arc.Time);
                    }

                    double stdDiff = PulsarcMath.CalcStdDeviation(times);

                    double c = Math.Min((Math.Pow(arcs.Count, kpsFingerSlope) * (sectionLength / 1000f)), maxKpsDiff);
                    diff += c;
                    diffs.Add(c);
                }
                else
                {
                    diffs.Add(0);
                }
            }

            var std = diffs.Count > 0 ? PulsarcMath.CalcStdDeviation(diffs) : 0;

            return(diff + std + (previousStrain / strainDecay));
        }
Пример #3
0
        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));
                }
            }
        }
Пример #4
0
        /// <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);
        }