HeavenStudioPlus/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs

72 lines
2.5 KiB
C#
Raw Normal View History

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;
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;
private List<RiqEntity> allFlickEntities = new List<RiqEntity>();
public int currentFlickIndex;
private void Awake()
2021-12-21 01:10:49 +00:00
{
var flickEntities = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "flick" });
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < flickEntities.Count; i++)
{
if (flickEntities[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(flickEntities[i]);
}
}
allFlickEntities = tempEvents;
}
2021-12-21 01:10:49 +00:00
public void CheckNextFlick()
{
if (allFlickEntities.Count > 0 && currentFlickIndex >= 0 && currentFlickIndex < allFlickEntities.Count)
2021-12-21 01:10:49 +00:00
{
switch (allFlickEntities[currentFlickIndex]["type"])
2021-12-21 01:10:49 +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;
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;
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;
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;
}
2021-12-21 01:10:49 +00:00
}
public void Prepare()
{
SoundByte.PlayOneShotGame("forkLifter/flickPrepare");
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
2021-12-21 01:10:49 +00:00
}
}
}