mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-13 05:05:08 +00:00
60 lines
No EOL
1.3 KiB
C#
60 lines
No EOL
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_CoinToss
|
|
{
|
|
public class Coin : PlayerActionObject
|
|
{
|
|
public float startBeat;
|
|
|
|
public bool audienceReacting;
|
|
|
|
void Awake()
|
|
{
|
|
PlayerActionInit(this.gameObject, startBeat);
|
|
}
|
|
|
|
public override void OnAce()
|
|
{
|
|
Hit();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (Conductor.instance.GetPositionFromBeat(startBeat, 1f) >= 6.3f)
|
|
MissCoin();
|
|
|
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 6f);
|
|
StateCheck(normalizedBeat);
|
|
|
|
if (PlayerInput.Pressed())
|
|
{
|
|
if (state.perfect)
|
|
{
|
|
Hit();
|
|
} else
|
|
{
|
|
CoinToss.instance.Catch_Empty();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Hit()
|
|
{
|
|
if(CoinToss.instance.isThrowing)
|
|
{
|
|
CoinToss.instance.Catch_Success(audienceReacting);
|
|
Destroy(this.gameObject);
|
|
}
|
|
}
|
|
|
|
public void MissCoin()
|
|
{
|
|
CoinToss.instance.Catch_Miss(audienceReacting);
|
|
Destroy(this.gameObject);
|
|
}
|
|
}
|
|
} |