mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 15:27:38 +02:00
Mr Upbeat Programming progress
Autoplay works but it doesn't work otherwise
This commit is contained in:
@ -12,9 +12,11 @@ namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
{
|
||||
[Header("References")]
|
||||
public GameObject metronome;
|
||||
public Animator animator;
|
||||
public Animator blipAnimator;
|
||||
public GameObject[] shadows;
|
||||
public UpbeatMan man;
|
||||
|
||||
public float nextBeat;
|
||||
public bool canGo = false;
|
||||
|
||||
|
||||
public static MrUpbeat instance;
|
||||
|
||||
@ -23,6 +25,29 @@ namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
List<Beatmap.Entity> gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go");
|
||||
for(int i=0; i<gos.Count; i++)
|
||||
{
|
||||
if ((gos[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && (gos[i].beat + gos[i].length) - 0.15f > Conductor.instance.songPositionInBeats)
|
||||
{
|
||||
canGo = true;
|
||||
break;
|
||||
} else
|
||||
{
|
||||
canGo = false;
|
||||
}
|
||||
}
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(nextBeat, 0.5f);
|
||||
//StateCheck(normalizedBeat);
|
||||
}
|
||||
|
||||
public void SetInterval(float beat)
|
||||
{
|
||||
nextBeat = beat;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
92
Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs
Normal file
92
Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.MrUpbeat
|
||||
{
|
||||
public class UpbeatMan : PlayerActionObject
|
||||
{
|
||||
[Header("References")]
|
||||
public MrUpbeat game;
|
||||
public Animator animator;
|
||||
public Animator blipAnimator;
|
||||
public GameObject[] shadows;
|
||||
|
||||
public int stepTimes = 0;
|
||||
|
||||
public GameEvent blip = new GameEvent();
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(game.nextBeat, 0.5f);
|
||||
StateCheck(normalizedBeat);
|
||||
CheckIfFall(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed(true))
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Step();
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Fall();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProgressBeat()
|
||||
{
|
||||
game.nextBeat += 1f;
|
||||
Blip();
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Step();
|
||||
}
|
||||
|
||||
public void Step()
|
||||
{
|
||||
if (!game.canGo) return;
|
||||
|
||||
stepTimes++;
|
||||
|
||||
Jukebox.PlayOneShotGame("mrUpbeat/step");
|
||||
|
||||
if (stepTimes % 2 == 1)
|
||||
transform.localScale = new Vector3(-1, 1);
|
||||
else
|
||||
transform.localScale = new Vector3(1, 1);
|
||||
|
||||
ProgressBeat();
|
||||
}
|
||||
|
||||
public void Fall()
|
||||
{
|
||||
if (!game.canGo) return;
|
||||
|
||||
Jukebox.PlayOneShot("miss");
|
||||
}
|
||||
|
||||
private void CheckIfFall(float normalizedBeat)
|
||||
{
|
||||
if (normalizedBeat > Minigame.LateTime())
|
||||
{
|
||||
Fall();
|
||||
ProgressBeat();
|
||||
}
|
||||
}
|
||||
|
||||
public void Blip()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("mrUpbeat/blip");
|
||||
blipAnimator.Play("Blip", 0, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs.meta
Normal file
11
Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4fa18aec69a2e949a7e2d4e33bdd2b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -17,6 +17,7 @@ using RhythmHeavenMania.Games.BuiltToScaleDS;
|
||||
using RhythmHeavenMania.Games.TapTrial;
|
||||
using RhythmHeavenMania.Games.CropStomp;
|
||||
using RhythmHeavenMania.Games.WizardsWaltz;
|
||||
using RhythmHeavenMania.Games.MrUpbeat;
|
||||
|
||||
namespace RhythmHeavenMania
|
||||
{
|
||||
@ -373,6 +374,10 @@ namespace RhythmHeavenMania
|
||||
new GameAction("start interval", delegate { WizardsWaltz.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
|
||||
new GameAction("plant", delegate { WizardsWaltz.instance.SpawnFlower(eventCaller.currentEntity.beat); }, 0.5f, false),
|
||||
}),
|
||||
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 Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>()
|
||||
{
|
||||
}),
|
||||
|
Reference in New Issue
Block a user