mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:27:40 +02:00
Added Tap, Double Tap, and Triple Tap to Tap Trial
All perfectly playable :) Hopefully this is up to standards with the other games I just wanted to do this to prove to myself that I could LOL
This commit is contained in:
62
Assets/Scripts/Games/TapTrial/Tap.cs
Normal file
62
Assets/Scripts/Games/TapTrial/Tap.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
|
||||
namespace RhythmHeavenMania.Games.TapTrial
|
||||
{
|
||||
public class Tap : PlayerActionObject
|
||||
{
|
||||
public float startBeat;
|
||||
|
||||
public int type;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
PlayerActionInit(this.gameObject, startBeat);
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Hit(true);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Conductor.instance.GetPositionFromBeat(startBeat, 2) >= 1)
|
||||
CleanUp();
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1f);
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if(PlayerInput.Pressed())
|
||||
{
|
||||
if(state.perfect)
|
||||
{
|
||||
Hit(true);
|
||||
}
|
||||
else if(state.notPerfect())
|
||||
{
|
||||
Hit(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Hit(bool hit)
|
||||
{
|
||||
TapTrial.instance.player.Tap(hit, type);
|
||||
|
||||
if (hit)
|
||||
CleanUp();
|
||||
}
|
||||
|
||||
public void CleanUp()
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user