mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-26 03:25:22 +00:00
e1f4c0a38d
* Heh * prefab cat * minigame script + sounds imported * more catgrab * oops * functional objects non visual * More cat ghrab 2 * persist/stretchy logs + cue disable sound + sigh * finished cat grab * sdfsdfsdf * oops * Oops. * Freedom * More * more anime * anims almost dune * all anims * Oops. * Fixing bad animation * I have made a severe and continuous lapse in judgement * bear bop + cut + whiff visuals implemented * rest visuals implemented * added log visuals cut * accomadation for persist/stretch * Oops345 * CATS! * sorting layer oops * fix catgrab object being flipped * bug fix and huh choice * sorting layer fix * anim fixes * upscale almost * upscale done * Huge zoom in * left cat put * two main cats done * particles for main logs * Particles implemented * particle tweaks * bg cats placed * bg cats + zoom toggle * slide offset * more bg cat * new object sheet * bg cats final * more particle * particles fr * Oops * catdance update * I have created an Issue * fixed a lot of shit * Paricle fix * particle fix again im sorry * object upscale wip and more * Mistakes * freezer particle and tweaks * resorted * more particle nonsense im sorry everything hurts * freezer break implement * penguin fix * sorry * halves + upscales done + particles done * fixed particles * particle fixes 2000 * fixed cat dance and rest * snow * icon * oops232323 * Sigh * snow implementation * baby done * layering fix * actual layering fix * particle tweaks * windsnowshit * new rotation * rotation pivots set * all particles should be good now * bat fix * bg cats work better * miss implemented * layer arm fix * rotation changed * expose camera ease + spam prevention * it was just 1 beat long * custom objects * custom objects initial implementation * bomb + ball fix * new sounds * oops * More * big ball implementation 2 * Oops. * Update LBJCatMove.cs --------- Co-authored-by: ev <85412919+iloveoatmeal2022@users.noreply.github.com> Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
115 lines
4 KiB
C#
115 lines
4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_LumBEARjack
|
|
{
|
|
public class LBJBear : MonoBehaviour
|
|
{
|
|
[Header("Components")]
|
|
[SerializeField] private Animator _anim;
|
|
[SerializeField] private Transform _cameraPoint;
|
|
|
|
[Header("Properties")]
|
|
[SerializeField] private double _zoomInLength = 0.25;
|
|
[SerializeField] private float _zoomInPower = 4f;
|
|
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseOutBounce;
|
|
|
|
private bool _rested = false;
|
|
private LumBEARjack.RestSoundChoice _restSound;
|
|
|
|
private float _cameraPointZFrom;
|
|
private EasingFunction.Function _cameraFunc;
|
|
|
|
private void Awake()
|
|
{
|
|
_cameraPointZFrom = _cameraPoint.localPosition.z;
|
|
_cameraFunc = EasingFunction.GetEasingFunction(_ease);
|
|
}
|
|
|
|
public void SwingWhiff(bool sound = true)
|
|
{
|
|
if (_rested) return;
|
|
if (sound) SoundByte.PlayOneShotGame("lumbearjack/swing", -1, SoundByte.GetPitchFromCents(Random.Range(-200, 201), false));
|
|
_anim.DoScaledAnimationAsync("BeastWhiff", 0.75f);
|
|
}
|
|
|
|
public void Cut(double beat, bool huh, bool huhL, bool zoomIn = false)
|
|
{
|
|
_anim.DoScaledAnimationAsync(huh ? "BeastHalfCut" : "BeastCut", 0.75f);
|
|
if (zoomIn) ActivateZoomIn();
|
|
if (!huh) return;
|
|
BeatAction.New(this, new()
|
|
{
|
|
new(beat + 1, delegate
|
|
{
|
|
_anim.DoScaledAnimationAsync(huhL ? "BeastHuhL" : "BeastHuhR", 0.5f);
|
|
}),
|
|
new(beat + 2, delegate
|
|
{
|
|
_anim.DoScaledAnimationAsync("BeastReady", 0.75f);
|
|
})
|
|
});
|
|
}
|
|
|
|
public void CutMid(bool noImpact = false)
|
|
{
|
|
_anim.DoScaledAnimationAsync("BeastCutMid" + (noImpact ? "NoImpact" : ""), 0.75f);
|
|
}
|
|
|
|
public void Bop()
|
|
{
|
|
if (_anim.IsPlayingAnimationNames("BeastWhiff", "BeastRest") || _rested) return;
|
|
_anim.DoScaledAnimationAsync("BeastBop", 0.75f);
|
|
}
|
|
|
|
public void Rest(bool instant, LumBEARjack.RestSoundChoice sound)
|
|
{
|
|
_anim.DoScaledAnimationAsync("BeastRest", 0.5f, instant ? 1 : 0);
|
|
_rested = true;
|
|
_restSound = sound;
|
|
}
|
|
|
|
public void RestSound()
|
|
{
|
|
switch (_restSound)
|
|
{
|
|
case LumBEARjack.RestSoundChoice.Random:
|
|
SoundByte.PlayOneShotGame("lumbearjack/sigh" + (Random.Range(1, 3) == 1 ? "A" : "B"));
|
|
break;
|
|
case LumBEARjack.RestSoundChoice.restA:
|
|
SoundByte.PlayOneShotGame("lumbearjack/sighA");
|
|
break;
|
|
case LumBEARjack.RestSoundChoice.restB:
|
|
SoundByte.PlayOneShotGame("lumbearjack/sighB");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
private Coroutine _currentZoomCo;
|
|
|
|
private void ActivateZoomIn()
|
|
{
|
|
if (_currentZoomCo != null) StopCoroutine(_currentZoomCo);
|
|
_currentZoomCo = StartCoroutine(ActivateZoomInCo());
|
|
}
|
|
|
|
private IEnumerator ActivateZoomInCo()
|
|
{
|
|
double startBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, _zoomInLength, false);
|
|
|
|
while (normalizedBeat <= 1f)
|
|
{
|
|
normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, _zoomInLength, false);
|
|
float newZ = _cameraFunc(_cameraPointZFrom + _zoomInPower, _cameraPointZFrom, Mathf.Clamp01(normalizedBeat));
|
|
_cameraPoint.localPosition = new Vector3(_cameraPoint.localPosition.x, _cameraPoint.localPosition.y, newZ);
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|