2022-03-06 19:37:50 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using System;
|
|
|
|
using Starpelly;
|
|
|
|
|
|
|
|
using RhythmHeavenMania.Util;
|
|
|
|
|
2022-03-12 04:10:13 +00:00
|
|
|
namespace RhythmHeavenMania.Games.Scripts_MrUpbeat
|
2022-03-06 19:37:50 +00:00
|
|
|
{
|
|
|
|
public class UpbeatStep : PlayerActionObject
|
|
|
|
{
|
|
|
|
public float startBeat;
|
|
|
|
private bool passedFirst = false;
|
2022-03-12 01:54:05 +00:00
|
|
|
public float beatOffset = 0;
|
2022-03-06 19:37:50 +00:00
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
PlayerActionInit(gameObject, startBeat);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnAce()
|
|
|
|
{
|
|
|
|
Hit(true, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
if (Conductor.instance.GetPositionFromBeat(startBeat, 0.35f) >= 1 && !passedFirst)
|
|
|
|
{
|
2022-03-12 01:54:05 +00:00
|
|
|
if(MrUpbeat.instance.man.stepTimes % 2 != Math.Round(startBeat - beatOffset) % 2)
|
2022-03-06 19:37:50 +00:00
|
|
|
Hit(false);
|
|
|
|
passedFirst = true;
|
|
|
|
}
|
|
|
|
if (Conductor.instance.GetPositionFromBeat(startBeat, 0.65f) >= 1)
|
|
|
|
Hit(false);
|
|
|
|
|
|
|
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 0.5f);
|
|
|
|
StateCheck(normalizedBeat);
|
|
|
|
|
|
|
|
if (PlayerInput.Pressed())
|
|
|
|
{
|
|
|
|
if (state.perfect)
|
|
|
|
{
|
|
|
|
Hit(true);
|
|
|
|
} else if (state.notPerfect())
|
|
|
|
{
|
|
|
|
Hit(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Hit(bool hit, bool force = false)
|
|
|
|
{
|
|
|
|
if (force) MrUpbeat.instance.man.Step();
|
|
|
|
else if (!hit) MrUpbeat.instance.man.Fall();
|
|
|
|
|
|
|
|
CleanUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CleanUp()
|
|
|
|
{
|
|
|
|
Destroy(this.gameObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|