mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
19973638a2
* basic setup+inputs
this is gonna be so annoying to optimize
i am SO overwhelmed with the options that i have
object pooling, disabling the monkeys, literally just placing them manually... idk.
* custom monkeys + more setup stuff
it's all coming together .
* a few tweaks
committing to update the spritesheet
* hi ev
* player stuff
* player anims
* particles
* more of prefab
* upscale for this sheet
* prefab more
* oops
* anims n stuff
* assign the stuff, a little bit of rotation
* better sheet
* balloon sheet
* particles
* Revert "particles"
This reverts commit fe4d589731a3ceacc7d80b7fde520f87b1c6e745.
* Revert "Revert "particles""
This reverts commit ce117b280d4bd7400bd40260f4d858f2d5fba9e3.
* fixed the watch outline + pink monkey prefab variant
the bccad really is a life saver
* anims for monkeys
* convert to dictionary
yippee for dictionaries
* better camera
* click animations are all done
* custom monkeys are actually good now :)
* prefab adjustments
* oopps2
* tweaked particles
* inactive monkeys/custom monkeys + prefab fixes
they should work perfectly now, and the prefab should also need no further adjustment
hopefully...
* many animations
* click fixes
* the prefab needed One more adjustment
* oops again
hopefully the shadow is good now
* sheet adjustment
* all yellow anims done
* progress.
starting on the monkeys appear block rn, and then i'll work on the monkey spawning logic. honestly should be pretty easy (and i DON'T think this will be something i look back on as if i was crazy 😄 )
* open / close hole
* monkey spawning working better
* pink monkey anims
* clean slate
* gonna test something
* proper camera
* Camera movements done
* pink monkey sounds and a small bug fix
* clock arrow now moves
* gettin ready to spawn el monkeys
* monkeys should spawn now ig
* bug fixes
* oops
* monkeys appear added
* more fixes yahoo
* shadow tweak
* bug fixes
* zoom out beginnings
* hour more smooth
* smooth minute too
* it now zooms out lol
* middle monkey
* oopsie doopsie
* hot air balloon
* oops
* anim
* disappear fix
* ticks on input now
* prepare earlier
* tiny tweak
* oops again
* fixed the input bug
* holes
* middle monkey anims
* fixed layering
* zoom out tweaks and shadow movement
* camera tweak
* tweaks
* quad
* camera tweak
* quart
* inspcetor
* shadow correct
* Okay
* zoom out seperation
* instant
* balloon movement
* balloon fixed
* fixed particle
* icon
* fixed beataction parameters
* monkey watch camera refactor
run sourcegen
---------
Co-authored-by: AstrlJelly <bdlawson115@gmail.com>
Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
Co-authored-by: minenice55 <star.elementa@gmail.com>
393 lines
18 KiB
C#
393 lines
18 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
using System.Resources;
|
|
using System.Net;
|
|
using System;
|
|
|
|
namespace HeavenStudio.Games.Scripts_SeeSaw
|
|
{
|
|
public class SeeSawGuy : SuperCurveObject
|
|
{
|
|
public enum LandType
|
|
{
|
|
Big,
|
|
Miss,
|
|
Barely,
|
|
Normal
|
|
}
|
|
public enum JumpState
|
|
{
|
|
None,
|
|
StartJump,
|
|
StartJumpIn,
|
|
OutOut,
|
|
InIn,
|
|
InOut,
|
|
OutIn,
|
|
EndJumpOut,
|
|
EndJumpIn,
|
|
HighOutOut,
|
|
HighOutIn,
|
|
HighInOut,
|
|
HighInIn
|
|
}
|
|
[SerializeField] bool see;
|
|
[NonSerialized] public bool dead = false;
|
|
public bool strum;
|
|
[NonSerialized] public Animator anim;
|
|
JumpState lastState;
|
|
JumpState currentState;
|
|
Path currentPath;
|
|
Path cameraPath;
|
|
SeeSaw game;
|
|
double startBeat;
|
|
double heightLastFrame;
|
|
[NonSerialized] public bool canBop = true;
|
|
[SerializeField] Transform landOutTrans;
|
|
public Transform landInTrans;
|
|
[SerializeField] Transform groundTrans;
|
|
[SerializeField] Transform gameTrans;
|
|
bool hasChangedAnimMidAir;
|
|
[SerializeField] ParticleSystem deathParticle;
|
|
double wantChoke = -1;
|
|
float wantChokeLength;
|
|
|
|
[SerializeField] private Animator invertAnim;
|
|
|
|
private void Awake()
|
|
{
|
|
anim = transform.GetChild(0).GetComponent<Animator>();
|
|
anim.Play(see ? "NeutralSee" : "NeutralSaw", 0, 0);
|
|
game = SeeSaw.instance;
|
|
cameraPath = game.GetPath("Camera");
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
|
|
double currentBeat = cond.songPositionInBeatsAsDouble;
|
|
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
{
|
|
switch (currentState)
|
|
{
|
|
default:
|
|
return;
|
|
case JumpState.StartJump:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), out double height, startBeat);
|
|
if (height < heightLastFrame && !hasChangedAnimMidAir)
|
|
{
|
|
anim.Play("Jump_OutOut_Fall", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
|
|
heightLastFrame = height;
|
|
break;
|
|
case JumpState.StartJumpIn:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), out double heightIn, startBeat);
|
|
if (heightIn < heightLastFrame && !hasChangedAnimMidAir)
|
|
{
|
|
anim.Play("Jump_InIn_Fall", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
|
|
heightLastFrame = heightIn;
|
|
break;
|
|
case JumpState.OutOut:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
if (currentBeat >= startBeat + 1 && !hasChangedAnimMidAir)
|
|
{
|
|
anim.Play("Jump_OutOut_Fall", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
|
|
break;
|
|
case JumpState.InIn:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
if (currentBeat >= startBeat + 0.5f && !hasChangedAnimMidAir)
|
|
{
|
|
anim.Play("Jump_InIn_Fall", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
break;
|
|
case JumpState.InOut:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
if (currentBeat >= startBeat + 0.5f)
|
|
{
|
|
if (!hasChangedAnimMidAir) anim.Play("Jump_InOut_Tuck", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
transform.rotation = Quaternion.Euler(0, 0, (see ? 1 : -1) * Mathf.Lerp(0, 360, cond.GetPositionFromBeat(startBeat + 0.5f, 0.75f)));
|
|
}
|
|
break;
|
|
case JumpState.OutIn:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
if (currentBeat >= startBeat + 1f)
|
|
{
|
|
if (!hasChangedAnimMidAir) anim.Play("Jump_OutIn_Tuck", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
transform.rotation = Quaternion.Euler(0, 0, (see ? -1 : 1) * Mathf.Lerp(0, 360, cond.GetPositionFromBeat(startBeat + 1f, 1f)));
|
|
}
|
|
break;
|
|
case JumpState.EndJumpOut:
|
|
case JumpState.EndJumpIn:
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
break;
|
|
case JumpState.HighOutOut:
|
|
if (currentBeat >= startBeat + 1 && !hasChangedAnimMidAir && see)
|
|
{
|
|
if (!hasChangedAnimMidAir) anim.Play("Jump_OutOut_Fall", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
break;
|
|
case JumpState.HighOutIn:
|
|
if (currentBeat >= startBeat + 1 && !hasChangedAnimMidAir && see)
|
|
{
|
|
if (!hasChangedAnimMidAir) anim.Play("Jump_OutIn_Tuck", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
break;
|
|
case JumpState.HighInOut:
|
|
if (currentBeat >= startBeat + 1 && !hasChangedAnimMidAir && see)
|
|
{
|
|
if (!hasChangedAnimMidAir) anim.Play("Jump_InOut_Tuck", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
break;
|
|
case JumpState.HighInIn:
|
|
if (currentBeat >= startBeat + 1 && !hasChangedAnimMidAir && see)
|
|
{
|
|
if (!hasChangedAnimMidAir) anim.Play("Jump_InIn_Fall", 0, 0);
|
|
hasChangedAnimMidAir = true;
|
|
}
|
|
transform.position = GetPathPositionFromBeat(currentPath, Math.Max(startBeat, currentBeat), startBeat);
|
|
break;
|
|
}
|
|
float newCamY = 0f;
|
|
|
|
if (!see && game.cameraMove)
|
|
{
|
|
switch (currentState)
|
|
{
|
|
default:
|
|
return;
|
|
case JumpState.HighOutOut:
|
|
case JumpState.HighOutIn:
|
|
case JumpState.HighInOut:
|
|
case JumpState.HighInIn:
|
|
newCamY = Math.Max(GetPathPositionFromBeat(cameraPath, Math.Max(startBeat, currentBeat), startBeat).y, 0);
|
|
break;
|
|
}
|
|
}
|
|
gameTrans.localPosition = new Vector3(0, -newCamY, 0);
|
|
}
|
|
}
|
|
|
|
public void Choke(double beat, float length)
|
|
{
|
|
if (!canBop || currentState != JumpState.None || dead)
|
|
{
|
|
wantChoke = beat;
|
|
wantChokeLength = length;
|
|
return;
|
|
}
|
|
dead = true;
|
|
anim.DoScaledAnimationAsync("Choke_" + (see ? "See" : "Saw") + "_Intro", 0.5f);
|
|
SoundByte.PlayOneShotGame("seeSaw/explosion" + (see ? "Black" : "White"), beat + length);
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + length - 1, delegate { invertAnim.DoScaledAnimationAsync("Invert", 0.5f); }),
|
|
new BeatAction.Action(beat + length, delegate { anim.DoScaledAnimationAsync("Explode", 0.5f); deathParticle.Play();})
|
|
});
|
|
}
|
|
|
|
public void Bop()
|
|
{
|
|
if (!canBop || currentState != JumpState.None || dead) return;
|
|
anim.DoScaledAnimationAsync("Bop" + (see ? "See" : "Saw") + (strum ? "_Strum" : ""), 0.5f);
|
|
}
|
|
|
|
public void Land(LandType landType, bool getUpOut)
|
|
{
|
|
transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
GameCamera.AdditionalPosition = Vector3.zero;
|
|
bool landedOut = false;
|
|
switch (currentState)
|
|
{
|
|
default:
|
|
break;
|
|
case JumpState.InOut:
|
|
case JumpState.OutOut:
|
|
case JumpState.StartJump:
|
|
case JumpState.HighOutOut:
|
|
case JumpState.HighInOut:
|
|
landedOut = true;
|
|
break;
|
|
case JumpState.EndJumpOut:
|
|
case JumpState.EndJumpIn:
|
|
transform.position = groundTrans.position;
|
|
SetState(JumpState.None, 0);
|
|
if (wantChoke >= Conductor.instance.songPositionInBeatsAsDouble - 0.25f && wantChoke <= Conductor.instance.songPositionInBeatsAsDouble + 0.25f)
|
|
{
|
|
Choke(wantChoke, wantChokeLength);
|
|
}
|
|
else if (see ? game.seeShouldBop : game.sawShouldBop)
|
|
{
|
|
Bop();
|
|
}
|
|
else
|
|
{
|
|
anim.Play("NeutralSee", 0, 0);
|
|
}
|
|
return;
|
|
}
|
|
if (landType is LandType.Big && !see)
|
|
{
|
|
game.SpawnOrbs(!landedOut, Conductor.instance.songPositionInBeatsAsDouble);
|
|
}
|
|
string landOut = landedOut ? "Out" : "In";
|
|
string typeOfLanding = "";
|
|
switch (landType)
|
|
{
|
|
case LandType.Big:
|
|
typeOfLanding = "_Big";
|
|
break;
|
|
case LandType.Miss:
|
|
typeOfLanding = "_Miss";
|
|
break;
|
|
case LandType.Barely:
|
|
typeOfLanding = "_Barely";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
string animName = "Land_" + landOut + typeOfLanding;
|
|
anim.DoScaledAnimationAsync(animName, 0.5f);
|
|
if (landType is not LandType.Barely)
|
|
{
|
|
string getUpAnim = "GetUp_" + landOut + typeOfLanding;
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(Conductor.instance.songPositionInBeatsAsDouble + (getUpOut ? 1f : 0.5f), delegate { anim.DoScaledAnimationAsync(getUpAnim, 0.5f); })
|
|
});
|
|
}
|
|
transform.position = landedOut ? landOutTrans.position : landInTrans.position;
|
|
SetState(JumpState.None, 0);
|
|
}
|
|
|
|
public bool ShouldEndJumpOut()
|
|
{
|
|
switch (lastState)
|
|
{
|
|
default:
|
|
return false;
|
|
case JumpState.InOut:
|
|
case JumpState.OutOut:
|
|
case JumpState.StartJump:
|
|
case JumpState.HighOutOut:
|
|
case JumpState.HighInOut:
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public void SetState(JumpState state, double beat, bool miss = false, float height = 0)
|
|
{
|
|
lastState = currentState;
|
|
currentState = state;
|
|
startBeat = beat;
|
|
heightLastFrame = 0;
|
|
hasChangedAnimMidAir = false;
|
|
switch (currentState)
|
|
{
|
|
case JumpState.OutOut:
|
|
currentPath = game.GetPath(see ? "SeeJumpOutOut" : "SawJumpOutOut");
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutOut_Start", 0.5f);
|
|
break;
|
|
case JumpState.StartJump:
|
|
currentPath = game.GetPath("SeeStartJump");
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutOut_Start", 0.5f);
|
|
break;
|
|
case JumpState.InIn:
|
|
anim.DoScaledAnimationAsync(miss ? "BadIn_SeeReact" : "Jump_InIn_Start", 0.5f);
|
|
currentPath = game.GetPath(see ? "SeeJumpInIn" : "SawJumpInIn");
|
|
break;
|
|
case JumpState.InOut:
|
|
anim.DoScaledAnimationAsync(miss ? "BadIn_SeeReact" : "Jump_InIn_Start", 0.5f);
|
|
currentPath = game.GetPath(see ? "SeeJumpInOut" : "SawJumpInOut");
|
|
break;
|
|
case JumpState.StartJumpIn:
|
|
currentPath = game.GetPath("SeeStartJumpIn");
|
|
anim.DoScaledAnimationAsync(miss ? "BadIn_SeeReact" : "Jump_InIn_Start", 0.5f);
|
|
break;
|
|
case JumpState.OutIn:
|
|
currentPath = game.GetPath(see ? "SeeJumpOutIn" : "SawJumpOutIn");
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutIn_Start", 0.5f);
|
|
break;
|
|
case JumpState.EndJumpOut:
|
|
currentPath = game.GetPath("SeeEndJumpOut");
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutIn_Start", 0.5f);
|
|
break;
|
|
case JumpState.EndJumpIn:
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutIn_Start", 0.5f);
|
|
currentPath = game.GetPath("SeeEndJumpIn");
|
|
break;
|
|
case JumpState.HighOutOut:
|
|
currentPath = game.GetPath(see ? "SeeHighOutOut" : "SawHighOutOut");
|
|
currentPath.positions[0].height = Mathf.Lerp(12, 28, height);
|
|
cameraPath.positions[0].height = Mathf.Lerp(10, 26, height);
|
|
cameraPath.positions[0].duration = 2f;
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutOut_Start", 0.5f);
|
|
if (see) return;
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + 1, delegate { anim.DoScaledAnimationAsync("Jump_OutOut_Transform", 0.5f); })
|
|
});
|
|
break;
|
|
case JumpState.HighOutIn:
|
|
currentPath = game.GetPath(see ? "SeeHighOutIn" : "SawHighOutIn");
|
|
currentPath.positions[0].height = Mathf.Lerp(12, 28, height);
|
|
cameraPath.positions[0].height = Mathf.Lerp(10, 26, height);
|
|
cameraPath.positions[0].duration = 2f;
|
|
anim.DoScaledAnimationAsync(miss ? "BadOut_SeeReact" : "Jump_OutIn_Start", 0.5f);
|
|
if (see) return;
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + 1, delegate { anim.DoScaledAnimationAsync("Jump_OutIn_Transform", 0.5f); })
|
|
});
|
|
break;
|
|
case JumpState.HighInOut:
|
|
currentPath = game.GetPath(see ? "SeeHighInOut" : "SawHighInOut");
|
|
currentPath.positions[0].height = Mathf.Lerp(9, 20, height);
|
|
cameraPath.positions[0].height = Mathf.Lerp(7, 18, height);
|
|
cameraPath.positions[0].duration = 1f;
|
|
anim.DoScaledAnimationAsync(miss ? "BadIn_SeeReact" : "Jump_InIn_Start", 0.5f);
|
|
if (see) return;
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + 0.5f, delegate { anim.DoScaledAnimationAsync("Jump_OutOut_Transform", 0.5f); })
|
|
});
|
|
break;
|
|
case JumpState.HighInIn:
|
|
currentPath = game.GetPath(see ? "SeeHighInIn" : "SawHighInIn");
|
|
currentPath.positions[0].height = Mathf.Lerp(9, 20, height);
|
|
cameraPath.positions[0].height = Mathf.Lerp(7, 18, height);
|
|
cameraPath.positions[0].duration = 1f;
|
|
anim.DoScaledAnimationAsync(miss ? "BadIn_SeeReact" : "Jump_InIn_Start", 0.5f);
|
|
if (see) return;
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(beat + 0.5f, delegate { anim.DoScaledAnimationAsync("Jump_OutIn_Transform", 0.5f); })
|
|
});
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|