2021-12-21 01:10:49 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2023-06-10 19:17:06 +00:00
|
|
|
using Jukebox;
|
|
|
|
using Jukebox.Legacy;
|
2021-12-21 01:10:49 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Games.Scripts_ForkLifter
|
2021-12-21 01:10:49 +00:00
|
|
|
{
|
|
|
|
public class ForkLifterHand : MonoBehaviour
|
|
|
|
{
|
|
|
|
public SpriteRenderer fastSprite;
|
|
|
|
|
|
|
|
public Sprite[] fastSprites;
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
private List<RiqEntity> allFlickEntities = new List<RiqEntity>();
|
2023-04-23 20:17:21 +00:00
|
|
|
|
|
|
|
public int currentFlickIndex;
|
|
|
|
|
|
|
|
private void Awake()
|
2021-12-21 01:10:49 +00:00
|
|
|
{
|
2023-04-23 20:17:21 +00:00
|
|
|
var flickEntities = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "flick" });
|
2023-06-10 19:17:06 +00:00
|
|
|
List<RiqEntity> tempEvents = new List<RiqEntity>();
|
2023-04-23 20:17:21 +00:00
|
|
|
for (int i = 0; i < flickEntities.Count; i++)
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
if (flickEntities[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
|
2023-04-23 20:17:21 +00:00
|
|
|
{
|
|
|
|
tempEvents.Add(flickEntities[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
allFlickEntities = tempEvents;
|
|
|
|
}
|
2021-12-21 01:10:49 +00:00
|
|
|
|
2023-04-23 20:17:21 +00:00
|
|
|
public void CheckNextFlick()
|
|
|
|
{
|
|
|
|
if (allFlickEntities.Count > 0 && currentFlickIndex >= 0 && currentFlickIndex < allFlickEntities.Count)
|
2021-12-21 01:10:49 +00:00
|
|
|
{
|
2023-04-23 20:17:21 +00:00
|
|
|
switch (allFlickEntities[currentFlickIndex]["type"])
|
2021-12-21 01:10:49 +00:00
|
|
|
{
|
2023-04-23 20:17:21 +00:00
|
|
|
case (int)ForkLifter.FlickType.Pea:
|
2021-12-21 01:10:49 +00:00
|
|
|
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0];
|
|
|
|
fastSprite.sprite = fastSprites[0];
|
|
|
|
break;
|
2023-04-23 20:17:21 +00:00
|
|
|
case (int)ForkLifter.FlickType.TopBun:
|
2021-12-21 01:10:49 +00:00
|
|
|
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1];
|
2021-12-24 03:36:16 +00:00
|
|
|
fastSprite.sprite = fastSprites[0];
|
2021-12-21 01:10:49 +00:00
|
|
|
break;
|
2023-04-23 20:17:21 +00:00
|
|
|
case (int)ForkLifter.FlickType.Burger:
|
2021-12-21 01:10:49 +00:00
|
|
|
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2];
|
2021-12-24 03:36:16 +00:00
|
|
|
fastSprite.sprite = fastSprites[1];
|
2021-12-21 01:10:49 +00:00
|
|
|
break;
|
2023-04-23 20:17:21 +00:00
|
|
|
case (int)ForkLifter.FlickType.BottomBun:
|
2021-12-21 01:10:49 +00:00
|
|
|
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3];
|
2021-12-24 03:36:16 +00:00
|
|
|
fastSprite.sprite = fastSprites[0];
|
2021-12-21 01:10:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ForkLifter.instance.peaPreview.sprite = null;
|
2023-04-23 20:17:21 +00:00
|
|
|
}
|
2021-12-21 01:10:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Prepare()
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SoundByte.PlayOneShotGame("forkLifter/flickPrepare");
|
2021-12-26 01:04:23 +00:00
|
|
|
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
|
2021-12-21 01:10:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|