3002e48350
* 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
86 lines
2.6 KiB
C#
86 lines
2.6 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_MrUpbeat
|
|
{
|
|
public class UpbeatMan : MonoBehaviour
|
|
{
|
|
[Header("References")]
|
|
[SerializeField] Animator anim;
|
|
[SerializeField] Animator blipAnim;
|
|
[SerializeField] GameObject[] shadows;
|
|
[SerializeField] TMP_Text blipText;
|
|
|
|
public int blipSize = 0;
|
|
public bool shouldGrow;
|
|
public bool shouldBlip = true;
|
|
public string blipString = "M";
|
|
|
|
static MrUpbeat game;
|
|
|
|
void Awake()
|
|
{
|
|
game = MrUpbeat.instance;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
blipText.transform.localScale = Vector3.one;
|
|
|
|
if (PlayerInput.GetIsAction(MrUpbeat.InputAction_BasicPress) && !game.IsExpectingInputNow(MrUpbeat.InputAction_BasicPress)) {
|
|
Step(true);
|
|
}
|
|
}
|
|
|
|
public void RecursiveBlipping(double beat)
|
|
{
|
|
if (game.stopBlipping) {
|
|
game.stopBlipping = false;
|
|
return;
|
|
}
|
|
if (shouldBlip) {
|
|
Blipping(beat);
|
|
}
|
|
BeatAction.New(this, new List<BeatAction.Action>() {
|
|
new BeatAction.Action(beat + 1, delegate { RecursiveBlipping(beat + 1); })
|
|
});
|
|
}
|
|
|
|
public void Blipping(double beat)
|
|
{
|
|
SoundByte.PlayOneShotGame("mrUpbeat/blip");
|
|
blipAnim.Play("Blip"+(blipSize+1), 0, 0);
|
|
blipText.text = (blipSize == 4 && blipString != "") ? blipString : "";
|
|
if (shouldGrow && blipSize < 4) blipSize++;
|
|
}
|
|
|
|
public void Step(bool isInput = false)
|
|
{
|
|
if (isInput || ((game.stepIterate % 2 == 0) == IsMirrored())) {
|
|
shadows[0].SetActive(IsMirrored());
|
|
shadows[1].SetActive(!IsMirrored());
|
|
transform.localScale = new Vector3((IsMirrored() ? 1 : -1), 1, 1);
|
|
}
|
|
|
|
anim.DoScaledAnimationAsync("Step", 0.5f);
|
|
SoundByte.PlayOneShotGame("mrUpbeat/step");
|
|
}
|
|
|
|
public void Fall()
|
|
{
|
|
anim.DoScaledAnimationAsync((game.stepIterate % 2 == 0) == IsMirrored() ? "FallR" : "FallL", 1f);
|
|
SoundByte.PlayOneShot("miss");
|
|
shadows[0].SetActive(false);
|
|
shadows[1].SetActive(false);
|
|
transform.localScale = new Vector3((IsMirrored() ? 1 : -1), 1, 1);
|
|
}
|
|
|
|
bool IsMirrored()
|
|
{
|
|
return transform.localScale != Vector3.one;
|
|
}
|
|
}
|
|
} |