HeavenStudioPlus/Assets/Scripts/Games/MeatGrinder/MeatToss.cs
AstrlJelly 6cd08f1b5d Meat Grinder (#314)
* meat grinder prefab + sprite cutting/naming done + icon

title :)

* Boss Bop, Miss, & Signal Anims

can you read

* Boss Call Anim

self-explanatory

* fix the z axis + new sprite

still working on getting those bops working. they're a bit weird (not the anim itself)

* Restored Meat Grinder Animations

i have no idea what just happened with github but the animations are back

* All Tack Animations Complete

just missing the meat anims

* Literally two lines changed

skull emoji (forgot to set the light meat for the miss anim to inactive by default)

* Meat Grinder Anims (should be) Done

Added the Meat Hit anims

* goodnight

* bopping every beat
* tons of sfx
* meat calls with their corresponding sfx/animations have been added
* prefunctions...

* inputs + sfx + prefunction

making swift progress here :)

* little commit

more cues and animation stuff so that i can have new animations

* Meat Toss Anims

also fixed up some of tack's hit anims to make the smear more consistent

* night night

* moved all the meat stuff to a new script
 -this should help with instantiating the meat
* animations are a bit more comprehensive
* man, barelies are way easier than i thought they were gonna be

* instantiating works now

committing to work on my pc instead of my laptop

but i have been getting a lot done with the meat! it's just that most of that stuff is learning what i can't do...

* Boss Animation Tweaks

Adjusted Boss' bop and miss animations

* woohoo animation!

hi sean this is for u. tell me anything to tweak :)

* Quick Meat Toss Anim Fix

Prevents meat from playing the toss animation twice

* meat hit animation works!

sometimes there's a frame where the first frame of its animation pops up but i should be able to fix that

also just general improvements + framework for different meats

* it's done! or at least out of wip!

* you can select which meat type is tossed (defaults to random)
* ghost meat has been busted (it looped back to its first frame of anim sometimes right before being destroyed; i just added a single frame idle.)
* overall just optimized code
* removed WIP from game name

* a few touch-ups

* change all sfx to ogg
 -also amplified toss.ogg by 4db, was hard to hear at the same time as hitting a cue
* fixed boss not bopping a beat after a signal
 -a very small bit hacky but it really works fine. will fix if any problems come up (but i added a check so that there shouldn't be)

* i have stashed changes :P

* new bg + remove references

title

* boss weird bopping fixed + game switches fixed

* final touch-ups

---------

Co-authored-by: Seanski2 <seanbenedit@gmail.com>
2023-02-23 00:25:14 +00:00

87 lines
2.6 KiB
C#

using HeavenStudio.Util;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
namespace HeavenStudio.Games.Scripts_MeatGrinder
{
public class MeatToss : PlayerActionObject
{
public float startBeat;
public float cueLength;
public bool cueBased;
public string meatType;
bool animCheck = false;
[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, 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 (GameManager.instance.currentGame != "meatGrinder") {
GameObject.Destroy(gameObject);
}
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused) {
GameObject.Destroy(gameObject);
}
if (anim.IsAnimationNotPlaying() && animCheck) 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);
animCheck = true;
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)
{
}
}
}