Rhythm Rally polish

This commit is contained in:
Braedon
2022-02-15 00:17:53 -05:00
parent 52f722ae0b
commit bea09a5d2f
29 changed files with 2343 additions and 40 deletions

View File

@ -2,6 +2,8 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.RhythmRally
@ -72,6 +74,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
playerAnim.Play("Swing", 0, 0);
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Return", hitBeat), new MultiSound.Sound("rhythmRally/ReturnBounce", bounceBeat) });
BounceFX(bounceBeat);
}
void Miss()
@ -93,6 +96,20 @@ namespace RhythmHeavenMania.Games.RhythmRally
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Whistle", whistleBeat) });
}
public void BounceFX(float bounceBeat)
{
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(bounceBeat, delegate
{
GameObject ballHitFX2 = Instantiate(RhythmRally.instance.ballHitFX.gameObject, RhythmRally.instance.gameObject.transform);
ballHitFX2.SetActive(true);
ballHitFX2.transform.position = new Vector3(ballHitFX2.transform.position.x, ballHitFX2.transform.position.y, RhythmRally.instance.ball.transform.position.z);
ballHitFX2.GetComponent<SpriteRenderer>().DOColor(new Color(0, 0, 0, 0), 0.65f).SetEase(Ease.OutExpo).OnComplete(delegate { Destroy(ballHitFX2); });
})
});
}
public override void OnAce()
{
Ace();

View File

@ -21,6 +21,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
public GameObject ballShadow;
public BezierCurve3D serveCurve;
public BezierCurve3D returnCurve;
public GameObject ballHitFX;
[Header("Animators")]
@ -34,6 +35,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
public bool served;
public float serveBeat;
public float targetBeat;
private bool inPose;
public Paddlers paddlers;
@ -140,7 +142,9 @@ namespace RhythmHeavenMania.Games.RhythmRally
if (!missed)
{
float curveHeight = 1f;
if (rallySpeed == RallySpeed.Fast && !served && hitPosition1 >= 1f)
if (rallySpeed == RallySpeed.Fast && served)
curveHeight = 0.5f;
else if (rallySpeed == RallySpeed.Fast && !served && hitPosition1 >= 1f)
curveHeight = 2f;
else if (rallySpeed == RallySpeed.Slow)
curveHeight = 3f;
@ -179,7 +183,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
readyToPrep = timeBeforeNextHit <= 1f;
// Paddler ready animation.
if (readyToPrep && !opponentServing)
if (readyToPrep && !opponentServing && !inPose)
{
if (served)
{
@ -204,7 +208,7 @@ namespace RhythmHeavenMania.Games.RhythmRally
// Paddler bop animation.
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
{
if (currentBeat >= bop.startBeat && currentBeat < bop.startBeat + bop.length)
if (currentBeat >= bop.startBeat && currentBeat < bop.startBeat + bop.length && !inPose)
{
if (!playerPrepping && (playerAnim.IsAnimationNotPlaying() || playerState.IsName("Idle") || playerState.IsName("Beat")))
playerAnim.Play("Beat", 0, 0);
@ -254,10 +258,19 @@ namespace RhythmHeavenMania.Games.RhythmRally
opponentAnim.Play("Swing", 0, 0);
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Serve", serveBeat), new MultiSound.Sound("rhythmRally/ServeBounce", bounceBeat) });
paddlers.BounceFX(bounceBeat);
paddlers.ResetState();
}
public void Pose()
{
playerAnim.Play("Pose", 0, 0);
opponentAnim.Play("Pose", 0, 0);
ball.gameObject.SetActive(false); // temporary solution, should realistically just fall down
inPose = true;
}
public void PrepareFastRally(float beat, RallySpeed speedChange)
{
if (speedChange == RallySpeed.Fast)

View File

@ -224,6 +224,7 @@ namespace RhythmHeavenMania
new GameAction("slow rally", delegate { RhythmRally.instance.Serve(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.Slow); }, 8f, true),
new GameAction("fast rally", delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.Fast); }, 6f),
new GameAction("superfast rally", delegate { RhythmRally.instance.PrepareFastRally(eventCaller.currentEntity.beat, RhythmRally.RallySpeed.SuperFast); }, 12f),
new GameAction("pose", delegate { RhythmRally.instance.Pose(); }, 0.5f),
}),
/*new Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>()
{