HeavenStudioPlus/Assets/Scripts/Games/MunchyMonk/Dumpling.cs

101 lines
3.5 KiB
C#
Raw Normal View History

Munchy Monk (#361) * munchy * prefab set up * fixes * all the stuff is there * add scripts and such ok ev u animate away now * animations * eat anim fixes * set up the stuff for arm animation + temp sfx i edited the eat animation to be a little longer so that it doesn't blush inbetween inputs but i think it's fine * basically everything should be ready to animate yes * more anims * just a few things not that much !!!! * fixed anims * t two snap working + sfx + dumpling color title. made lotsa progress, it's looking way better * animations more * idk!!! it's some stuff. but im going to bed now * different colored smears + animators for dumplings * all animations + sprite fixes * oops fixed stare * oops 2 * assigned the animator + just a bunch a' stuff * All anims!! stache and brow stuff * i go to bed now :sleeping: * barelies are working pretty well * very early hits seem to be working on everything but the two twos -it's temporarily disabled cause the ScheduleInput doesn't play nice with it * added starpelly's SuperScroll script * stare and blush blocks * modifier block -only functions to disable the baby for now, will do stuff to how the mustache works in the near future * changed all cues to be prefunctions that queue up a main cue so that they can be called outside of the game for whatever reason the FollowHand animation just doesn't wanna play. everything else does! but not the arguably most important one. * Oops * ymf pls help meee :sob: * Fixed two two dumpling anim not playing * Fixed smear * smear animation + monk animation block ev do ur magic * oops didn't save * smear fix * general progress, barelies, whateva * pushing stuff for new unity edition * monk move block * fix dumplings spawning in editor scene instead of munchy monk prefab(?) --------- Co-authored-by: ev <85412919+evdial@users.noreply.github.com> Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
2023-03-27 02:26:11 +00:00
using HeavenStudio.Util;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
namespace HeavenStudio.Games.Scripts_MunchyMonk
{
public class Dumpling : MonoBehaviour
Munchy Monk (#361) * munchy * prefab set up * fixes * all the stuff is there * add scripts and such ok ev u animate away now * animations * eat anim fixes * set up the stuff for arm animation + temp sfx i edited the eat animation to be a little longer so that it doesn't blush inbetween inputs but i think it's fine * basically everything should be ready to animate yes * more anims * just a few things not that much !!!! * fixed anims * t two snap working + sfx + dumpling color title. made lotsa progress, it's looking way better * animations more * idk!!! it's some stuff. but im going to bed now * different colored smears + animators for dumplings * all animations + sprite fixes * oops fixed stare * oops 2 * assigned the animator + just a bunch a' stuff * All anims!! stache and brow stuff * i go to bed now :sleeping: * barelies are working pretty well * very early hits seem to be working on everything but the two twos -it's temporarily disabled cause the ScheduleInput doesn't play nice with it * added starpelly's SuperScroll script * stare and blush blocks * modifier block -only functions to disable the baby for now, will do stuff to how the mustache works in the near future * changed all cues to be prefunctions that queue up a main cue so that they can be called outside of the game for whatever reason the FollowHand animation just doesn't wanna play. everything else does! but not the arguably most important one. * Oops * ymf pls help meee :sob: * Fixed two two dumpling anim not playing * Fixed smear * smear animation + monk animation block ev do ur magic * oops didn't save * smear fix * general progress, barelies, whateva * pushing stuff for new unity edition * monk move block * fix dumplings spawning in editor scene instead of munchy monk prefab(?) --------- Co-authored-by: ev <85412919+evdial@users.noreply.github.com> Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
2023-03-27 02:26:11 +00:00
{
public Animator otherAnim;
public float startBeat;
public float type;
const string sfxName = "munchyMonk/";
private bool canDestroy;
[Header("References")]
[SerializeField] Animator smearAnim;
[SerializeField] Animator anim;
private MunchyMonk game;
private void Awake()
{
game = MunchyMonk.instance;
game.firstTwoMissed = false;
}
private void Start()
{
if (type == 1f || type == 3f) {
game.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN, Hit, Miss, Early);
} else if (type >= 3.5f) {
game.ScheduleInput(startBeat, 0.75f, InputType.STANDARD_DOWN, Hit, Miss, Early);
} else {
game.ScheduleInput(startBeat, type == 2f ? 1.5f : 2f, InputType.STANDARD_DOWN, Hit, Miss, Early);
}
}
private void Update()
{
if ((!Conductor.instance.isPlaying && !Conductor.instance.isPaused) || GameManager.instance.currentGame != "munchyMonk") {
GameObject.Destroy(gameObject);
}
if (canDestroy && anim.IsAnimationNotPlaying()) GameObject.Destroy(gameObject);
}
private void Hit(PlayerActionEvent caller, float state)
{
if (!canDestroy) {
game.MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"slap");
game.isStaring = false;
if (state >= 1f || state <= -1f)
{
game.MonkAnim.DoScaledAnimationAsync("Barely", 0.5f);
anim.DoScaledAnimationAsync("HitHead", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"barely");
canDestroy = true;
} else {
game.MonkAnim.DoScaledAnimationAsync("Eat", 0.4f);
if (type == 2) otherAnim.DoScaledAnimationAsync("FollowHand", 0.5f);
smearAnim.Play("SmearAppear", 0, 0);
game.needBlush = true;
Jukebox.PlayOneShotGame(sfxName+"gulp");
if (game.forceGrow) game.growLevel += 1;
GameObject.Destroy(gameObject);
}
}
}
private void Miss(PlayerActionEvent caller)
{
if (!canDestroy) {
anim.DoScaledAnimationAsync("FallOff", 0.5f);
canDestroy = true;
}
}
private void Early(PlayerActionEvent caller)
{
if (!(type == 2.5f) || game.firstTwoMissed) {
game.MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f);
game.MonkAnim.DoScaledAnimationAsync("Miss", 0.5f);
smearAnim.Play("SmearAppear", 0, 0);
anim.DoScaledAnimationAsync("HitHead", 0.5f);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxName+"slap", game.lastReportedBeat),
new MultiSound.Sound(sfxName+"miss", game.lastReportedBeat),
});
canDestroy = true;
game.needBlush = false;
game.firstTwoMissed = true;
}
}
}
}