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
94 lines
No EOL
2.4 KiB
C#
94 lines
No EOL
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_ClappyTrio
|
|
{
|
|
public class ClappyTrioPlayer : MonoBehaviour
|
|
{
|
|
ClappyTrio game;
|
|
private float lastClapBeat;
|
|
private float lastClapLength;
|
|
|
|
public bool clapStarted = false;
|
|
public bool canHit;
|
|
|
|
private GameObject clapEffect;
|
|
|
|
private void Awake()
|
|
{
|
|
game = ClappyTrio.instance;
|
|
clapEffect = transform.GetChild(4).GetChild(3).gameObject;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
|
{
|
|
Clap(false);
|
|
game.ScoreMiss();
|
|
}
|
|
}
|
|
|
|
public void QueueClap(float startBeat, float length)
|
|
{
|
|
lastClapBeat = startBeat;
|
|
lastClapLength = length;
|
|
|
|
game.ScheduleInput(startBeat, length, InputType.STANDARD_DOWN, Just, Miss, Out);
|
|
}
|
|
|
|
private void Just(PlayerActionEvent caller, float state)
|
|
{
|
|
if (!canHit) {
|
|
Clap(false);
|
|
return;
|
|
}
|
|
if (state >= 1f || state <= -1f) { //todo: proper near miss feedback
|
|
Clap(false);
|
|
return;
|
|
}
|
|
Clap(true);
|
|
}
|
|
|
|
private void Miss(PlayerActionEvent caller) {
|
|
game.playerHitLast = false;
|
|
game.missed = true;
|
|
game.emoCounter = 2;
|
|
|
|
if (clapStarted)
|
|
this.canHit = false;
|
|
}
|
|
|
|
private void Out(PlayerActionEvent caller) {}
|
|
|
|
private void Clap(bool just)
|
|
{
|
|
game.emoCounter = 2;
|
|
if (just)
|
|
{
|
|
clapEffect.SetActive(true);
|
|
Jukebox.PlayOneShotGame("clappyTrio/rightClap");
|
|
|
|
if (this.canHit)
|
|
game.playerHitLast = true;
|
|
}
|
|
else
|
|
{
|
|
clapEffect.SetActive(false);
|
|
Jukebox.PlayOneShot("miss");
|
|
game.playerHitLast = false;
|
|
game.missed = true;
|
|
|
|
if (clapStarted)
|
|
this.canHit = false;
|
|
}
|
|
|
|
clapStarted = false;
|
|
game.SetFace(game.Lion.Count - 1, 4);
|
|
this.GetComponent<Animator>().Play("Clap", 0, 0);
|
|
}
|
|
}
|
|
} |