mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:47:37 +02:00
Tweezers: Plucking animation additions. Autoplay support.
This commit is contained in:
@ -1,14 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||
{
|
||||
public class Hair : PlayerActionObject
|
||||
{
|
||||
public float createBeat;
|
||||
public GameObject hairSprite;
|
||||
public GameObject stubbleSprite;
|
||||
public GameObject missedSprite;
|
||||
private RhythmTweezers game;
|
||||
private Tweezers tweezers;
|
||||
private bool plucked;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -18,23 +23,41 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float stateBeat = Conductor.instance.GetPositionFromBeat(createBeat + game.tweezerBeatOffset, game.beatInterval);
|
||||
if (plucked) return;
|
||||
|
||||
float stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval, 1f);
|
||||
StateCheck(stateBeat);
|
||||
|
||||
if (PlayerInput.Pressed() && tweezers.hitOnFrame == 0)
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Ace();
|
||||
}
|
||||
else if (state.notPerfect())
|
||||
{
|
||||
Miss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Ace()
|
||||
{
|
||||
tweezers.Pluck(true, this);
|
||||
|
||||
tweezers.hitOnFrame++;
|
||||
plucked = true;
|
||||
}
|
||||
|
||||
public void Miss()
|
||||
{
|
||||
tweezers.Pluck(false, this);
|
||||
tweezers.hitOnFrame++;
|
||||
plucked = true;
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Ace();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user