HeavenStudioPlus/Assets/Scripts/Games/MeatGrinder/MeatToss.cs
AstrlJelly a206ddf400 Marching Orders Rework + Bug Fixes (#442)
* first things first, kill mr. downbeat.

now onto fixing meat grinder forrealzies

* meat grinder fix

* fixed munchy monk icon + mr upbeat ding bug

* a few little changes

* lotta stuff

yeahh just look at the pr description

* point and clap

* anim Adjustment

* new sheet + adjustments for it

* IM USING THE INTERNET

i hate merge conflicts

* grrr merge conflicts

* insane changes

* progress

* fixed The Spaceball Camera Bug (literally a single line of code wtf guys)
* colrs

* k im done :3

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
2023-06-04 04:30:42 +00:00

73 lines
2.3 KiB
C#

using HeavenStudio.Util;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
namespace HeavenStudio.Games.Scripts_MeatGrinder
{
public class MeatToss : MonoBehaviour
{
public float startBeat;
public float cueLength;
public bool cueBased;
public string meatType;
[Header("Animators")]
private Animator anim;
private MeatGrinder game;
private void Awake()
{
game = MeatGrinder.instance;
anim = GetComponent<Animator>();
}
private void Start()
{
game.ScheduleInput(startBeat, cueLength, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Hit, Miss, Nothing);
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(cueBased ? startBeat + 0.66f : cueLength + startBeat - 1 + 0.66f, delegate {
anim.DoScaledAnimationAsync(meatType+"Thrown", 0.32f);
}),
});
}
private void Update()
{
if (anim.IsPlayingAnimationName("DarkIdle") || anim.IsPlayingAnimationName("LightIdle")) GameObject.Destroy(gameObject);
}
private void InputActions(bool annoyBoss, string whichSfx, string whichAnim)
{
game.bossAnnoyed = annoyBoss;
Jukebox.PlayOneShotGame("meatGrinder/"+whichSfx);
game.TackAnim.DoScaledAnimationAsync(whichAnim, 0.5f);
}
private void Hit(PlayerActionEvent caller, float state)
{
game.TackAnim.SetBool("tackMeated", false);
anim.DoScaledAnimationAsync(meatType+"Hit", 0.5f);
if (state >= 1f || state <= -1f) {
InputActions(true, "tink", "TackHitBarely");
} else {
InputActions(false, "meatHit", "TackHitSuccess");
}
}
private void Miss(PlayerActionEvent caller)
{
GameObject.Destroy(gameObject);
InputActions(true, "miss", "TackMiss"+meatType);
game.BossAnim.DoScaledAnimationAsync("BossMiss", 0.5f);
game.TackAnim.SetBool("tackMeated", true);
}
private void Nothing(PlayerActionEvent caller) { }
}
}