mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
4c4d0a7a7a
* add pause menu assets * layout and animation for pause * make play mode prefab function re-assign unused class inheritance * remove filepath * don't init medals twice * remove PlayerActionObject * initial attempt at anti-note lock TODO: circumvent inputs clearing themselves making the functionality not work * properly implement input lock prevention * fix error on editor open * functional pause menu * bugfix * make unpausing not reset current play statistics * serialize initializer components in inspector instead of procedurally generating * sanity check * note for fade * make flashes in the camera prefabs instead of in world space remove / reorganize script files address issue #411 * fix bug with perfect campaign make minigame transitions hide the game canvas adjust animation of the song credits textbox * fully functional intro scene (placeholder for future title screen) refactored entire game loading procedure re-organized some files * add interaction query to disclaimer text * reword legal * anchor section medals to section display more tempo change placement controls * operation order bugfix * prep for future ratings and stats * loading text * autoload opening scene * splash screen adjustments added setting to force enable splash screen * adjust setting entry
121 lines
3.9 KiB
C#
121 lines
3.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using DG.Tweening;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_RhythmRally
|
|
{
|
|
public class Paddlers : MonoBehaviour
|
|
{
|
|
private RhythmRally game;
|
|
private Animator playerAnim;
|
|
private Animator opponentAnim;
|
|
private Conductor cond;
|
|
|
|
public void Init()
|
|
{
|
|
game = RhythmRally.instance;
|
|
playerAnim = game.playerAnim;
|
|
opponentAnim = game.opponentAnim;
|
|
cond = Conductor.instance;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (!game.served || game.missed || !game.started) return;
|
|
|
|
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
|
{
|
|
// Play "whoosh" sound here
|
|
playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ;
|
|
}
|
|
}
|
|
|
|
void Ace()
|
|
{
|
|
game.served = false;
|
|
|
|
var hitBeat = cond.songPositionInBeats;
|
|
|
|
var bounceBeat = game.serveBeat + game.targetBeat + 1f;
|
|
|
|
if (game.rallySpeed == RhythmRally.RallySpeed.Slow)
|
|
{
|
|
bounceBeat = game.serveBeat + game.targetBeat + 2f;
|
|
}
|
|
else if (game.rallySpeed == RhythmRally.RallySpeed.SuperFast)
|
|
{
|
|
bounceBeat = game.serveBeat + game.targetBeat + 0.5f;
|
|
}
|
|
|
|
playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ;
|
|
MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("rhythmRally/Return", hitBeat), new MultiSound.Sound("rhythmRally/ReturnBounce", bounceBeat) });
|
|
BounceFX(bounceBeat);
|
|
game.ball.SetActive(true);
|
|
}
|
|
|
|
void NearMiss(float state)
|
|
{
|
|
MissBall();
|
|
Jukebox.PlayOneShot("miss");
|
|
playerAnim.DoScaledAnimationAsync("Swing", 0.5f); ;
|
|
|
|
game.missCurve.KeyPoints[0].Position = game.ball.transform.position;
|
|
game.missCurve.transform.localScale = new Vector3(-state, 1f, 1f);
|
|
game.missBeat = cond.songPositionInBeats;
|
|
game.ball.SetActive(true);
|
|
}
|
|
|
|
void MissBall()
|
|
{
|
|
game.served = false;
|
|
game.missed = true;
|
|
|
|
var whistleBeat = game.serveBeat + game.targetBeat + 1f;
|
|
|
|
if (game.rallySpeed == RhythmRally.RallySpeed.Slow)
|
|
{
|
|
whistleBeat = game.serveBeat + game.targetBeat + 2f;
|
|
}
|
|
else if (game.rallySpeed == RhythmRally.RallySpeed.SuperFast)
|
|
{
|
|
whistleBeat = game.serveBeat + game.targetBeat + 0.5f;
|
|
}
|
|
|
|
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 void Just(PlayerActionEvent caller, float state)
|
|
{
|
|
if (state >= 1f || state <= -1f) {
|
|
NearMiss(state);
|
|
return;
|
|
}
|
|
Ace();
|
|
}
|
|
|
|
public void Miss(PlayerActionEvent caller)
|
|
{
|
|
MissBall();
|
|
}
|
|
|
|
public void Out(PlayerActionEvent caller) {}
|
|
}
|
|
}
|