mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:37:40 +02:00
Slightly functional Mr. Upbeat
This commit is contained in:
@ -14,9 +14,10 @@ namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
public GameObject metronome;
|
||||
public UpbeatMan man;
|
||||
|
||||
public float nextBeat;
|
||||
public GameEvent beat = new GameEvent();
|
||||
public GameEvent offbeat = new GameEvent();
|
||||
public bool canGo = false;
|
||||
|
||||
private int beatCount = 0;
|
||||
|
||||
public static MrUpbeat instance;
|
||||
|
||||
@ -27,6 +28,11 @@ namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (canGo)
|
||||
metronome.transform.eulerAngles = new Vector3(0, 0, 270 - Mathf.Cos(Mathf.PI * Conductor.instance.songPositionInBeats) * 75);
|
||||
//else
|
||||
// metronome.transform.eulerAngles = new Vector3(0, 0, 200);
|
||||
|
||||
List<Beatmap.Entity> gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go");
|
||||
for(int i=0; i<gos.Count; i++)
|
||||
{
|
||||
@ -40,13 +46,42 @@ namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
}
|
||||
}
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(nextBeat, 0.5f);
|
||||
//StateCheck(normalizedBeat);
|
||||
if (Conductor.instance.ReportBeat(ref beat.lastReportedBeat) && canGo)
|
||||
{
|
||||
if(beatCount % 2 == 0)
|
||||
Jukebox.PlayOneShotGame("mrUpbeat/metronomeRight");
|
||||
else
|
||||
Jukebox.PlayOneShotGame("mrUpbeat/metronomeLeft");
|
||||
|
||||
beatCount++;
|
||||
}
|
||||
|
||||
if (Conductor.instance.ReportBeat(ref offbeat.lastReportedBeat, 0.25f, true))
|
||||
{
|
||||
man.Blip();
|
||||
if(canGo) man.targetBeat = offbeat.lastReportedBeat + 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGameSwitch()
|
||||
{
|
||||
base.OnGameSwitch();
|
||||
canGo = false;
|
||||
man.stepTimes = 0;
|
||||
SetInterval(0);
|
||||
}
|
||||
|
||||
public void SetInterval(float beat)
|
||||
{
|
||||
nextBeat = beat;
|
||||
beatCount = 0;
|
||||
offbeat.startBeat = beat;
|
||||
man.targetBeat = beat + 320f;
|
||||
man.Idle();
|
||||
}
|
||||
|
||||
public void Go(float beat)
|
||||
{
|
||||
beatCount = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,71 +16,81 @@ namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
public Animator blipAnimator;
|
||||
public GameObject[] shadows;
|
||||
|
||||
public float targetBeat = 0.25f;
|
||||
public int stepTimes = 0;
|
||||
private bool stepped = false;
|
||||
|
||||
public GameEvent blip = new GameEvent();
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(game.nextBeat, 0.5f);
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromMargin(targetBeat, 0.5f);
|
||||
StateCheck(normalizedBeat);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed(true))
|
||||
if(game.canGo && normalizedBeat > Minigame.LateTime())
|
||||
{
|
||||
//Fall();
|
||||
targetBeat += 100f;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Step();
|
||||
} else if (state.notPerfect())
|
||||
}
|
||||
else if(state.notPerfect())
|
||||
{
|
||||
Fall();
|
||||
}
|
||||
else
|
||||
{
|
||||
Step();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProgressBeat()
|
||||
{
|
||||
game.nextBeat += 1f;
|
||||
Blip();
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
if (!game.canGo) return;
|
||||
|
||||
Step();
|
||||
}
|
||||
|
||||
public void Idle()
|
||||
{
|
||||
stepTimes = 0;
|
||||
transform.localScale = new Vector3(1, 1);
|
||||
animator.Play("Idle", 0, 0);
|
||||
}
|
||||
|
||||
public void Step()
|
||||
{
|
||||
if (!game.canGo) return;
|
||||
|
||||
stepTimes++;
|
||||
|
||||
animator.Play("Step", 0, 0);
|
||||
Jukebox.PlayOneShotGame("mrUpbeat/step");
|
||||
|
||||
if (stepTimes % 2 == 1)
|
||||
{
|
||||
shadows[0].SetActive(false);
|
||||
shadows[1].SetActive(true);
|
||||
transform.localScale = new Vector3(-1, 1);
|
||||
else
|
||||
} else
|
||||
{
|
||||
shadows[0].SetActive(true);
|
||||
shadows[1].SetActive(false);
|
||||
transform.localScale = new Vector3(1, 1);
|
||||
|
||||
ProgressBeat();
|
||||
}
|
||||
}
|
||||
|
||||
public void Fall()
|
||||
{
|
||||
if (!game.canGo) return;
|
||||
|
||||
animator.Play("Fall", 0, 0);
|
||||
Jukebox.PlayOneShot("miss");
|
||||
}
|
||||
|
||||
private void CheckIfFall(float normalizedBeat)
|
||||
{
|
||||
if (normalizedBeat > Minigame.LateTime())
|
||||
{
|
||||
Fall();
|
||||
ProgressBeat();
|
||||
}
|
||||
}
|
||||
|
||||
public void Blip()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("mrUpbeat/blip");
|
||||
|
@ -376,7 +376,8 @@ namespace RhythmHeavenMania
|
||||
}),
|
||||
new Minigame("mrUpbeat", "Mr. Upbeat \n<color=#eb5454>[WIP don't use]</color>", "FFFFFF", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("go", delegate { }, 4f, true),
|
||||
new GameAction("prepare", delegate { MrUpbeat.instance.SetInterval(eventCaller.currentEntity.beat); }, 0.5f, true),
|
||||
new GameAction("go", delegate { MrUpbeat.instance.Go(eventCaller.currentEntity.beat); }, 4f, true),
|
||||
}),
|
||||
/*new Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>()
|
||||
{
|
||||
|
Reference in New Issue
Block a user