Tweezers:: Code cleanup

This commit is contained in:
Jenny Crowe 2022-02-08 23:52:50 -07:00
parent f2516c0ca5
commit c8087d97f6
4 changed files with 12 additions and 4 deletions

View File

@ -907,7 +907,7 @@ MonoBehaviour:
EligibleHits: []
firstEnable: 0
Vegetable: {fileID: 3177931334588542204}
Tweezers: {fileID: 3684904985109994079}
Tweezers: {fileID: 3391455012319192365}
HairsHolder: {fileID: 2002856028339003249}
tweezersBeatOffset: 2
tweezersRotOffset: {x: -202, y: 180}

View File

@ -7,13 +7,19 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
public class Hair : PlayerActionObject
{
public float createBeat;
private Tweezers tweezers;
private void Awake()
{
tweezers = RhythmTweezers.instance.Tweezers;
}
private void Update()
{
float stateBeat = Conductor.instance.GetPositionFromBeat(createBeat, 4f);
StateCheck(stateBeat);
if (PlayerInput.Pressed() && RhythmTweezers.instance.Tweezers.GetComponent<Tweezers>().hitOnFrame == 0)
if (PlayerInput.Pressed() && tweezers.hitOnFrame == 0)
{
if (state.perfect)
{
@ -24,7 +30,6 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
public void Ace()
{
Tweezers tweezers = RhythmTweezers.instance.Tweezers.GetComponent<Tweezers>();
tweezers.Pluck(true, this);
tweezers.hitOnFrame++;

View File

@ -10,7 +10,8 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
public class RhythmTweezers : Minigame
{
public GameObject Vegetable;
public GameObject Tweezers;
public Animator VegetableAnimator;
public Tweezers Tweezers;
[SerializeField] private GameObject HairsHolder;

View File

@ -10,10 +10,12 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
{
public int hitOnFrame;
private Animator anim;
private Animator vegetableAnim;
private void Start()
{
anim = GetComponent<Animator>();
vegetableAnim = RhythmTweezers.instance.VegetableAnimator;
}
private void LateUpdate()