HeavenStudioPlus/Assets/Scripts/Games/ForkLifter/ForkLifterHand.cs
Rapandrasmus 818d2c2779 Clappy Trio and Fork Lifter finished + small additions/fixes (#400)
* The funny

* Yar har har har

* 1 two tree

* Hilarious!

* procedurally spawning in stuff

* bored meeting

* A lot!

* Assistant stop added

* Added Bops

* Added Sounds

* Added miss stuff!! Only need the miss anim for the pigs!!!

* Tweaks

* Bugfixes!

* anim fix anim fix

* STRAIGHT!

* Sound offsets fixed

* added the new anims to implement

* new sheet

* loopSpin implemented

* woah

* mis stuff

* doen done done

* Various fixes

* Fixed clappy trio bop bug

* Epic tings

* Added color and screen shake

* Small things

* redid sheets a little

* Fixed burger preview

* Almost done with forklifter

* Bg color and fixed 4 peas for fork lifter

* icon

* bg stuff for tambourine and forklfiter

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
2023-04-23 20:17:21 +00:00

70 lines
No EOL
2.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_ForkLifter
{
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()
{
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;
}
public void CheckNextFlick()
{
if (allFlickEntities.Count > 0 && currentFlickIndex >= 0 && currentFlickIndex < allFlickEntities.Count)
{
switch (allFlickEntities[currentFlickIndex]["type"])
{
case (int)ForkLifter.FlickType.Pea:
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0];
fastSprite.sprite = fastSprites[0];
break;
case (int)ForkLifter.FlickType.TopBun:
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1];
fastSprite.sprite = fastSprites[0];
break;
case (int)ForkLifter.FlickType.Burger:
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2];
fastSprite.sprite = fastSprites[1];
break;
case (int)ForkLifter.FlickType.BottomBun:
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3];
fastSprite.sprite = fastSprites[0];
break;
}
}
else
{
ForkLifter.instance.peaPreview.sprite = null;
}
}
public void Prepare()
{
Jukebox.PlayOneShotGame("forkLifter/flickPrepare");
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
}
}
}