mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 13:45:10 +00:00
98233e174d
* Nightwalks set up * Play yan with balloons * platformSetUp * Platform handler fundamentals * Count In Added * small thing * Got em inputs in nightwalk gba to work * Platforms now spawn when there's no count-in * He jumps now! * Decreased platform count * Height changes added * Randomness for height changes * Name changing * Fixed a bug with no count in blocks * Ok height changes should be flawless now * No jumping added * Umbrella and lollipop added * Umbrella drum pattern added * Fallyan :( * Implemented falling :( * Fixed drum patterns not working * Fish implemented * Fixed kick sound being weird * 4 beat count in added * Tweaked landing pos * Walking Count-In added * new sprites touched up anims * oops1 * barely anims * Implemented barelies into nightwalk gba * Balloons have random positioning now * New sounds and whiff/barely sounds * Fall smear added * Fixed issues with platform heights on gameswitches * 24 platforms * walk is normalized now * Star scrolling functionality done * Blink animations n stuff * STARS BLINK NOW * Force evolve added + tweaks * Fixed stars not stopping + upped amount of stars * End event setup * Finding end blocks logic added * end event functionality finished * end platform anim * fixed anim * only stars on screen evolve * 2 evolve by default * End event fixes * more blinking * star blinks now and has string * minor tweak * fix to interaction between fish and end block * tweaked dropdown values * removed fish sound * named some sprites in the spritesheet * high jump and roll anims * Roll sound should only play if valid * Small fix to roll cue sound logic * Another small fix to roll cue sound logic * ok actually fixed roll sound * roll platform added to jumpl platform prefab * Roll cue platform visuals done * Basic Roll Cue implemented * flower * umbrella * barely for roll release * OOPS * smol fixes * fixed visual stuff and added missing to rolls * redid sheet, new anims * slow walkin' * adjustments * oops * adjusted smear * improved interaction between roll and end block * improved interaction between roll cue and platform heights * 32 stars * made the star boundary way smaller * how was i this stupid * fixed more interactions * stack proof roll cue and also end block + roll cue fix * Fixed things related to stars * fixed no jumping not working with end block + roll * nearing the final stages * rolls counts for 2 jumps now * fixed a bug to do with roll platforms and made roll platform sounds not be able to be played on invalid beats * made stage 2 stars bigger * added destroy roll platform sprites * update to new systems --------- Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Co-authored-by: minenice55 <star.elementa@gmail.com>
139 lines
5.1 KiB
C#
139 lines
5.1 KiB
C#
using HeavenStudio.Util;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
|
{
|
|
public class AgbPlatformHandler : MonoBehaviour
|
|
{
|
|
private AgbNightWalk game;
|
|
[Header("Properties")]
|
|
[SerializeField] private AgbPlatform platformRef;
|
|
[SerializeField] private AgbStarHandler starHandler;
|
|
public float defaultYPos = -11.76f;
|
|
public float heightAmount = 2;
|
|
public float platformDistance = 3.80f;
|
|
public float playerXPos = -6.78f;
|
|
[SerializeField] private float starLength = 16;
|
|
[SerializeField] private float starHeight = 0.0625f;
|
|
[Range(1, 100)]
|
|
public int platformCount = 20;
|
|
private float lastHeight = 0;
|
|
private float heightToRaiseTo = 0;
|
|
private double raiseBeat = double.MinValue;
|
|
[NonSerialized] public List<AgbPlatform> allPlatforms = new();
|
|
private int lastHeightUnits;
|
|
private int currentHeightUnits;
|
|
private bool stopStars;
|
|
|
|
private void Awake()
|
|
{
|
|
game = AgbNightWalk.instance;
|
|
}
|
|
|
|
public void SpawnPlatforms(double beat)
|
|
{
|
|
if (game.countInBeat != double.MinValue)
|
|
{
|
|
for (int i = 0; i < platformCount; i++)
|
|
{
|
|
AgbPlatform platform = Instantiate(platformRef, transform);
|
|
allPlatforms.Add(platform);
|
|
platform.handler = this;
|
|
platform.StartInput(game.countInBeat + i + game.countInLength - (platformCount * 0.5), game.countInBeat + i + game.countInLength);
|
|
platform.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
double firstInputBeat = Math.Ceiling(beat);
|
|
for (int i = 0; i < platformCount; i++)
|
|
{
|
|
AgbPlatform platform = Instantiate(platformRef, transform);
|
|
allPlatforms.Add(platform);
|
|
platform.handler = this;
|
|
platform.StartInput(beat, firstInputBeat + i - platformCount);
|
|
platform.gameObject.SetActive(true);
|
|
}
|
|
int lastUnits = game.FindHeightUnitsAtBeat(firstInputBeat - 1);
|
|
int currentUnits = game.FindHeightUnitsAtBeat(firstInputBeat);
|
|
RaiseHeight(firstInputBeat - 1, lastUnits, currentUnits);
|
|
if (lastUnits != currentUnits)
|
|
{
|
|
game.playYan.Jump(firstInputBeat - 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
{
|
|
if (raiseBeat != double.MinValue)
|
|
{
|
|
float normalizedBeat = Mathf.Clamp(cond.GetPositionFromBeat(raiseBeat, 1), 0, 1);
|
|
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseOutQuint);
|
|
|
|
float newPosY = func(lastHeight, heightToRaiseTo, normalizedBeat);
|
|
|
|
transform.localPosition = new Vector3(0, -newPosY, 0);
|
|
starHandler.normalizedY = -func(starHeight * lastHeightUnits, starHeight * currentHeightUnits, normalizedBeat);
|
|
}
|
|
if (stopStars) return;
|
|
float normalizedValue = cond.GetPositionFromBeat(0, starLength);
|
|
|
|
starHandler.normalizedX = -normalizedValue;
|
|
}
|
|
}
|
|
|
|
public void StopAll()
|
|
{
|
|
foreach (var platform in allPlatforms)
|
|
{
|
|
platform.Stop();
|
|
}
|
|
stopStars = true;
|
|
}
|
|
|
|
public void DevolveAll()
|
|
{
|
|
starHandler.Devolve();
|
|
}
|
|
|
|
public bool PlatformsStopped()
|
|
{
|
|
return allPlatforms[0].stopped;
|
|
}
|
|
|
|
public void DestroyPlatforms(double startBeat, double firstBeat, double lastBeat)
|
|
{
|
|
List<AgbPlatform> platformsToDestroy = allPlatforms.FindAll(x => x.endBeat >= firstBeat && x.endBeat <= lastBeat);
|
|
platformsToDestroy.Sort((x, y) => x.endBeat.CompareTo(y.endBeat));
|
|
List<BeatAction.Action> actions = new();
|
|
for (int i = 0; i < platformsToDestroy.Count; i++)
|
|
{
|
|
AgbPlatform currentPlatformToDdestroy = platformsToDestroy[i];
|
|
double fallBeat = startBeat + i;
|
|
actions.Add(new BeatAction.Action(fallBeat, delegate
|
|
{
|
|
currentPlatformToDdestroy.Disappear(fallBeat);
|
|
}));
|
|
}
|
|
BeatAction.New(this, actions);
|
|
}
|
|
|
|
public void RaiseHeight(double beat, int lastUnits, int currentUnits)
|
|
{
|
|
raiseBeat = beat;
|
|
lastHeight = lastUnits * heightAmount * transform.localScale.y;
|
|
heightToRaiseTo = currentUnits * heightAmount * transform.localScale.y;
|
|
currentHeightUnits = currentUnits;
|
|
lastHeightUnits = lastUnits;
|
|
Update();
|
|
}
|
|
}
|
|
}
|
|
|