mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-12-01 22:07:31 +00:00
8fa4d74096
* add mouse controller * support different control styles in options deprecate old input check methods * fully functional input actions system * btsds InputAction * blue bear InputAction * more games fix bugs with some input related systems * coin toss re-toss * cheer readers touch * dog ninja touch * multiple games * last of the easy games' touch * more specialized games * specialized games 2 * finish ktb games * remove legacy settings disclaimer * "only" two games left * karate man touch * rockers touch still needs fixes and bad judge strum * DSGuy flicking animation * playstyle chart property * improve performance of minigame preloading * improve look of cursor make assetbundles use chunk-based compression refactor assetbundle loading methods a bit * prime conductor stream playback to stabilize seeking operations * fix air rally swing on pad release * use virtual mouse pointer * add UniTask * make BeatAction use UniTask * implement UniTask to replace some coroutines * add touch style UI elements and effects games now support the ability to define two cursor colours if they need split screen touch inputs * update plugins and buildscript * implement thresholded pointer position clipping * fix clamping * instant show / hide fix discord game SDK crashes
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 double 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.GetIsAction(ClappyTrio.InputAction_BasicPress) && !game.IsExpectingInputNow(ClappyTrio.InputAction_BasicPress.inputLockCategory))
|
|
{
|
|
Clap(false);
|
|
game.ScoreMiss();
|
|
}
|
|
}
|
|
|
|
public void QueueClap(double startBeat, float length)
|
|
{
|
|
lastClapBeat = startBeat;
|
|
lastClapLength = length;
|
|
|
|
game.ScheduleInput(startBeat, length, ClappyTrio.InputAction_BasicPress, 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);
|
|
SoundByte.PlayOneShotGame("clappyTrio/rightClap");
|
|
}
|
|
else
|
|
{
|
|
clapEffect.SetActive(false);
|
|
SoundByte.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);
|
|
}
|
|
}
|
|
} |