Class DynamicDifficultyDemoMain
Example of custom rules in the game. This one shrinks Hit Object size on every successful hit (you can change the frequency of it with MouseDance.Demo.DynamicDifficultyDemoMain._shrinkFrequency).
Implements
Inherited Members
Namespace: MouseDance.Demo
Assembly: MouseDance.Demo.dll
Syntax
public class DynamicDifficultyDemoMain : BasicDemoMain, ISongStartCountdown, IBeatmapEnd, IBeatmapLoaded, IHitObjectSizeCalculator, IClickedHitObject
Remarks
If the player misses, the size resets. Note that this goes all the way up to Circle Size Difficulty of 10 (Osu! Beatmap Editor will only allow you to go up to 7).
Also note that this is a subclass of BasicDemoMain, so all the callbacks that BasicDemoMain registers will also be done by this subclass (ISongStartCountdown to show a countdown animation, and IBeatmapEnd to show a Results screen afterwards).
Methods
Awake()
Declaration
protected override void Awake()
Overrides
GetHitCircleRadius(Int32, Int32, Int32, HitCircle, Beatmap)
Determine what radius will be for this Hit Circle.
Declaration
public float GetHitCircleRadius(int idx, int comboCounter, int comboColourIdx, HitCircle hitCircle, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | idx | Index position of the Hit Circle in the entire Beatmap. Starts at 0. |
Int32 | comboCounter | Number to be displayed on the Hit Circle. |
Int32 | comboColourIdx | What index of colour this Hit Circle is given. Starts at 0. |
OsuParsers.Beatmaps.Objects.HitCircle | hitCircle | Extra info about the Hit Circle. |
OsuParsers.Beatmaps.Beatmap | beatmap | Data on the entire Beatmap. |
Returns
Type | Description |
---|---|
Single | Radius (in osu!pixels) that the Hit Circle will be in. |
GetSliderCircleRadius(Int32, Int32, Int32, Slider, Beatmap)
Determine what radius will be for this Slider.
Declaration
public float GetSliderCircleRadius(int idx, int comboCounter, int comboColourIdx, Slider slider, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | idx | Index position of this Slider in the entire Beatmap. Starts at 0. |
Int32 | comboCounter | Combo Number to be displayed on the Slider. |
Int32 | comboColourIdx | What index of colour this Slider is given. Starts at 0. |
OsuParsers.Beatmaps.Objects.Slider | slider | Extra info about the Slider. |
OsuParsers.Beatmaps.Beatmap | beatmap | Data on the entire Beatmap. |
Returns
Type | Description |
---|---|
Single | Radius (in osu!pixels) that the Slider will be in. |
OnBeatmapLoaded(Beatmap)
Called after a beatmap has been loaded (with LoadAndStart) but right before the game is actually started. This can be used to edit the beatmap as much as you want before it is used. Make sure you call SetOnBeatmapLoaded(IBeatmapLoaded) before the game is started so that this actually gets called.
Declaration
public void OnBeatmapLoaded(Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
OsuParsers.Beatmaps.Beatmap | beatmap | Editable reference to the beatmap. |
Remarks
This is only called once for every .osu file that has just been loaded. It is not called repeatedly when the song is restarted.
OnClickedHitCircle(Int32, Int32, Single, Int32, Beatmap)
Called by the BeatmapRunner when player clicks on a Hit Circle.
Declaration
public void OnClickedHitCircle(int idxClicked, int idxThatNeedsToBePressed, float result, int gotBaseScore, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | idxClicked | Index of Hit Circle pressed. |
Int32 | idxThatNeedsToBePressed | Index of Hit Object that needs to be pressed. If this doesn't match idxPressed, then player clicked on something they shouldn't yet. |
Single | result | Normalized value indicating if user pressed Hit Circle within correct time window. -1.0 to +1.0 is a hit. Any value outside that (lesser than -1.0 or greater than +1.0) means miss (negative for too early, positive for too late). 0.0 means user pressed exactly at Hit Circle's hit time. |
Int32 | gotBaseScore | The 50, 100, or 300 score that the press of this Hit Circle got. This value is not directly added to the player's score yet (because score will still be multiplied), just a representation of which time window the player pressed. |
OsuParsers.Beatmaps.Beatmap | beatmap | Data of the entire beatmap. Use |
OnClickedSliderHead(Int32, Int32, Single, Int32, Beatmap)
Called by the BeatmapRunner when player clicks on a Slider head/start cap.
Declaration
public void OnClickedSliderHead(int idxClicked, int idxThatNeedsToBePressed, float result, int gotBaseScore, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | idxClicked | Index of Slider pressed. |
Int32 | idxThatNeedsToBePressed | Index of Hit Object that needs to be pressed. If this doesn't match idxPressed, then player clicked on something they shouldn't yet. |
Single | result | Normalized value indicating if user pressed slider's head within correct time window. -1.0 to +1.0 is a hit. Any value outside that (lesser than -1.0 or greater than +1.0) means miss (negative for too early, positive for too late). 0.0 means user pressed exactly at slider head's hit time. |
Int32 | gotBaseScore | The equivalent 50, 100, or 300 score that the press of this Slider Head would get. This score is not added to the player's score, just a representation of which time window the player pressed. |
OsuParsers.Beatmaps.Beatmap | beatmap | Data of the entire beatmap. Use |
OnHitCircleDieOff(Int32, Beatmap)
Called by the BeatmapRunner when a Hit Circle's time is up and player never clicked on it.
Declaration
public void OnHitCircleDieOff(int hitCircleIdx, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hitCircleIdx | Hit Circle's Index among the entire beatmap. |
OsuParsers.Beatmaps.Beatmap | beatmap | Data of the entire beatmap. Use |
OnSliderFinished(Int32, Single, Beatmap)
Called when a Slider has finished (ball finished rolling through it).
Declaration
public void OnSliderFinished(int sliderIdx, float completionPercent, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sliderIdx | Index of Slider that was finished. |
Single | completionPercent | 0.0 to 1.0 value of percent completion. 0.0 means 0%, 1.0 means 100%, 0.5 means 50%, etc. |
OsuParsers.Beatmaps.Beatmap | beatmap | Data of the entire beatmap. Use |
Restart()
Declaration
public override void Restart()