Tweezers: Plucking animation additions. Autoplay support.

This commit is contained in:
Jenny Crowe
2022-02-10 04:59:20 -07:00
parent 7ee19eb3ad
commit c9ac1608e2
21 changed files with 4253 additions and 91 deletions

View File

@ -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();
}
}
}