the stuff
This commit is contained in:
ThePurpleAnon 2024-03-29 18:22:44 -05:00 committed by GitHub
parent a6dd70553b
commit 1c8e18ff58
2 changed files with 76 additions and 58 deletions

View file

@ -391,6 +391,7 @@ namespace HeavenStudio.Games
double bubbleSizeChangeStart = 0; double bubbleSizeChangeStart = 0;
double bubbleSizeChangeEnd = 0; double bubbleSizeChangeEnd = 0;
bool bubbleSizeChangeGrows = false; bool bubbleSizeChangeGrows = false;
float bubbleFinalScale = 1.038702f;
string yardsTextString = "# yards to the goal."; string yardsTextString = "# yards to the goal.";
bool yardsTextIsEditable = false; bool yardsTextIsEditable = false;
@ -812,34 +813,12 @@ namespace HeavenStudio.Games
isInputting = false; //stops the drums isInputting = false; //stops the drums
} }
//chicken/water movement speed
if (nextIsland.isMoving) ChickenAnim.SetScaledAnimationSpeed((nextIsland.speed1 / 60) + 0.2f);
float waterFlowSpeed = (nextIsland.speed1 / 5.83f) + ((1f / Conductor.instance.pitchedSecPerBeat) * 0.1f);
if ((-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f) < 0)
{
if (waterFlowSpeed > 0) WaterAnim.speed = waterFlowSpeed;
if (!flowForward)
{
WaterAnim.DoScaledAnimationAsync("Scroll", waterFlowSpeed);
flowForward = true;
}
}
else
{
if ((-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f) > 0) WaterAnim.speed = (-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f);
if (flowForward)
{
WaterAnim.DoScaledAnimationAsync("AntiScroll", (-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f));
flowForward = false;
}
}
//bubble shrinkage //bubble shrinkage
if (bubbleSizeChangeStart < Conductor.instance.songPositionInBeatsAsDouble && Conductor.instance.songPositionInBeatsAsDouble <= bubbleSizeChangeEnd) if (bubbleSizeChangeStart < Conductor.instance.songPositionInBeatsAsDouble && Conductor.instance.songPositionInBeatsAsDouble <= bubbleSizeChangeEnd)
{ {
float value = (Conductor.instance.GetPositionFromBeat(bubbleSizeChangeStart, bubbleSizeChangeEnd - bubbleSizeChangeStart)); float value = (Conductor.instance.GetPositionFromBeat(bubbleSizeChangeStart, bubbleSizeChangeEnd - bubbleSizeChangeStart));
float newScale = Util.EasingFunction.Linear(1.038702f, 0, value); float newScale = Util.EasingFunction.Linear(bubbleFinalScale, 0, value);
countBubble.transform.localScale = bubbleSizeChangeGrows ? new Vector3(1.038702f - newScale, 1.038702f - newScale, 1) : new Vector3(newScale, newScale, 1); countBubble.transform.localScale = bubbleSizeChangeGrows ? new Vector3(bubbleFinalScale - newScale, bubbleFinalScale - newScale, 1) : new Vector3(newScale, newScale, 1);
if (bubbleSizeChangeGrows) //refresh the text to remove mipmapping if (bubbleSizeChangeGrows) //refresh the text to remove mipmapping
{ {
bubbleText.text = ""; bubbleText.text = "";
@ -896,8 +875,13 @@ namespace HeavenStudio.Games
public void LateUpdate() public void LateUpdate()
{ {
float islandDistance = nextIsland.GetDist();
float islandDT = nextIsland.GetDT();
float islandVelocity = islandDistance / islandDT;
//parallax movement //parallax movement
float parallaxSpeed = nextIsland.speed1 / 20000; float parallaxSpeed = islandDistance / 70;
Stars.localPosition -= new Vector3((parallaxSpeed * 0.3f), 0, 0); Stars.localPosition -= new Vector3((parallaxSpeed * 0.3f), 0, 0);
if (Stars.localPosition.x < -48) Stars.localPosition += new Vector3(32, 0, 0); if (Stars.localPosition.x < -48) Stars.localPosition += new Vector3(32, 0, 0);
@ -912,6 +896,30 @@ namespace HeavenStudio.Games
if (Birds.localPosition.x < -15) Birds.localPosition += new Vector3(25, 0, 0); if (Birds.localPosition.x < -15) Birds.localPosition += new Vector3(25, 0, 0);
Birds.localPosition = new Vector3(Birds.localPosition.x, (Birds.localPosition.x / (1.65f * -3)), 0); Birds.localPosition = new Vector3(Birds.localPosition.x, (Birds.localPosition.x / (1.65f * -3)), 0);
Birds.localScale = new Vector3(1 + (Birds.localPosition.x / 16.5f), 1 + (Birds.localPosition.x / 16.5f), 1); Birds.localScale = new Vector3(1 + (Birds.localPosition.x / 16.5f), 1 + (Birds.localPosition.x / 16.5f), 1);
//chicken/water movement speed
if (nextIsland.isMoving) ChickenAnim.SetScaledAnimationSpeed((islandVelocity / 60) + 0.2f);
float waterFlowSpeed = (islandVelocity / 5.83f) + ((1f / Conductor.instance.pitchedSecPerBeat) * 0.1f);
float reversePos = -WaterAnim.GetCurrentAnimatorStateInfo(0).normalizedTime;
if ((-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f) < 0)
{
if (waterFlowSpeed > 0) WaterAnim.speed = waterFlowSpeed;
if (!flowForward)
{
WaterAnim.DoScaledAnimationAsync("Scroll", waterFlowSpeed, startPos: reversePos);
flowForward = true;
}
}
else
{
if ((-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f) > 0) WaterAnim.speed = (-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f);
if (flowForward)
{
WaterAnim.DoScaledAnimationAsync("AntiScroll", (-waterFlowSpeed) - ((1f / Conductor.instance.pitchedSecPerBeat) * 0.2f), startPos: reversePos);
flowForward = false;
}
}
} }
public override void OnGameSwitch(double beat) public override void OnGameSwitch(double beat)
@ -943,6 +951,7 @@ namespace HeavenStudio.Games
PersistThings(Conductor.instance.songPositionInBeatsAsDouble); PersistThings(Conductor.instance.songPositionInBeatsAsDouble);
nextIsland = Instantiate(IslandBase, transform).GetComponent<Island>(); nextIsland = Instantiate(IslandBase, transform).GetComponent<Island>();
nextIsland.journeySave = 1;
nextIsland.SmallLandmass.SetActive(true); nextIsland.SmallLandmass.SetActive(true);
WaterAnim.DoScaledAnimationAsync("Scroll", 0.2f); WaterAnim.DoScaledAnimationAsync("Scroll", 0.2f);
} }
@ -1013,11 +1022,13 @@ namespace HeavenStudio.Games
{ {
switch(whichDrum) switch(whichDrum)
{ {
case 8: case 0: break;
{ case 5: SoundByte.PlayOneShotGame("chargingChicken/feverkick"); break;
SoundByte.PlayOneShotGame("chargingChicken/MISC1"); case 6: SoundByte.PlayOneShotGame("chargingChicken/dskick"); break;
break; case 7: SoundByte.PlayOneShotGame("chargingChicken/gbakick"); break;
} case 8: SoundByte.PlayOneShotGame("chargingChicken/MIS1"); break;
case 9: SoundByte.PlayOneShotGame("chargingChicken/MISC21"); break;
case 10: SoundByte.PlayOneShotGame("chargingChicken/practicekick"); break;
default: default:
{ {
SoundByte.PlayOneShotGame("chargingChicken/kick"); SoundByte.PlayOneShotGame("chargingChicken/kick");
@ -1100,6 +1111,8 @@ namespace HeavenStudio.Games
})); }));
BeatAction.New(GameManager.instance, hoseActions); BeatAction.New(GameManager.instance, hoseActions);
if (whichDrum != 0)
{
//drum loop //drum loop
double loopLength; double loopLength;
if (drumLoops[whichDrum][0] != null) { loopLength = drumLoops[whichDrum][0].timing; } if (drumLoops[whichDrum][0] != null) { loopLength = drumLoops[whichDrum][0].timing; }
@ -1115,6 +1128,7 @@ namespace HeavenStudio.Games
beat += loopLength; beat += loopLength;
length -= loopLength; length -= loopLength;
} }
}
//set ending text //set ending text
actions.Add(new(journeyBeat + yardsTextLength - 1, delegate { actions.Add(new(journeyBeat + yardsTextLength - 1, delegate {
@ -1630,16 +1644,14 @@ namespace HeavenStudio.Games
public void BubbleShrink(double beat, double length, bool grows, bool instant) public void BubbleShrink(double beat, double length, bool grows, bool instant)
{ {
if (nextIsland.isRespawning || !isInputting) return;
if (instant) if (instant)
{ {
countBubble.SetActive(grows); countBubble.SetActive(grows && isInputting);
countBubble.transform.localScale = new Vector3(1, 1, 1); countBubble.transform.localScale = new Vector3(bubbleFinalScale, bubbleFinalScale, 1);
return; return;
} }
if (grows) countBubble.SetActive(true); if (grows) countBubble.SetActive(isInputting);
bubbleSizeChangeStart = beat; bubbleSizeChangeStart = beat;
bubbleSizeChangeEnd = beat + length; bubbleSizeChangeEnd = beat + length;
@ -1648,7 +1660,7 @@ namespace HeavenStudio.Games
BeatAction.New(GameManager.instance, new List<BeatAction.Action>() BeatAction.New(GameManager.instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat + length, delegate { new BeatAction.Action(beat + length, delegate {
if (!grows) { countBubble.SetActive(false); countBubble.transform.localScale = new Vector3(1, 1, 1); } if (!grows) { countBubble.SetActive(false); countBubble.transform.localScale = new Vector3(bubbleFinalScale, bubbleFinalScale, 1); }
}), }),
}); });
} }

View file

@ -52,6 +52,7 @@ namespace HeavenStudio.Games.Scripts_ChargingChicken
[NonSerialized]public bool grassFell = false; [NonSerialized]public bool grassFell = false;
float previousPosition; float previousPosition;
float previousTime;
[SerializeField] GameObject PlatformBase; [SerializeField] GameObject PlatformBase;
@ -112,18 +113,23 @@ namespace HeavenStudio.Games.Scripts_ChargingChicken
public void Awake() public void Awake()
{ {
StartCoroutine(CalcVelocity());
previousPosition = IslandPos.localPosition.x; previousPosition = IslandPos.localPosition.x;
previousTime = Time.time;
} }
IEnumerator CalcVelocity() public float GetDist()
{ {
while (true) float sendDist = 0;
{ if (previousPosition != 0) sendDist = -(IslandPos.localPosition.x - previousPosition);
yield return new WaitForEndOfFrame();
if (IslandPos.localPosition.x <= previousPosition) speed1 = -(IslandPos.localPosition.x - previousPosition) / Time.deltaTime;
previousPosition = IslandPos.localPosition.x; previousPosition = IslandPos.localPosition.x;
return sendDist;
} }
public float GetDT()
{
float sendDT = Time.time - previousTime;
previousTime = Time.time;
return sendDT;
} }
#endregion #endregion
@ -239,9 +245,9 @@ namespace HeavenStudio.Games.Scripts_ChargingChicken
public void SpawnStones(double beat, double length, bool tooLate) public void SpawnStones(double beat, double length, bool tooLate)
{ {
stonePlatformJourney = new StonePlatform[(int)(length * 4)]; stonePlatformJourney = new StonePlatform[(int)(length * ChargingChicken.platformsPerBeat)];
for ( int i = 0; i < length * 4; i++ ) for ( int i = 0; i < length * ChargingChicken.platformsPerBeat; i++ )
{ {
stonePlatformJourney[i].thisPlatform = Instantiate(PlatformBase, transform); stonePlatformJourney[i].thisPlatform = Instantiate(PlatformBase, transform);
stonePlatformJourney[i].stoneNumber = i; stonePlatformJourney[i].stoneNumber = i;