HeavenStudio/Assets/Scripts/Games/TossBoys/TossBoysBall.cs
Rapandrasmus bbca7457cc
Toss Boys (#424)
* sprites and stuff lolol

* oops

* Real

* akahitanim

* lots of anims done

* more anims

* many anims many sprites

* LOLLL OOPS

* oops 2

* all anims done

* oops2

* oops3

* special overlay

* Basics

* Inputs stuff

* Basic pass ball implemented

* Transitions 🔥

* Nvm transitions are gay

* Dual toss added

* Idiot proof toss boys

* prepare anims

* Some special logic

* Done with special for dual toss and added bops

* little anim tweak

* Added pop ball and fixed some things

* Funny sound offsets

* Added high toss + fixed a bug

* icons and more animations

* epic insane particle changes (CRAZY!!!!!!!!!!!)

* FIXES!

* Added call and fixed a bug

* Panning added

* Lightning toss added

* Blur toss Added

* Added fade in for the special overlay and fixed a bug

* cool animation shit

* animations and sprites fully done

* set up basic curves

* The toss boys main script just needs to set the state of the ball now

* All curves implemented - untested though

* Smol fix!

* slightly new sheet

* Bg Recolor + ball anims + whiff cooldown

* Specials now properly handle themselves when chained together

* ball anims

* Fixes and tweaks

* Fixed a bug with lightning toss

* small tweaks

* Only thing toss boys needs is the pitch warble now

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
2023-05-19 22:21:02 +00:00

122 lines
4.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using UnityEditorInternal;
using System;
namespace HeavenStudio.Games.Scripts_TossBoys
{
public class TossBoysBall : SuperCurveObject
{
public enum State
{
None,
RedDispense,
BlueDispense,
YellowDispense,
RedBlue,
RedYellow,
BlueRed,
BlueYellow,
YellowRed,
YellowBlue,
RedBlueDual,
RedYellowDual,
BlueRedDual,
BlueYellowDual,
YellowRedDual,
YellowBlueDual,
RedBlueHigh,
RedYellowHigh,
BlueRedHigh,
BlueYellowHigh,
YellowRedHigh,
YellowBlueHigh,
RedBlur,
RedKeep,
BlueBlur,
BlueKeep,
YellowBlur,
YellowKeep
}
private State currentState;
private float startBeat;
private Path currentPath;
private TossBoys game;
[NonSerialized] public Animator anim;
private void Awake()
{
game = TossBoys.instance;
anim = GetComponent<Animator>();
}
private void Update()
{
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused)
{
switch (currentState)
{
case State.None:
//Do Jackshit
break;
default:
transform.position = GetPathPositionFromBeat(currentPath, Mathf.Max(startBeat, Conductor.instance.songPositionInBeats), startBeat);
float rot = GetPathValue("rot");
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f / Conductor.instance.pitchedSecPerBeat)));
break;
}
}
}
public void SetState(State state, float beat, float length = 0)
{
UpdateLastRealPos();
startBeat = beat;
currentState = state;
currentPath = currentState switch
{
State.None => new Path(),
State.RedDispense => game.GetPath("RedDispense"),
State.BlueDispense => game.GetPath("BlueDispense"),
State.YellowDispense => game.GetPath("YellowDispense"),
State.RedBlue => game.GetPath("RedBlue"),
State.RedYellow => game.GetPath("RedYellow"),
State.BlueRed => game.GetPath("BlueRed"),
State.BlueYellow => game.GetPath("BlueYellow"),
State.YellowRed => game.GetPath("YellowRed"),
State.YellowBlue => game.GetPath("YellowBlue"),
State.RedBlueDual => game.GetPath("RedBlueDual"),
State.RedYellowDual => game.GetPath("RedYellowDual"),
State.BlueRedDual => game.GetPath("BlueRedDual"),
State.BlueYellowDual => game.GetPath("BlueYellowDual"),
State.YellowRedDual => game.GetPath("YellowRedDual"),
State.YellowBlueDual => game.GetPath("YellowBlueDual"),
State.RedBlueHigh => game.GetPath("RedBlueHigh"),
State.RedYellowHigh => game.GetPath("RedYellowHigh"),
State.BlueRedHigh => game.GetPath("BlueRedHigh"),
State.BlueYellowHigh => game.GetPath("BlueYellowHigh"),
State.YellowRedHigh => game.GetPath("YellowRedHigh"),
State.YellowBlueHigh => game.GetPath("YellowBlueHigh"),
State.RedBlur => game.GetPath("RedBlur"),
State.RedKeep => game.GetPath("RedKeep"),
State.BlueBlur => game.GetPath("BlueBlur"),
State.BlueKeep => game.GetPath("BlueKeep"),
State.YellowBlur => game.GetPath("YellowBlur"),
State.YellowKeep => game.GetPath("YellowKeep"),
_ => throw new System.NotImplementedException()
};
if (length != 0)
{
currentPath.positions[0].duration = length;
}
}
}
}