Don't store beatmap reference in hitobjects.

This commit is contained in:
Dean Herbert 2016-11-28 18:45:50 +09:00
parent c376f8436c
commit 187a8bbfa7
3 changed files with 12 additions and 5 deletions

View File

@ -4,14 +4,21 @@
using System.Collections.Generic;
using osu.Game.Database;
using OpenTK;
using osu.Game.Beatmaps;
using System;
namespace osu.Game.Modes.Osu.Objects
{
public class Slider : OsuHitObject
{
public override double EndTime => StartTime + RepeatCount * Curve.Length / VelocityAt(StartTime);
public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity;
public double VelocityAt(double time) => 100 / Beatmap.BeatLengthAt(time, true) * Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
public double Velocity;
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
{
Velocity = 100 / beatmap.BeatLengthAt(StartTime, true) * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
}
public int RepeatCount;

View File

@ -297,7 +297,7 @@ protected override Beatmap ParseFile(TextReader stream)
if (obj != null)
{
obj.Beatmap = beatmap;
obj.SetDefaultsFromBeatmap(beatmap);
beatmap.HitObjects.Add(obj);
}
break;

View File

@ -21,8 +21,8 @@ public abstract class HitObject
public double Duration => EndTime - StartTime;
public Beatmap Beatmap;
public HitSampleInfo Sample;
public virtual void SetDefaultsFromBeatmap(Beatmap beatmap) { }
}
}