2023-02-23 00:25:14 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
using NaughtyBezierCurves;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_MeatGrinder
|
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
public class MeatToss : MonoBehaviour
|
2023-02-23 00:25:14 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
public double startBeat;
|
|
|
|
public double cueLength;
|
2023-02-23 00:25:14 +00:00
|
|
|
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()
|
|
|
|
{
|
2023-10-29 19:44:47 +00:00
|
|
|
game.ScheduleInput(startBeat, cueLength, MeatGrinder.InputAction_Press, Hit, Miss, Nothing);
|
2023-02-23 00:25:14 +00:00
|
|
|
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(this, new List<BeatAction.Action>() {
|
2023-05-07 04:45:44 +00:00
|
|
|
new BeatAction.Action(cueBased ? startBeat + 0.66f : cueLength + startBeat - 1 + 0.66f, delegate {
|
|
|
|
anim.DoScaledAnimationAsync(meatType+"Thrown", 0.32f);
|
|
|
|
}),
|
2023-02-23 00:25:14 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
2023-12-06 01:59:36 +00:00
|
|
|
if (anim.IsPlayingAnimationNames("DarkIdle") || anim.IsPlayingAnimationNames("LightIdle")) GameObject.Destroy(gameObject);
|
2023-02-23 00:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void InputActions(bool annoyBoss, string whichSfx, string whichAnim)
|
|
|
|
{
|
|
|
|
game.bossAnnoyed = annoyBoss;
|
2023-06-10 19:13:29 +00:00
|
|
|
SoundByte.PlayOneShotGame("meatGrinder/"+whichSfx);
|
2023-02-23 00:25:14 +00:00
|
|
|
game.TackAnim.DoScaledAnimationAsync(whichAnim, 0.5f);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Hit(PlayerActionEvent caller, float state)
|
|
|
|
{
|
|
|
|
game.TackAnim.SetBool("tackMeated", false);
|
|
|
|
anim.DoScaledAnimationAsync(meatType+"Hit", 0.5f);
|
|
|
|
|
2023-05-07 04:45:44 +00:00
|
|
|
if (state >= 1f || state <= -1f) {
|
2023-02-23 00:25:14 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2023-05-07 04:45:44 +00:00
|
|
|
private void Nothing(PlayerActionEvent caller) { }
|
2023-02-23 00:25:14 +00:00
|
|
|
}
|
|
|
|
}
|