Пример #1
0
        protected override void PostProcessing()
        {
            isPost = true;

            Beatmap.StackLeniency = 0;

            double  t            = firstObjectTime;
            int     i            = 0;
            Vector2 lastPosition = new Vector2(256, 197);

            double speed = 0;
            double angle = targetRandom.NextDouble() * Math.PI * 2;

            while (t < lastObjectTime)
            {
                double progress = (t - firstObjectTime) / (lastObjectTime - firstObjectTime);

                bool speedIncrease = i % 8 == 0;

                if (lastComboIndex < comboTimes.Count && t >= comboTimes[lastComboIndex])
                {
                    lastComboIndex++;
                }

                if (speedIncrease)
                {
                    speed = HitObjectRadius + (int)(progress * 40) / 40d * 333;
                }

                Vector2 movement;

                ControlPoint cp = Beatmap.ControlPointAt(t);

                double multiplier = cp.KiaiMode ? 1.2 : 1;

                if (speedIncrease)
                {
                    multiplier *= 1.5;
                }

                angle += (targetRandom.NextDouble() - 0.5) * 2;

                movement.X = lastPosition.X + (float)(speed * multiplier * Math.Cos(angle));
                movement.Y = lastPosition.Y + (float)(speed * multiplier * Math.Sin(angle));

                int tryCount = 0;
                while (movement.X < 0 || movement.Y < 0 || movement.X > 512 || movement.Y > 384 || (speed > HitObjectRadius && closeToRecent(movement, tryCount)))
                {
                    angle      = targetRandom.NextDouble() * Math.PI * 2;
                    movement.X = lastPosition.X + (float)(speed * multiplier * Math.Cos(angle));
                    movement.Y = lastPosition.Y + (float)(speed * multiplier * Math.Sin(angle));

                    if (++tryCount > 10)
                    {
                        multiplier *= 0.9;
                    }
                }

                lastPosition = movement;

                HitCircleOsuTarget h = new HitCircleOsuTarget(this, lastPosition + new Vector2(0, -10), (int)t, speedIncrease, HitObjectSoundType.Normal, 0);

                EventBreak b = eventManager.eventBreaks.Find(br => br.StartTime <= t && br.EndTime >= t);
                if (b == null)
                {
                    int found = intendedObjects.BinarySearch(h);
                    if (found < 0)
                    {
                        found = ~found - 1;
                    }

                    if (found >= 0 && found > lastUsedIntended && found < intendedObjects.Count)
                    {
                        lastUsedIntended = found;
                        HitObject closest = intendedObjects[found];
                        h.SampleSet          = closest.SampleSet;
                        h.SampleSetAdditions = closest.SampleSetAdditions;
                        h.SoundType          = closest.SoundType;
                        h.CustomSampleSet    = closest.CustomSampleSet;
                    }

                    foreach (pSprite p in h.SpriteCollection)
                    {
                        //physics.Add(p, new Vector2((float)(progress * (GameBase.random.NextDouble() - 0.5)), 0), true).weight = -100;
                        p.Transformations.Add(new Transformation(TransformationType.Scale, p.Scale * 0.5f, p.Scale, (int)t - PreEmpt, (int)t));
                    }
                    AddCircle(h);
                }

                i++;
                t += Beatmap.BeatLengthAt(t, false);
            }

            Sort(false);

            base.PostProcessing();
        }