2021-12-21 01:10:49 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
using RhythmHeavenMania.Util;
|
|
|
|
|
|
|
|
namespace RhythmHeavenMania.Games.ForkLifter
|
|
|
|
{
|
2022-01-17 05:00:26 +00:00
|
|
|
public class Pea : PlayerActionObject
|
2021-12-21 01:10:49 +00:00
|
|
|
{
|
|
|
|
private Animator anim;
|
|
|
|
|
|
|
|
public float startBeat;
|
|
|
|
|
|
|
|
public int type;
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
anim = GetComponent<Animator>();
|
2021-12-23 22:39:03 +00:00
|
|
|
Jukebox.PlayOneShotGame("forkLifter/zoom");
|
2021-12-21 01:10:49 +00:00
|
|
|
GetComponentInChildren<SpriteRenderer>().sprite = ForkLifter.instance.peaSprites[type];
|
|
|
|
|
|
|
|
for (int i = 0; i < transform.GetChild(0).childCount; i++)
|
|
|
|
{
|
|
|
|
transform.GetChild(0).GetChild(i).GetComponent<SpriteRenderer>().sprite = transform.GetChild(0).GetComponent<SpriteRenderer>().sprite;
|
|
|
|
}
|
2022-01-17 05:00:26 +00:00
|
|
|
|
|
|
|
PlayerActionInit(this.gameObject, startBeat, ForkLifter.instance.EligibleHits);
|
|
|
|
|
|
|
|
isEligible = true;
|
2021-12-21 01:10:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
2021-12-25 02:37:03 +00:00
|
|
|
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.5f);
|
2021-12-24 23:41:35 +00:00
|
|
|
anim.Play("Flicked_Object", -1, normalizedBeatAnim);
|
2021-12-21 01:10:49 +00:00
|
|
|
anim.speed = 0;
|
|
|
|
|
2021-12-25 02:37:03 +00:00
|
|
|
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2f);
|
2021-12-24 23:41:35 +00:00
|
|
|
|
2022-01-17 05:00:26 +00:00
|
|
|
StateCheck(normalizedBeat);
|
2021-12-21 01:10:49 +00:00
|
|
|
|
|
|
|
if (normalizedBeat > 1.35f)
|
|
|
|
{
|
2022-01-17 05:00:26 +00:00
|
|
|
Jukebox.PlayOneShot("audience/disappointed");
|
2021-12-21 01:10:49 +00:00
|
|
|
Destroy(this.gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|