HeavenStudioPlus/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs
AstrlJelly cdf2c88c35 Bug Fixes + Small Additions (#412)
* lotta stuffs

* dj school bug fixed
* dog ninja overhauled AGAIN. you can start a cue outside of the game now (something i planned months ago lol)
* also two objects will not overlap when they're the same but when they're not the same they will overlap
* commiting cause im gonna try half-recoding meat grinder
* also im trying to fix mrupbeat's beeping cuz oh my god how is this not fixed yet

* meat grinder finished + tap trial bug fixed + mute dog ninja

MUTE DOG NINJA ONLY WHEN INACTIVE ‼️

* last minute stuff + mr upbeat

i will be reworking mr upbeat in another branch but i wanna not bloat this pr any further so bleehhhh :P

* dj school final bug fix
2023-05-07 04:45:44 +00:00

70 lines
No EOL
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Starpelly;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_MrUpbeat
{
public class UpbeatMan : MonoBehaviour
{
[Header("References")]
public MrUpbeat game;
public Animator animator;
public Animator blipAnimator;
public GameObject[] shadows;
public float targetBeat = 0.25f;
public int stepTimes = 0;
private bool stepped = false;
private bool onGround = false;
public GameEvent blip = new GameEvent();
public void Idle()
{
stepTimes = 0;
transform.localScale = new Vector3(1, 1);
animator.Play("Idle", 0, 0);
}
public void Step()
{
stepTimes++;
animator.Play("Step", 0, 0);
Jukebox.PlayOneShotGame("mrUpbeat/step");
onGround = false;
CheckShadows();
}
public void Fall()
{
animator.Play("Fall", 0, 0);
Jukebox.PlayOneShot("miss");
shadows[0].SetActive(false);
shadows[1].SetActive(false);
onGround = true;
}
private void CheckShadows()
{
if (onGround) return;
if (stepTimes % 2 == 1)
{
shadows[0].SetActive(false);
shadows[1].SetActive(true);
transform.localScale = new Vector3(-1, 1);
} else
{
shadows[0].SetActive(true);
shadows[1].SetActive(false);
transform.localScale = new Vector3(1, 1);
}
}
}
}