2022-03-04 22:03:57 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using System;
|
|
|
|
using Starpelly;
|
2023-05-15 19:52:41 +00:00
|
|
|
using TMPro;
|
2022-03-04 22:03:57 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2022-03-04 22:03:57 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Games.Scripts_MrUpbeat
|
2022-03-04 22:03:57 +00:00
|
|
|
{
|
2022-03-06 19:37:50 +00:00
|
|
|
public class UpbeatMan : MonoBehaviour
|
2022-03-04 22:03:57 +00:00
|
|
|
{
|
|
|
|
[Header("References")]
|
2023-05-15 19:52:41 +00:00
|
|
|
[SerializeField] Animator anim;
|
|
|
|
[SerializeField] Animator blipAnim;
|
|
|
|
[SerializeField] Animator letterAnim;
|
|
|
|
[SerializeField] GameObject[] shadows;
|
|
|
|
[SerializeField] TMP_Text blipText;
|
2022-03-04 22:03:57 +00:00
|
|
|
|
|
|
|
public int stepTimes = 0;
|
2023-05-15 19:52:41 +00:00
|
|
|
public int blipSize = 0;
|
2023-06-04 04:30:42 +00:00
|
|
|
public bool shouldGrow;
|
2023-05-15 19:52:41 +00:00
|
|
|
public string blipString = "M";
|
2022-03-04 22:03:57 +00:00
|
|
|
|
2023-05-15 19:52:41 +00:00
|
|
|
public void Blip()
|
2022-03-04 22:03:57 +00:00
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
double c = Conductor.instance.songPositionInBeatsAsDouble;
|
2023-05-15 19:52:41 +00:00
|
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>() {
|
2023-06-10 19:17:06 +00:00
|
|
|
new BeatAction.Action(Math.Floor(c) + 0.5f, delegate {
|
2023-05-15 19:52:41 +00:00
|
|
|
if (MrUpbeat.shouldBlip) {
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("mrUpbeat/blip");
|
2023-05-15 19:52:41 +00:00
|
|
|
blipAnim.Play("Blip"+(blipSize+1), 0, 0);
|
|
|
|
blipText.text = (blipSize == 4 && blipString != "") ? blipString : "";
|
2023-06-04 04:30:42 +00:00
|
|
|
if (shouldGrow && blipSize < 4) blipSize++;
|
2023-05-15 19:52:41 +00:00
|
|
|
}
|
|
|
|
}),
|
2023-06-10 19:17:06 +00:00
|
|
|
new BeatAction.Action(Math.Floor(c) + 1f, delegate {
|
2023-05-15 19:52:41 +00:00
|
|
|
Blip();
|
|
|
|
}),
|
|
|
|
});
|
2022-03-04 22:03:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Step()
|
|
|
|
{
|
|
|
|
stepTimes++;
|
2023-05-15 19:52:41 +00:00
|
|
|
|
|
|
|
bool x = (stepTimes % 2 == 1);
|
|
|
|
shadows[0].SetActive(!x);
|
|
|
|
shadows[1].SetActive(x);
|
|
|
|
transform.localScale = new Vector3(x ? -1 : 1, 1);
|
2022-03-04 22:03:57 +00:00
|
|
|
|
2023-05-15 19:52:41 +00:00
|
|
|
anim.DoScaledAnimationAsync("Step", 0.5f);
|
|
|
|
letterAnim.DoScaledAnimationAsync(x ? "StepRight" : "StepLeft", 0.5f);
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("mrUpbeat/step");
|
2022-03-04 22:03:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Fall()
|
|
|
|
{
|
2023-05-15 19:52:41 +00:00
|
|
|
blipSize = 0;
|
|
|
|
blipAnim.Play("Idle", 0, 0);
|
|
|
|
blipText.text = "";
|
|
|
|
|
|
|
|
anim.DoScaledAnimationAsync("Fall", 0.5f);
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShot("miss");
|
2022-03-06 19:37:50 +00:00
|
|
|
shadows[0].SetActive(false);
|
|
|
|
shadows[1].SetActive(false);
|
|
|
|
}
|
2022-03-04 22:03:57 +00:00
|
|
|
}
|
|
|
|
}
|