Class BeatmapRunner
Main class for starting a beatmap.
Namespace: MouseDance.Runtime
Assembly: MouseDance.Runtime.dll
Syntax
public class BeatmapRunner : MonoBehaviour, IBeatmapRunner, IBeatmapResults
Remarks
Runs a beatmap given the osu file and/or audio clip, keeps track of song's current time to figure out when new Hit Objects should be spawned, detects user-input to see if player hit a Hit Object, and keeps track of all Hit Objects that player was able to hit.
Fields
_audioSource
Where song is played.
Declaration
[SerializeField]
[Tooltip("Where song is played.")]
protected AudioSource _audioSource
Field Value
Type | Description |
---|---|
AudioSource |
_beatmapEnd
Declaration
protected IBeatmapEnd _beatmapEnd
Field Value
Type | Description |
---|---|
IBeatmapEnd |
_beatmapInput
Declaration
protected IBeatmapInput _beatmapInput
Field Value
Type | Description |
---|---|
IBeatmapInput |
_beatmapLoaded
Declaration
protected IBeatmapLoaded _beatmapLoaded
Field Value
Type | Description |
---|---|
IBeatmapLoaded |
_clickedHitObject
Declaration
protected IClickedHitObject _clickedHitObject
Field Value
Type | Description |
---|---|
IClickedHitObject |
_currentState
Whether the BeatmapRunner is currently playing or not.
Declaration
protected BeatmapRunner.State _currentState
Field Value
Type | Description |
---|---|
BeatmapRunner.State |
_customCollectRule
Declaration
protected ICustomCollectRule _customCollectRule
Field Value
Type | Description |
---|---|
ICustomCollectRule |
_firstHitObjectTime
The Start Time of the Beatmap's first Hit Object (in milliseconds). This is used as an "anchor point" to "paste" the "3, 2, 1, Go!" countdown animation in time.
Declaration
protected int _firstHitObjectTime
Field Value
Type | Description |
---|---|
Int32 |
_heldHitObject
Hit object that the player has pressed but not released their button press yet. Needed for sliders and flick hit circles.
Declaration
protected IHitObjectWithEvents _heldHitObject
Field Value
Type | Description |
---|---|
IHitObjectWithEvents |
_hitObjectManager
Allows us to spawn hit objects on-screen.
Declaration
[SerializeField]
[Tooltip("Needed for spawning hit objects on-screen.")]
protected HitObjectManager _hitObjectManager
Field Value
Type | Description |
---|---|
HitObjectManager |
_hitTimingAccuracy
How close to the Hit Object's time did the player get when they pressed on a Hit Object.
Declaration
protected readonly List<float> _hitTimingAccuracy
Field Value
Type | Description |
---|---|
List<Single> |
Remarks
Values inside are normalized, indicating if user pressed Hit Object 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 Object time.
_inTimeHitObjectIndex
Next hit object whose time is up or will be up.
Declaration
protected int _inTimeHitObjectIndex
Field Value
Type | Description |
---|---|
Int32 |
_isPaused
If Beatmap processing is currently paused.
Declaration
protected bool _isPaused
Field Value
Type | Description |
---|---|
Boolean |
Remarks
That means the song will be paused, no hit objects will be spawned, and user-input is not checked.
_mainBeatmap
Data coming from the osu file. Indicates each and every Hit Object that will come up.
Declaration
protected Beatmap _mainBeatmap
Field Value
Type | Description |
---|---|
OsuParsers.Beatmaps.Beatmap |
_mouseInputCamera
Camera used in raycasting, for checking if the user pressed a hit object.
Declaration
[SerializeField]
[Tooltip("Camera used in raycasting, for checking if the user pressed a hit object.")]
protected Camera _mouseInputCamera
Field Value
Type | Description |
---|---|
Camera |
_nextHitObjectIndexThatNeedsToBePressed
Next hit object that player needs to press.
Declaration
protected int _nextHitObjectIndexThatNeedsToBePressed
Field Value
Type | Description |
---|---|
Int32 |
_playDelay
Delay to playing the song, in seconds.
Declaration
protected float _playDelay
Field Value
Type | Description |
---|---|
Single |
Remarks
Use this if you want a delay before playing the song. Useful if the song starts too suddenly and you want a pause in the beginning to give the player time to prepare.
_preemptDuration
Time in milliseconds when any hit object shows up in advance. This makes use of the Approach Rate.
Declaration
protected float _preemptDuration
Field Value
Type | Description |
---|---|
Single |
See Also
_pressedHitObjects
Indices of all hit objects that the player has successfully pressed. This is the indices of the list in HitObjects.
Declaration
protected readonly HashSet<int> _pressedHitObjects
Field Value
Type | Description |
---|---|
HashSet<Int32> |
_pressedHitObjectsBuffer
Declaration
protected readonly List<IHitObjectWithEvents> _pressedHitObjectsBuffer
Field Value
Type | Description |
---|---|
List<IHitObjectWithEvents> |
_score100HitWindowHalf
Amount of time in milliseconds before or after a hit object's time that gives 100 score. This is in the middle, between the 50 and 300 score hit-windows.
Declaration
protected float _score100HitWindowHalf
Field Value
Type | Description |
---|---|
Single |
Remarks
X = hit/collect
before hit time ↓ after hit time
├────────────────┬─────────────┬───────┼───────┬─────────────┬────────────────┤
100 score 100 score
_score300HitWindowHalf
Amount of time in milliseconds before or after a hit object's time that gives 300 score. This is the shortest (most difficult) among the hit-windows, since it's the highest score.
Declaration
protected float _score300HitWindowHalf
Field Value
Type | Description |
---|---|
Single |
Remarks
X = hit/collect
before hit time ↓ after hit time
├────────────────┬─────────────┬───────┼───────┬─────────────┬────────────────┤
300 score
_score50HitWindowHalf
Amount of time in milliseconds before or after a hit object's hit time that gives 50 score. This is the longest (most generous) among the hit-windows, since it's the lowest score.
Declaration
protected float _score50HitWindowHalf
Field Value
Type | Description |
---|---|
Single |
Remarks
X = hit/collect
before hit time ↓ after hit time
├────────────────┬─────────────┬───────┼───────┬─────────────┬────────────────┤
50 score 50 score
_scoreCalculator
Declaration
protected IBeatmapScoreCalculator _scoreCalculator
Field Value
Type | Description |
---|---|
IBeatmapScoreCalculator |
_showHitCircleInAdvance
Index of which hit circle needs to be shown in advance, earlier even than the preempt duration. Normally used only in the start of each phase. -1 means do not use.
Declaration
protected int _showHitCircleInAdvance
Field Value
Type | Description |
---|---|
Int32 |
_sliderPercent
How much slider parts did the player collect for the specified slider, in percent.
Declaration
protected readonly List<float> _sliderPercent
Field Value
Type | Description |
---|---|
List<Single> |
Remarks
Values are within 0.0 to 1.0. 1.0 means 100% all collected. 0.5 means 50%, etc. -1 if the Slider was missed or if index specified is not for a Slider at all.
_songStartCountdown
Declaration
protected ISongStartCountdown _songStartCountdown
Field Value
Type | Description |
---|---|
ISongStartCountdown |
_startCountdownAnimationPlayed
Flag to let us know if the "3, 2, 1, Go!" animation has already been played or not.
Declaration
protected bool _startCountdownAnimationPlayed
Field Value
Type | Description |
---|---|
Boolean |
_timePlayStart
Needed so the current time of the song can be expressed as a negative value (time until song starts).
Declaration
protected float _timePlayStart
Field Value
Type | Description |
---|---|
Single |
_upcomingHitObjectIndex
Next hit object that will show up.
Declaration
protected int _upcomingHitObjectIndex
Field Value
Type | Description |
---|---|
Int32 |
NewLines
Used when parsing the osu file in mobile.
Declaration
protected static readonly char[] NewLines
Field Value
Type | Description |
---|---|
Char[] |
PREEMPT_IN_ADVANCE_ADDED_PERCENT
Declaration
protected const float PREEMPT_IN_ADVANCE_ADDED_PERCENT = 0F
Field Value
Type | Description |
---|---|
Single |
PREEMPT_IN_ADVANCE_PERCENT
Declaration
protected const float PREEMPT_IN_ADVANCE_PERCENT = 1F
Field Value
Type | Description |
---|---|
Single |
SHOW_HIT_CIRCLE_ADVANCE_NUMBER
How many hit circles to be shown in advance, used in conjunction with _showHitCircleInAdvance.
Declaration
protected const int SHOW_HIT_CIRCLE_ADVANCE_NUMBER = 4
Field Value
Type | Description |
---|---|
Int32 |
Properties
CanPressNow
Is the user allowed to press hit objects right now? Returns false if the game hasn't started yet, or if the game has already finished.
Declaration
public virtual bool CanPressNow { get; }
Property Value
Type | Description |
---|---|
Boolean |
GetBeatmapEndType
If we have an IBeatmapEnd callback registered, this is its type.
Declaration
public Type GetBeatmapEndType { get; }
Property Value
Type | Description |
---|---|
Type |
GetBeatmapInputType
If we have an IBeatmapInput callback registered, this is its type.
Declaration
public Type GetBeatmapInputType { get; }
Property Value
Type | Description |
---|---|
Type |
GetBeatmapLoadedType
If we have an IBeatmapLoaded callback registered, this is its type.
Declaration
public Type GetBeatmapLoadedType { get; }
Property Value
Type | Description |
---|---|
Type |
GetClickedHitObjectType
If we have an IClickedHitObject callback registered, this is its type.
Declaration
public Type GetClickedHitObjectType { get; }
Property Value
Type | Description |
---|---|
Type |
GetCustomCollectRuleType
If we have an ICustomCollectRule callback registered, this is its type.
Declaration
public Type GetCustomCollectRuleType { get; }
Property Value
Type | Description |
---|---|
Type |
GetHitObjectSizeCalculatorType
If we have an IHitObjectSizeCalculator callback registered, this is its type.
Declaration
public Type GetHitObjectSizeCalculatorType { get; }
Property Value
Type | Description |
---|---|
Type |
GetScoreCalculatorType
If we have an IBeatmapScoreCalculator callback registered, this is its type.
Declaration
public Type GetScoreCalculatorType { get; }
Property Value
Type | Description |
---|---|
Type |
GetSongStartCountdownType
If we have an ISongStartCountdown callback registered, this is its type.
Declaration
public Type GetSongStartCountdownType { get; }
Property Value
Type | Description |
---|---|
Type |
HasBeatmapEnd
Whether we have an IBeatmapEnd callback registered.
Declaration
public bool HasBeatmapEnd { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasBeatmapLoadedCallback
Whether we have an IBeatmapLoaded callback registered.
Declaration
public bool HasBeatmapLoadedCallback { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasClickedHitObject
Whether we have an IClickedHitObject callback registered.
Declaration
public bool HasClickedHitObject { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasCustomCollectRule
Whether we have an ICustomCollectRule callback registered.
Declaration
public bool HasCustomCollectRule { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasHitObjectSizeCalculator
Whether we have an IHitObjectSizeCalculator callback registered.
Declaration
public bool HasHitObjectSizeCalculator { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasInput
Whether we have an IBeatmapInput callback registered.
Declaration
public bool HasInput { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasScoreCalculator
Whether we have an IBeatmapScoreCalculator callback registered.
Declaration
public bool HasScoreCalculator { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasSongStartCountdown
Whether we have an ISongStartCountdown callback registered.
Declaration
public bool HasSongStartCountdown { get; }
Property Value
Type | Description |
---|---|
Boolean |
HitObjects
Read-only list of all hit objects used in the song's beatmap.
Declaration
public virtual IReadOnlyList<HitObject> HitObjects { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<OsuParsers.Beatmaps.Objects.HitObject> |
PlayerWin
Did the player win?
Declaration
public virtual bool PlayerWin { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
Score
Player's current score.
Declaration
public virtual long Score { get; protected set; }
Property Value
Type | Description |
---|---|
Int64 |
SongEnded
Whether it's time to display results or not.
Declaration
public virtual bool SongEnded { get; }
Property Value
Type | Description |
---|---|
Boolean |
SongProgress
0.0 to 1.0 value range of the currently played song's progress.
Declaration
public virtual float SongProgress { get; }
Property Value
Type | Description |
---|---|
Single |
SortHitObjectByIndex
Sort by Index ascending (lower Index values come first).
Declaration
protected static Comparison<IHitObjectWithEvents> SortHitObjectByIndex { get; }
Property Value
Type | Description |
---|---|
Comparison<IHitObjectWithEvents> |
Methods
_LoadAndStart(String)
Loads the audio file specified inside the _mainBeatmap's OsuParsers.Beatmaps.Sections.BeatmapGeneralSection.AudioFilename using GetAudioClip(String, AudioType), and then starts playing the Beatmap.
Declaration
protected virtual IEnumerator _LoadAndStart(string osuFilePath)
Parameters
Type | Name | Description |
---|---|---|
String | osuFilePath | Needed so we can get the full path. The audio filename specified in a beatmap is relative from the .osu file. |
Returns
Type | Description |
---|---|
IEnumerator |
Remarks
Supports the audio types in AudioType.
CalculateScore(IHitObject, Int32, Beatmap)
Default formula for calculating the score that the player will get for pressing a Hit Circle.
Declaration
protected static int CalculateScore(IHitObject hitCircle, int gotHitCircleValue, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
IHitObject | hitCircle | The Hit Circle that was pressed that we're calculating score for. |
Int32 | gotHitCircleValue | The 50, 100, or 300 score that the player got for pressing this Hit Circle. |
OsuParsers.Beatmaps.Beatmap | beatmap | Entire beatmap. Apart from data on all the Hit Objects, this includes difficulty properties, among other things. |
Returns
Type | Description |
---|---|
Int32 | How much is to be added to the player's score. |
CalculateScore(IHitObject, Int32, Int32, Int32, Boolean, Beatmap)
Default formula for calculating the score that the player will get for finishing a Slider.
Declaration
protected static int CalculateScore(IHitObject slider, int gotSliderHeadScore, int collectedSliderParts, int totalSliderParts, bool pressWasEverReleased, Beatmap beatmap)
Parameters
Type | Name | Description |
---|---|---|
IHitObject | slider | The Slider we're calculating score for. |
Int32 | gotSliderHeadScore | The 50, 100, or 300 score that the player got when they pressed this Slider's head. |
Int32 | collectedSliderParts | Amount of Slider parts that the player collected (head, ticks, tail, repeats). |
Int32 | totalSliderParts | Total number of parts the Slider has (head, ticks, tail, repeats). |
Boolean | pressWasEverReleased | Even if player has their mouse down right now, did player ever release their press of the button throughout the Slider? |
OsuParsers.Beatmaps.Beatmap | beatmap | Entire beatmap. Apart from data on all the Hit Objects, this includes difficulty properties, among other things. |
Returns
Type | Description |
---|---|
Int32 | How much is to be added to the player's score. |
CanCollectSliderPart(IHitObject)
Called by Slider to check if we can proceed with collecting a Slider part.
Declaration
public virtual bool CanCollectSliderPart(IHitObject slider)
Parameters
Type | Name | Description |
---|---|---|
IHitObject | slider |
Returns
Type | Description |
---|---|
Boolean | True if we allow the Slider to collect the Slider part. |
Remarks
This uses any registered ICustomCollectRule callback to check if player is allowed to collect the Slider part using AllowCollectSliderPart(IHitObject).
GetHitAccuracy(Int32)
How close to the Hit Object's time did the player get when they pressed on a Hit Object.
Declaration
public virtual float GetHitAccuracy(int hitObjectIdx)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hitObjectIdx | Index of the Hit Object we are checking. |
Returns
Type | Description |
---|---|
Single | Normalized value indicating if user pressed Hit Object 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 Object time. |
GetSliderPercentComplete(Int32)
Get how much slider parts did the player collect for the specified slider, in percent.
Declaration
public virtual float GetSliderPercentComplete(int sliderIdx)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sliderIdx |
Returns
Type | Description |
---|---|
Single | Value within 0.0 to 1.0. 1.0 means 100% all collected. 0.5 means 50%, etc. -1 if the Slider was missed or if index specified is not for a Slider at all. |
GetTimeWindowPercent(Int32)
For the specified Hit Object Index, this returns how far the current time is from the Hit Object's hit/collect time. 0.0 means current time is exactly at Hit Object's hit/collect time. -1.0 to +1.0 is within the Hit Object's time window. Anything beyond that is outside the time window and is therefore a miss. Lesser than -1.0 is too early, greater than +1.0 is too late.
Declaration
protected virtual float GetTimeWindowPercent(int idx)
Parameters
Type | Name | Description |
---|---|---|
Int32 | idx | index of Hit Object to check |
Returns
Type | Description |
---|---|
Single |
InitializeBeatmapData()
Declaration
protected virtual void InitializeBeatmapData()
LoadAndStart(Beatmap, AudioClip)
Use of the specified Beatmap, and the song from the AudioClip specified (the AudioFilename specified in the osu file is ignored), then start playing. Use this if you already have a Beatmap loaded/generated somewhere else.
Declaration
public virtual void LoadAndStart(Beatmap beatmap, AudioClip song)
Parameters
Type | Name | Description |
---|---|---|
OsuParsers.Beatmaps.Beatmap | beatmap | Beatmap that you want to be used. |
AudioClip | song | Song that you want to be played. This overrides the AudioFilename specified in the osu file. |
LoadAndStart(String)
Load the .osu file specified, and the song indicated inside it (OsuParsers.Beatmaps.Sections.BeatmapGeneralSection.AudioFilename property), then start playing the Beatmap.
Declaration
public virtual void LoadAndStart(string osuFilePath)
Parameters
Type | Name | Description |
---|---|---|
String | osuFilePath | Full path to the osu file you want to load. |
LoadAndStart(String, AudioClip)
Load the .osu file specified, and the song from the AudioClip specified (the OsuParsers.Beatmaps.Sections.BeatmapGeneralSection.AudioFilename specified in the osu file is ignored), then start playing.
Declaration
public virtual void LoadAndStart(string osuFilePath, AudioClip song)
Parameters
Type | Name | Description |
---|---|---|
String | osuFilePath | Full path to the osu file you want to load. |
AudioClip | song | Song that you want to be played. This overrides the AudioFilename specified in the osu file. |
LoadAndStart(TextAsset, AudioClip)
Load the .osu data from the TextAsset specified, and the song from the AudioClip specified (the AudioFilename specified in the osu file is ignored), then start playing.
Declaration
public virtual void LoadAndStart(TextAsset osuFile, AudioClip song)
Parameters
Type | Name | Description |
---|---|---|
TextAsset | osuFile | Osu file that you want to load. |
AudioClip | song | Song that you want to be played. This overrides the AudioFilename specified in the osu file. |
LoadToMainBeatmap(String)
Load the contents of the .osu file specified into _mainBeatmap.
Declaration
protected virtual void LoadToMainBeatmap(string osuFilePath)
Parameters
Type | Name | Description |
---|---|---|
String | osuFilePath | Full path to the .osu file |
OnUserFinishedSlider(IHitObjectWithEvents, Int32, Int32, Int32, Boolean)
Called by OnReachedEnd() to let the BeatmapRunner know that user has their mouse down on the Slider as it finished, so that it can calculate the score that the player gets for this Slider and tally it.
Declaration
public virtual void OnUserFinishedSlider(IHitObjectWithEvents slider, int headScore, int collected, int total, bool pressWasEverReleased)
Parameters
Type | Name | Description |
---|---|---|
IHitObjectWithEvents | slider | Slider that was finished. |
Int32 | headScore | What score the player got when they pressed on the Slider's head. |
Int32 | collected | How many parts of the Slider was collected (head, ticks, tail, repeats). |
Int32 | total | Total number of parts the Slider has (head, ticks, tail, repeats). |
Boolean | pressWasEverReleased | Even if player has their mouse down right now, did player ever release their press of the button throughout the Slider? |
OnUserPressedHitCircle(IHitObjectWithEvents)
Called by OnPressed(Int32) to let BeatmapRunner know that the user pressed on the HitCircle so it can tally and add to the score. Simultaneously, this also lets the Hit Circle know if user pressed within correct time window and how much score was received for it.
Declaration
public virtual (float, int) OnUserPressedHitCircle(IHitObjectWithEvents hitCircle)
Parameters
Type | Name | Description |
---|---|---|
IHitObjectWithEvents | hitCircle | Hit Circle that was pressed. |
Returns
Type | Description |
---|---|
(T1, T2)<Single, Int32> | Single: Normalized value indicating if user pressed 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 time. int: score given for this particular pressed hit circle |
OnUserPressedSliderHead(Int32)
Called by OnPressed(Int32) when user pressed the head (aka Start Cap) of a Slider. This is used to let the Slider know if user pressed within the correct time window, and what the equivalent score would be for that head press.
Declaration
public virtual (float, int) OnUserPressedSliderHead(int idx)
Parameters
Type | Name | Description |
---|---|---|
Int32 | idx | Index of the Slider that was pressed. |
Returns
Type | Description |
---|---|
(T1, T2)<Single, Int32> | Single: 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. int: Equivalent score for pressing the Slider head. The score value here is not added to the player's score, but is calculated to let you know if the user did a perfect press or not. |
Pause(Boolean)
Stop the Beatmap Runner from processing. That means the song will be paused, no hit objects will be spawned, and user-input is not checked.
Declaration
public virtual void Pause(bool pause)
Parameters
Type | Name | Description |
---|---|---|
Boolean | pause |
RecalculateDisplayedHitObjectSize()
Recalculate the size of currently displayed Hit Objects.
Declaration
public virtual void RecalculateDisplayedHitObjectSize()
Restart()
Play current song and beatmap again from the beginning. This assumes a song has already been loaded via LoadAndStart(String) or LoadAndStart(TextAsset, AudioClip)
Declaration
public virtual void Restart()
SetBeatmapEnd(IBeatmapEnd)
Optional. Assign what receives the callback event when the game ends. See IBeatmapEnd.
Declaration
public void SetBeatmapEnd(IBeatmapEnd newBeatmapEnd)
Parameters
Type | Name | Description |
---|---|---|
IBeatmapEnd | newBeatmapEnd | The object that will receive the notification that the game has ended. Use null if you no longer want BeatmapRunner from sending this notification. |
SetCustomCollectRule(ICustomCollectRule)
Optional. Assign what calculates any custom rule regarding hit object collection. See ICustomCollectRule. Call this before starting the beatmap.
Declaration
public void SetCustomCollectRule(ICustomCollectRule newCustomCollectRule)
Parameters
Type | Name | Description |
---|---|---|
ICustomCollectRule | newCustomCollectRule | The object that will add any custom rules. |
SetHitObjectSizeCalculator(IHitObjectSizeCalculator)
Optional. Assign what calculates hit object size. See IHitObjectSizeCalculator. Call this before starting the beatmap.
Declaration
public void SetHitObjectSizeCalculator(IHitObjectSizeCalculator newHitObjectSizeCalculator)
Parameters
Type | Name | Description |
---|---|---|
IHitObjectSizeCalculator | newHitObjectSizeCalculator | The object that calculates hit object size. |
SetInput(IBeatmapInput)
Optional. Assign what dictates whether user-input has been pressed or not. See IBeatmapInput. Call this before starting the beatmap. If not assigned, the BeatmapRunner will use default hardcoded controls.
Declaration
public void SetInput(IBeatmapInput newInput)
Parameters
Type | Name | Description |
---|---|---|
IBeatmapInput | newInput | The object that will dictate whether user-input has been pressed or not. Set to null if you want BeatmapRunner to go back to using defaults. |
SetOnBeatmapLoaded(IBeatmapLoaded)
Optional. Assign the object that you want to be notified of the event when a Beatmap has been loaded (with LoadAndStart) but right before the game is actually started. See IBeatmapLoaded. This event can be used to edit the beatmap as much as you want before it is used.
Declaration
public void SetOnBeatmapLoaded(IBeatmapLoaded newBeatmapLoaded)
Parameters
Type | Name | Description |
---|---|---|
IBeatmapLoaded | newBeatmapLoaded | The object that will receive the OnBeatmapLoaded notification. Use null if you no longer want the BeatmapRunner to send the notification. |
SetOnClickedHitObject(IClickedHitObject)
Optional. Assign what receives the callback event when player clicks on a Hit Object, whether hit or miss. See IClickedHitObject. Call this before starting the beatmap.
Declaration
public void SetOnClickedHitObject(IClickedHitObject newClickedHitObject)
Parameters
Type | Name | Description |
---|---|---|
IClickedHitObject | newClickedHitObject | The object that will receive the event. |
SetScoreCalculator(IBeatmapScoreCalculator)
Optional. Assign what calculates the score that the player will get for hitting a Hit Object. See IBeatmapScoreCalculator. Call this before starting the beatmap.
Declaration
public void SetScoreCalculator(IBeatmapScoreCalculator newScoreCalculator)
Parameters
Type | Name | Description |
---|---|---|
IBeatmapScoreCalculator | newScoreCalculator | The object that will calculate the score. |
SetSongStartCountdown(ISongStartCountdown)
Optional. Assign what receives the callback event when countdown animation should begin. See ISongStartCountdown. Call this right before starting the beatmap.
Declaration
public void SetSongStartCountdown(ISongStartCountdown newStartCountdown)
Parameters
Type | Name | Description |
---|---|---|
ISongStartCountdown | newStartCountdown | The object that receives the event when countdown animation should begin. Set to null if you no longer want BeatmapRunner to send this event. |
Update()
Called automatically by Unity every frame.
Declaration
protected virtual void Update()
UpdateInput()
Called every frame to check if the user-input has been pressed. This is also where IBeatmapInput is used, if it was assigned.
Declaration
protected virtual void UpdateInput()
UpdateSong()
Called every frame (in Update()) to check if we should spawn a Hit Object now, and when we need to check if a Hit Object has been missed. This is also where the OnStartCountdown() is called, if it was assigned.
Declaration
protected virtual void UpdateSong()
WasHit(Int32)
Did the player successfully press the hit object with the specified index? Index value corresponds to the list in HitObjects.
Declaration
public virtual bool WasHit(int hitObjectIdx)
Parameters
Type | Name | Description |
---|---|---|
Int32 | hitObjectIdx |
Returns
Type | Description |
---|---|
Boolean |