mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using System;
|
||
|
using Starpelly;
|
||
|
|
||
|
using RhythmHeavenMania.Util;
|
||
|
|
||
|
namespace RhythmHeavenMania.Games.MrUpbeat
|
||
|
{
|
||
|
public class UpbeatStep : PlayerActionObject
|
||
|
{
|
||
|
public float startBeat;
|
||
|
private bool passedFirst = false;
|
||
|
|
||
|
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)
|
||
|
{
|
||
|
if(MrUpbeat.instance.man.stepTimes % 2 != startBeat % 2)
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|