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

70 lines
2.6 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;
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<DynamicBeatmap.DynamicEntity> allFlickEntities = new List<DynamicBeatmap.DynamicEntity>();
public int currentFlickIndex;
private void Awake()
2021-12-21 01:10:49 +00:00
{
var flickEntities = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "flick" });
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
for (int i = 0; i < flickEntities.Count; i++)
{
if (flickEntities[i].beat >= Conductor.instance.songPositionInBeats)
{
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()
{
2021-12-23 22:39:03 +00:00
Jukebox.PlayOneShotGame("forkLifter/flickPrepare");
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
2021-12-21 01:10:49 +00:00
}
}
}