Class LeftRightClickDemoMain
Example of how to add custom rules to the game. Used in the Left Right Click Demo. It uses IBeatmapInput to change how input is detected, and ICustomCollectRule to change the rules on how Hit Objects are collected.
Inherited Members
Namespace: MouseDance.Demo
Assembly: MouseDance.Demo.dll
Syntax
public class LeftRightClickDemoMain : BasicDemoMain, ISongStartCountdown, IBeatmapEnd, IBeatmapInput, ICustomCollectRule
Remarks
We'll require left-click when the Hit Object is red, and right-click when the Hit Object is blue.
We're assuming the Combo Colours are assigned properly (in HitObjectColours), wherein there are only two combo colours, red and blue. So we can easily figure it out based on the Combo Colour Index: 0 for red, 1 for blue.
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).
Properties
CursorPosition
Declaration
public Vector2 CursorPosition { get; }
Property Value
Type | Description |
---|---|
Vector2 |
IsPlayerInputDown
Declaration
public bool IsPlayerInputDown { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsPlayerInputUp
Declaration
public bool IsPlayerInputUp { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AllowCollect(IHitObject, IReadOnlyList<IHitObject>)
Called by the BeatmapRunner to check if player is allowed to proceed with pressing the Hit Object they clicked on.
Declaration
public HitObjectReaction AllowCollect(IHitObject hitObject, IReadOnlyList<IHitObject> allPressed)
Parameters
Type | Name | Description |
---|---|---|
IHitObject | hitObject | The Hit Object we are checking. |
IReadOnlyList<IHitObject> | allPressed | List of all Hit Objects pressed, in case player pressed on overlapping Hit Objects. This is sorted by Hit Object Index meaning first element in this list is the one that is visually topmost (in terms of Z-order) on the screen. If there is only one Hit Object pressed, then allPressed will only contain one element. |
Returns
Type | Description |
---|---|
HitObjectReaction | HitObjectReaction struct containing all info on how you want the Hit Object to react. |
Remarks
This is called the same frame that IsPlayerInputDown returns true. It is called for each Hit Object found under the mouse (in case the player clicked on overlapping Hit Objects).
AllowCollectSliderPart(IHitObject)
Called by the BeatmapRunner to check if player is allowed to proceed with collecting a Slider Part that they're currently pressing on.
Declaration
public bool AllowCollectSliderPart(IHitObject slider)
Parameters
Type | Name | Description |
---|---|---|
IHitObject | slider | The Slider we're checking for. |
Returns
Type | Description |
---|---|
Boolean | Return true to allow the Slider Part to be collected. |
Awake()
Declaration
protected override void Awake()