mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-13 05:05:08 +00:00
4d2bb8c782
* rock hers * Rockers is a real game and also color maps have been added * little more set up * anims and mor sprites * First version of CallAndResponseHandler added * You can mute now wow * Got some stuff working * anim city * Fixed Inputs * Visual goodies * Changed how some events work * Rockers is now stack proof * Fixed a bug * Bend early stages * bendbendbendbendbendover * bend fully implemented * Removed "noise" * pain * Many animation * Bend anims implemented * strum effect implemented * Made bends work way better * dfgdfsgsdffsd * Implemented strumstart and countin * hi * Made strumstart transition into strumidle * Implemented samples * All of the btsds samples are in now too * many anim2 * A buggy version of the custom together system has been implemented * Ok now it's unbuggified * fixed a small thing * lightning eff * anim fixes * oops * you can now mute voiceline and also put in a standalone voiceline block * Tweaks to dropdowns * more tiny anim thing * more animation stuff * Bug fixes * implemented mute and gotomiddle sliders for custom together event * Default cmon and last one added * You can chain last ones and cmons now * Applause sounds added * Fixed some bugs * Made it so you can disable camera movement * fixed an inconsistency * Rhythm tweezers is actually kinda playable now, not finished though, i need to make beat offset work with this * Rhythm tweezers now works between game switches * Beat offset eradication * Made eye size work properly * Camera quad ease rather than quint * Inactive intervals added * Rockers works inactively too now * Bug fix * No peeking! No way! * Alt smile added for tweezers * early and late riff * jj miss anim * icon and miss * Long hair works properly now * Miss anims implemented for rockers --------- Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Co-authored-by: minenice55 <star.elementa@gmail.com>
118 lines
No EOL
3.7 KiB
C#
118 lines
No EOL
3.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace HeavenStudio.Games.Scripts_RhythmTweezers
|
|
{
|
|
public class LongHair : MonoBehaviour
|
|
{
|
|
public float createBeat;
|
|
public GameObject hairSprite;
|
|
public GameObject stubbleSprite;
|
|
private RhythmTweezers game;
|
|
private Tweezers tweezers;
|
|
private Animator anim;
|
|
private int pluckState = 0;
|
|
|
|
public GameObject holder;
|
|
public GameObject loop;
|
|
|
|
private Sound pullSound;
|
|
|
|
private float inputBeat;
|
|
|
|
PlayerActionEvent endEvent;
|
|
|
|
private void Awake()
|
|
{
|
|
game = RhythmTweezers.instance;
|
|
anim = GetComponent<Animator>();
|
|
tweezers = game.Tweezers;
|
|
}
|
|
|
|
public void StartInput(float beat, float length)
|
|
{
|
|
inputBeat = beat + length;
|
|
game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, StartJust, StartMiss, Out);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (pluckState == 1)
|
|
{
|
|
Vector3 tst = tweezers.tweezerSpriteTrans.position;
|
|
var hairDirection = new Vector3(tst.x + 0.173f, tst.y) - holder.transform.position;
|
|
holder.transform.rotation = Quaternion.FromToRotation(Vector3.down, hairDirection);
|
|
|
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(inputBeat, 0.5f);
|
|
anim.Play("LoopPull", 0, normalizedBeat);
|
|
tweezers.anim.Play("Tweezers_LongPluck", 0, normalizedBeat);
|
|
if (!game.IsExpectingInputNow(InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP) && PlayerInput.PressedUp(true) && normalizedBeat < 1f)
|
|
{
|
|
EndEarly();
|
|
endEvent.Disable();
|
|
}
|
|
// Auto-release if holding at release time.
|
|
if (normalizedBeat >= 1f && !game.IsExpectingInputNow(InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP))
|
|
EndAce();
|
|
}
|
|
|
|
loop.transform.localScale = Vector2.one / holder.transform.localScale;
|
|
}
|
|
|
|
public void EndAce()
|
|
{
|
|
if (pluckState != 1) return;
|
|
tweezers.LongPluck(true, this);
|
|
tweezers.hitOnFrame++;
|
|
|
|
if (pullSound != null)
|
|
pullSound.Stop();
|
|
|
|
pluckState = -1;
|
|
}
|
|
|
|
public void EndEarly()
|
|
{
|
|
var normalized = Conductor.instance.GetPositionFromBeat(inputBeat, 0.5f);
|
|
anim.Play("LoopPullReverse", 0, normalized);
|
|
tweezers.anim.Play("Tweezers_Idle", 0, 0);
|
|
|
|
if (pullSound != null)
|
|
pullSound.Stop();
|
|
|
|
pluckState = -1;
|
|
}
|
|
|
|
private void StartJust(PlayerActionEvent caller, float state)
|
|
{
|
|
// don't count near misses
|
|
if (state >= 1f || state <= -1f) {
|
|
pluckState = -1;
|
|
return;
|
|
}
|
|
pullSound = Jukebox.PlayOneShotGame($"rhythmTweezers/longPull{UnityEngine.Random.Range(1, 5)}");
|
|
pluckState = 1;
|
|
endEvent = game.ScheduleInput(inputBeat, 0.5f, InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP, EndJust, Out, Out);
|
|
}
|
|
|
|
private void StartMiss(PlayerActionEvent caller)
|
|
{
|
|
// this is where perfect challenge breaks
|
|
}
|
|
|
|
private void Out(PlayerActionEvent caller) {}
|
|
|
|
private void EndJust(PlayerActionEvent caller, float state)
|
|
{
|
|
if (state <= -1f) {
|
|
EndEarly();
|
|
return;
|
|
}
|
|
EndAce();
|
|
}
|
|
}
|
|
} |