mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 18:15:13 +00:00
a653194e07
I just moved everything that was in start to awake. There are a few other changes I made, like using init functions rather than awake in scripts that depended on something that was initialized in another script's awake (to make sure things always happen in the right order), as well as some other stuff in some specific minigames
61 lines
No EOL
1.3 KiB
C#
61 lines
No EOL
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_TapTrial
|
|
{
|
|
public class Tap : PlayerActionObject
|
|
{
|
|
public float startBeat;
|
|
|
|
public int type;
|
|
|
|
void Awake()
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
} |