MouseDance MouseDance
MouseDance MouseDance
MouseDance User Docs powered by DocFx, DiscordFx

Search Results for

    Class SliderBall

    Handles display and movement of a 3d ball that moves through a Slider's body.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    SliderBall
    Implements
    ISliderBall
    Namespace: MouseDance.Runtime
    Assembly: MouseDance.Runtime.dll
    Syntax
    public class SliderBall : MonoBehaviour, ISliderBall

    Fields

    _ballOrientation

    Declaration
    [SerializeField]
    [Tooltip("Which transform we'll do the orienting animation on.")]
    protected Transform _ballOrientation
    Field Value
    Type Description
    Transform

    _ballOrientationSpeed

    Declaration
    [SerializeField]
    [Tooltip("How fast the ball orients itself to the direction it's moving to.")]
    protected float _ballOrientationSpeed
    Field Value
    Type Description
    Single

    _ballPosition

    Declaration
    [SerializeField]
    [Tooltip("The transform we'll be moving around.")]
    protected Transform _ballPosition
    Field Value
    Type Description
    Transform

    _ballRenderer

    Declaration
    [SerializeField]
    protected Renderer _ballRenderer
    Field Value
    Type Description
    Renderer

    _ballRoll

    Declaration
    [SerializeField]
    [Tooltip("Which transform we'll do the rolling animation on.")]
    protected Transform _ballRoll
    Field Value
    Type Description
    Transform

    _ballRotationSpeed

    Declaration
    [SerializeField]
    [Tooltip("How fast the ball rolls.")]
    protected float _ballRotationSpeed
    Field Value
    Type Description
    Single

    _ballScale

    Declaration
    [SerializeField]
    [Tooltip("Which transform we'll use for changing the ball size.")]
    protected Transform _ballScale
    Field Value
    Type Description
    Transform

    _ballScaleMultiplier

    Declaration
    [SerializeField]
    [Tooltip("Scale multiplier for the ball 3d model. This is for converting the size value from the UI to the 3d model. Since Unity UI scale works in pixel units (which gives you rather large values) and a 3d model's scale is often a small value, where (1, 1, 1) is often the correct value, this multiplier needs to be small (less than 1.0) to make the ball 3d model be in the correct scale.")]
    protected float _ballScaleMultiplier
    Field Value
    Type Description
    Single

    _ballSpeed

    Movement applied to ball every frame.

    Declaration
    protected float _ballSpeed
    Field Value
    Type Description
    Single

    _beatmapInput

    Optional. Used to figure out where the mouse cursor is. If set to null, then we just use Input.mousePosition (when using old Input System) or Mouse.current.position.ReadValue() (when using new Input System).

    Declaration
    protected IBeatmapInput _beatmapInput
    Field Value
    Type Description
    IBeatmapInput

    _colour

    Current colour applied to the _materialPropertyBlock. Used for showing/hiding/fading-out the ball.

    Declaration
    protected Color _colour
    Field Value
    Type Description
    Color

    _fadeOut

    Once ball has finished movement, this is set to true so fading starts.

    Declaration
    protected bool _fadeOut
    Field Value
    Type Description
    Boolean

    _materialPropertyBlock

    Used to apply color change to the Ball material. Used for showing/hiding/fading-out the ball.

    Declaration
    protected MaterialPropertyBlock _materialPropertyBlock
    Field Value
    Type Description
    MaterialPropertyBlock

    _moveInReverse

    Whether we are moving towards the tail or the head of the Slider.
    True: Ball is moving from tail to head.
    False: Ball is moving from head to tail.

    Declaration
    protected bool _moveInReverse
    Field Value
    Type Description
    Boolean

    _movingRight

    Flag indicating whether ball is currently moving to the right (in terms of screen-space).

    Once the ball is no longer moving in the same direction then we know the ball has "overshot" its movement towards its current destination. This lets us know the destination has been reached.

    Declaration
    protected bool _movingRight
    Field Value
    Type Description
    Boolean

    _movingUp

    Flag indicating whether ball is currently moving up (in terms of screen-space).

    Once the ball is no longer moving in the same direction then we know the ball has "overshot" its movement towards its current destination. This lets us know the destination has been reached.

    Declaration
    protected bool _movingUp
    Field Value
    Type Description
    Boolean

    _nextPathIdx

    Index in the _path list that points to the current destination that the ball is going towards.

    Declaration
    protected int _nextPathIdx
    Field Value
    Type Description
    Int32

    _numberOfTimes

    Current number of times the ball has to move through the Slider it's on.

    This decrements each time an end of the Slider is reached (either tail-end or head-end), and once value becomes 0, then we know the ball has finally finished moving.

    Normally this just starts with value of 1, to indicate the ball just moves from head of Slider to tail, and then finishes, no repeats.

    Declaration
    protected int _numberOfTimes
    Field Value
    Type Description
    Int32

    _path

    Local-space positions of each point in the Slider's path.

    Declaration
    protected readonly List<Vector3> _path
    Field Value
    Type Description
    List<Vector3>

    _rectTransform

    Declaration
    [SerializeField]
    [Tooltip("The parent RectTransform of the ball.")]
    protected RectTransform _rectTransform
    Field Value
    Type Description
    RectTransform

    _rollAxis

    Declaration
    [SerializeField]
    [Tooltip("What direction to use when doing the rolling animation for the ball 3d model.")]
    protected Axis _rollAxis
    Field Value
    Type Description
    Axis

    _rollDir

    Direction of rolling animation, relative to the _ballRoll transform.

    Declaration
    protected Vector3 _rollDir
    Field Value
    Type Description
    Vector3

    _slider

    The slider this ball is moving through.

    Declaration
    protected ISlider _slider
    Field Value
    Type Description
    ISlider

    _smoothenOrientation

    Change how ball changes facing towards direction of movement:
    True: Ease the change of direction so ball slowly rotates.
    False: Ball turns to face direction of movement immediately.

    Declaration
    protected bool _smoothenOrientation
    Field Value
    Type Description
    Boolean

    _targetOrientation

    Current facing direction the ball is going towards. Only used when _smoothenOrientation is true.

    Declaration
    protected Vector3 _targetOrientation
    Field Value
    Type Description
    Vector3

    _timeToDie

    Absolute time in milliseconds when ball fading is finished.

    Declaration
    protected float _timeToDie
    Field Value
    Type Description
    Single

    _viewCamera

    Needed for figuring out the distance between this Slider Ball and the mouse cursor (or touch input, for mobile).

    Declaration
    protected Camera _viewCamera
    Field Value
    Type Description
    Camera

    ColourProperty

    Declaration
    protected static readonly int ColourProperty
    Field Value
    Type Description
    Int32

    Properties

    DistanceToMouse

    Distance of mouse cursor to this Slider Ball, in Osu!pixels.

    Declaration
    public virtual float DistanceToMouse { get; }
    Property Value
    Type Description
    Single

    IsMoving

    If the Ball has already started moving or not.

    Declaration
    public virtual bool IsMoving { get; }
    Property Value
    Type Description
    Boolean

    Slider

    The Slider that this Ball is rolling through. Needed so we can inform the Slider of our roll progress, through OnBallReachedPositionInPath(Int32, Int32, Boolean, Single).

    Declaration
    public virtual ISlider Slider { get; }
    Property Value
    Type Description
    ISlider

    Methods

    Hide()

    Immediately hide this Slider Ball (no fade-out).

    Declaration
    public virtual void Hide()

    Move(ISlider, Int32, Boolean, Single, Double, Int32, Vector2, List<Vector3>, Color, Boolean)

    Start moving the Slider Ball through the specified Slider.

    Declaration
    public virtual void Move(ISlider slider, int comboCounter, bool showNumber, float radius, double ballSpeed, int numberOfTimes, Vector2 initialPos, List<Vector3> path, Color colour, bool smoothenOrientation)
    Parameters
    Type Name Description
    ISlider slider

    The Slider that the Ball will now move through.

    Int32 comboCounter

    The number displayed by the Slider. Use this if your Slider Ball also shows that number.

    Boolean showNumber

    Whether the Slider Ball should also show the number.

    Single radius

    How big the ball should be.

    Double ballSpeed

    How fast the ball should be.

    Int32 numberOfTimes

    How many times the Ball should move through the Slider.

    Vector2 initialPos

    Starting position of the Slider.

    List<Vector3> path

    Local-space positions of each point in the Slider's line.

    Color colour

    Colour of that the Ball should be in.

    Boolean smoothenOrientation

    Whether the change of the Ball's facing direction should be smoothened out.

    Resize(Single)

    Resize the ball, meant to be used when the ball is currently shown.

    Declaration
    public virtual void Resize(float radius)
    Parameters
    Type Name Description
    Single radius

    How big the ball should be.

    SetInput(IBeatmapInput)

    Optional. If user has custom code on how to retrieve the mouse cursor position, this is used to get that.

    Declaration
    public virtual void SetInput(IBeatmapInput beatmapInput)
    Parameters
    Type Name Description
    IBeatmapInput beatmapInput

    Something that provides mouse cursor position.

    SetViewCamera(Camera)

    Needed for figuring out the distance between this Slider Ball and the mouse cursor (or touch input, for mobile). The camera is used to help convert mouse cursor position from screen-space into Osu!pixel values.

    Declaration
    public virtual void SetViewCamera(Camera newViewCam)
    Parameters
    Type Name Description
    Camera newViewCam

    The camera that will be used for converting the mouse cursor position values.

    Update()

    Called every frame to move and roll the ball, and do the fade out animation, when necessary. Each time a destination has been reached, this calls OnBallReachedPositionInPath(Int32, Int32, Boolean, Single).

    Declaration
    protected virtual void Update()

    Implements

    ISliderBall

    Extension Methods

    Util.SetLayerDeep(Component, LayerMask)
    Util.SetLayerDeep(Component, Int32)
    Util.SetLayerDeep(Component, LayerMask, Stack<Transform>)