mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-26 19:43:01 +00:00
7ed0e3fafc
* Ringside fixes * Clappy Trio bop logic fix * Quiz show answer reaction fix * prequel background begone! * You can now hide the alien in spaceball * Fixed lightning toss jank * btsds recolor, need to add lights next * Btsds lights and recolor * fixed sweat particle rendering over reporter * Asset bundles accomodation
89 lines
No EOL
2.3 KiB
C#
89 lines
No EOL
2.3 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.misses++;
|
|
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");
|
|
}
|
|
else
|
|
{
|
|
clapEffect.SetActive(false);
|
|
Jukebox.PlayOneShot("miss");
|
|
game.misses++;
|
|
|
|
if (clapStarted)
|
|
this.canHit = false;
|
|
}
|
|
|
|
clapStarted = false;
|
|
game.SetFace(game.Lion.Count - 1, 4);
|
|
this.GetComponent<Animator>().Play("Clap", 0, 0);
|
|
}
|
|
}
|
|
} |