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

47 lines
1.3 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;
public List<RiqEntity> allFlickEntities = new List<RiqEntity>();
public int currentFlickIndex;
ForkLifter game;
private void Awake()
2021-12-21 01:10:49 +00:00
{
game = ForkLifter.instance;
}
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
{
int nextType = allFlickEntities[currentFlickIndex]["type"];
game.peaPreview.sprite = game.peaSprites[nextType];
fastSprite.sprite = fastSprites[nextType == (int)ForkLifter.FlickType.Burger ? 1 : 0];
} else {
game.peaPreview.sprite = null;
}
2021-12-21 01:10:49 +00:00
}
public void Prepare(bool mute)
2021-12-21 01:10:49 +00:00
{
if (!mute) SoundByte.PlayOneShotGame("forkLifter/flickPrepare");
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
2021-12-21 01:10:49 +00:00
}
}
}