mirror of https://github.com/ppy/osu
Change state variables
This commit is contained in:
parent
96660b2cca
commit
74d36cad78
|
@ -4,7 +4,6 @@
|
|||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
|
@ -16,8 +15,7 @@ public class DrawableTaikoMascot : BeatSyncedContainer
|
|||
{
|
||||
private TaikoMascotTextureAnimation idleDrawable, clearDrawable, kiaiDrawable, failDrawable;
|
||||
private EffectControlPoint lastEffectControlPoint;
|
||||
|
||||
public Bindable<TaikoMascotAnimationState> PlayfieldState;
|
||||
private TaikoMascotAnimationState playfieldState;
|
||||
|
||||
public TaikoMascotAnimationState State { get; private set; }
|
||||
|
||||
|
@ -25,13 +23,6 @@ public DrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascot
|
|||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
PlayfieldState = new Bindable<TaikoMascotAnimationState>();
|
||||
PlayfieldState.BindValueChanged(b =>
|
||||
{
|
||||
if (lastEffectControlPoint != null)
|
||||
ShowState(GetFinalAnimationState(lastEffectControlPoint, b.NewValue));
|
||||
});
|
||||
|
||||
State = startingState;
|
||||
}
|
||||
|
||||
|
@ -60,6 +51,20 @@ public void ShowState(TaikoMascotAnimationState state)
|
|||
drawable.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the playfield state used for determining the final state.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If you're looking to change the state manually, please look at <see cref="ShowState"/>.
|
||||
/// </remarks>
|
||||
public void SetPlayfieldState(TaikoMascotAnimationState state)
|
||||
{
|
||||
playfieldState = state;
|
||||
|
||||
if (lastEffectControlPoint != null)
|
||||
ShowState(GetFinalAnimationState(lastEffectControlPoint, playfieldState));
|
||||
}
|
||||
|
||||
private TaikoMascotTextureAnimation getStateDrawable(TaikoMascotAnimationState state)
|
||||
{
|
||||
switch (state)
|
||||
|
@ -93,7 +98,7 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint,
|
|||
{
|
||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||
|
||||
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, PlayfieldState.Value);
|
||||
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, playfieldState);
|
||||
ShowState(state);
|
||||
|
||||
if (state == TaikoMascotAnimationState.Clear)
|
||||
|
|
|
@ -220,7 +220,7 @@ internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result
|
|||
if (miss && judgedObject.HitObject is StrongHitObject)
|
||||
miss = result.Judgement.AffectsCombo;
|
||||
|
||||
mascot.PlayfieldState.Value = miss ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle;
|
||||
mascot.SetPlayfieldState(miss ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue