HeavenStudioPlus/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs
2022-02-08 22:58:25 -05:00

42 lines
No EOL
1,001 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.RhythmTweezers
{
public class Tweezers : MonoBehaviour
{
public int hitOnFrame;
private Animator anim;
private void Start()
{
anim = GetComponent<Animator>();
}
private void LateUpdate()
{
if (PlayerInput.Pressed())
{
hitOnFrame = 0;
}
}
public void Pluck(bool ace, Hair hair)
{
anim.Play("Tweezers_Pluck", 0, 0);
if (hitOnFrame > 0) return;
// tweezer pluck anim here
if (ace)
{
RhythmTweezers.instance.Vegetable.GetComponent<Animator>().Play("Hop", 0, 0);
Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{Random.Range(1, 21)}");
Destroy(hair.gameObject);
}
}
}
}