Ejemplo n.º 1
0
            protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
            {
                base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

                if (!IsBeatSyncedWithTrack)
                {
                    return;
                }

                int timeSignature = (int)timingPoint.TimeSignature;

                // play metronome from one measure before the first object.
                // TODO: Use BeatSyncClock from https://github.com/ppy/osu/pull/13894.
                if (Clock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
                {
                    return;
                }

                sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
                sample.Play();
            }
Ejemplo n.º 2
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

            if (!IsBeatSyncedWithTrack)
            {
                return;
            }

            int timeSignature = timingPoint.TimeSignature.Numerator;

            // play metronome from one measure before the first object.
            if (BeatSyncSource.Clock?.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
            {
                return;
            }

            sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
            sample.Play();
        }
Ejemplo n.º 3
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

            if (!IsHovered)
            {
                return;
            }

            double duration = timingPoint.BeatLength / 2;

            icon.RotateTo(rightward ? 10 : -10, duration * 2, Easing.InOutSine);

            icon.Animate(
                i => i.MoveToY(-10, duration, Easing.Out),
                i => i.ScaleTo(1, duration, Easing.Out)
                ).Then(
                i => i.MoveToY(0, duration, Easing.In),
                i => i.ScaleTo(new Vector2(1, 0.9f), duration, Easing.In)
                );

            rightward = !rightward;
        }
Ejemplo n.º 4
0
 protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
 {
 }
Ejemplo n.º 5
0
 protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
 {
     kiaiMode = effectPoint.KiaiMode;
 }
Ejemplo n.º 6
0
 protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes) =>
 this.ScaleTo(1.2f)
 .Then()
 .ScaleTo(1f, timingPoint.BeatLength, Easing.Out);
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

            if (effectPoint.KiaiMode != kiaiDisplayed)
            {
                kiaiDisplayed = effectPoint.KiaiMode;

                kiai.ClearTransforms();
                kiai.FadeTo(kiaiDisplayed ? 1 : 0, 200);
            }
        }
Ejemplo n.º 8
0
 private void flash(Drawable d, double beatLength, bool kiai, ChannelAmplitudes amplitudes)
 {
     d.FadeTo(Math.Max(0, ((ReferenceEquals(d, leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time)
     .Then()
     .FadeOut(beatLength, Easing.In);
 }
Ejemplo n.º 9
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            if (beatIndex < 0)
            {
                return;
            }

            if (effectPoint.KiaiMode ? beatIndex % 2 == 0 : beatIndex % (int)timingPoint.TimeSignature == 0)
            {
                flash(leftBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes);
            }
            if (effectPoint.KiaiMode ? beatIndex % 2 == 1 : beatIndex % (int)timingPoint.TimeSignature == 0)
            {
                flash(rightBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes);
            }
        }
Ejemplo n.º 10
0
            protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
            {
                if (effectPoint.KiaiMode)
                {
                    kiaiBeatIndex += 1;

                    if (firstKiaiBeat)
                    {
                        visualisation.FlashColour(visualisation.AccentColour.Opacity(0.5f), timingPoint.BeatLength * 4, Easing.In);
                        firstKiaiBeat = false;

                        return;
                    }

                    if (kiaiBeatIndex >= 5)
                    {
                        visualisation.FlashColour(visualisation.AccentColour.Opacity(0.25f), timingPoint.BeatLength, Easing.In);
                    }
                }
                else
                {
                    firstKiaiBeat = true;
                    kiaiBeatIndex = 0;
                }
            }
Ejemplo n.º 11
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            kiaiBindable.Value = effectPoint.KiaiMode;
            float expandSize = 5 * amplitudes.Average * (effectPoint.KiaiMode ? 2 : 1);

            FinishTransforms(false, nameof(Size));
            this.ResizeTo(450 + expandSize, 100).Then().ResizeTo(450, 50);
        }
Ejemplo n.º 12
0
 protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
 {
     if (effectPoint.KiaiMode)
     {
         fill.FlashColour(colours.PinkLight, 800, Easing.In);
     }
 }
Ejemplo n.º 13
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            // assume that if the animation is playing on its own, it's independent from the beat and doesn't need to be touched.
            if (textureAnimation.FrameCount == 0 || textureAnimation.IsPlaying)
            {
                return;
            }

            textureAnimation.GotoFrame(currentFrame);
            currentFrame = (currentFrame + 1) % textureAnimation.FrameCount;
        }
Ejemplo n.º 14
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            if (effectPoint.KiaiMode)
            {
                bool   direction = beatIndex % 2 == 1;
                double duration  = timingPoint.BeatLength / 2;

                Child.RotateTo(direction ? 10 : -10, duration * 2, Easing.InOutSine);

                Child.Animate(i => i.MoveToY(-10, duration, Easing.Out))
                .Then(i => i.MoveToY(0, duration, Easing.In));
            }
            else
            {
                Child.ClearTransforms();
                Child.RotateTo(0, 500, Easing.Out);
                Child.MoveTo(Vector2.Zero, 500, Easing.Out);
            }
        }
Ejemplo n.º 15
0
 protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
 {
     if (!hasSelection)
     {
         this.FadeTo(0.7f).FadeTo(0.4f, timingPoint.BeatLength, Easing.InOutSine);
     }
 }
Ejemplo n.º 16
0
 protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
 {
     if (!drawableRepeat.IsHit)
     {
         Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out);
     }
 }
Ejemplo n.º 17
0
            protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
            {
                base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);

                int beatsPerBar   = (int)timingPoint.TimeSignature;
                int segmentLength = beatsPerBar * Divisor * bars_per_segment;

                if (!IsBeatSyncedWithTrack)
                {
                    firstBeat = null;
                    return;
                }

                if (!firstBeat.HasValue || beatIndex < firstBeat)
                {
                    // decide on a good starting beat index if once has not yet been decided.
                    firstBeat = beatIndex < 0 ? 0 : (beatIndex / segmentLength + 1) * segmentLength;
                }

                if (beatIndex >= firstBeat)
                {
                    playBeatFor(beatIndex % segmentLength, timingPoint.TimeSignature);
                }
            }
Ejemplo n.º 18
0
        protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
        {
            float livesPercentage = LivesLeft.Value / (float)LivesLeft.MaxValue;

            int panicLevel = 0;

            if (livesPercentage <= 0.1f)
            {
                panicLevel = 3;
            }
            else if (livesPercentage <= 0.25f)
            {
                panicLevel = 2;
            }
            else if (livesPercentage <= 0.5f)
            {
                panicLevel = 1;
            }

            // Heart Rate increases when panicking (lives <= 20% MaxLives)
            // It also beats harder
            float panicDurationMultiplier = 1 * MathF.Pow(0.75f, panicLevel);
            float beatMagnitude           = 0.1f + (0.05f * panicLevel);

            if (beatIndex % (int)((int)timingPoint.TimeSignature * Math.Max(panicDurationMultiplier, 0.5f)) == 0)
            {
                this.ScaleTo(1 + beatMagnitude, 200 * panicDurationMultiplier)
                .Then().ScaleTo(1, 120 * panicDurationMultiplier)
                .Then().ScaleTo(1 + beatMagnitude, 160 * panicDurationMultiplier)
                .Then().ScaleTo(1, 320 * panicDurationMultiplier);
            }
        }