private void assertStateAfterResult(JudgementResult judgementResult, TaikoMascotAnimationState expectedState) { AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}", () => applyNewResult(judgementResult)); AddAssert($"state is {expectedState.ToString().ToLower()}", () => allMascotsIn(expectedState)); }
public DrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle) { Origin = Anchor = Anchor.BottomLeft; State = new Bindable <TaikoMascotAnimationState>(startingState); LastResult = new Bindable <JudgementResult>(); animations = new Dictionary <TaikoMascotAnimationState, TaikoMascotAnimation>(); }
private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex) { var texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}"); if (frameIndex == 0 && texture == null) { texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}"); } return(texture); }
public void TestClearStateOnClearedSwell(bool kiai, TaikoMascotAnimationState expectedStateAfterClear) { AddStep("set beatmap", () => setBeatmap(kiai)); createDrawableRuleset(); assertStateAfterResult(new JudgementResult(new Swell(), new TaikoSwellJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Clear); AddUntilStep($"state reverts to {expectedStateAfterClear.ToString().ToLower()}", () => allMascotsIn(expectedStateAfterClear)); }
public TaikoMascotAnimation(TaikoMascotAnimationState state) { InternalChild = textureAnimation = createTextureAnimation(state).With(animation => { animation.Origin = animation.Anchor = Anchor.BottomLeft; animation.Scale = new Vector2(0.51f); // close enough to stable }); RelativeSizeAxes = Axes.Both; Origin = Anchor = Anchor.BottomLeft; // needs to be always present to prevent the animation clock consuming time spent when not present. AlwaysPresent = true; }
private void assertStateAfterResult(JudgementResult judgementResult, TaikoMascotAnimationState expectedState) { TaikoMascotAnimationState[] mascotStates = null; AddStep($"{judgementResult.Type.ToString().ToLower()} result for {judgementResult.Judgement.GetType().Name.Humanize(LetterCasing.LowerCase)}", () => { applyNewResult(judgementResult); // store the states as soon as possible, so that the delay between steps doesn't incorrectly fail the test // due to not checking if the state changed quickly enough. Schedule(() => mascotStates = animatedMascots.Select(mascot => mascot.State.Value).ToArray()); }); AddAssert($"state is {expectedState.ToString().ToLower()}", () => mascotStates.All(state => state == expectedState)); }
private static TextureAnimation createTextureAnimation(TaikoMascotAnimationState state) { switch (state) { case TaikoMascotAnimationState.Clear: return(new ClearMascotTextureAnimation()); case TaikoMascotAnimationState.Idle: case TaikoMascotAnimationState.Kiai: case TaikoMascotAnimationState.Fail: return(new ManualMascotTextureAnimation(state)); default: throw new ArgumentOutOfRangeException(nameof(state), $"Mascot animations for state {state} are not supported"); } }
private bool someMascotsIn(TaikoMascotAnimationState state) => mascots.Any(d => d.State.Value == state);
private bool allMascotsIn(TaikoMascotAnimationState state) => mascots.All(d => d.State.Value == state);
private bool animatedMascotsIn(TaikoMascotAnimationState state) => animatedMascots.Any(d => d.State.Value == state);
public ManualMascotTextureAnimation(TaikoMascotAnimationState state) { this.state = state; IsPlaying = false; }
private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex) => skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}");