From 415d458fa0541855fcf95e7e0313201f54560ffe Mon Sep 17 00:00:00 2001
From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
Date: Sat, 24 Jun 2023 22:51:34 +0200
Subject: [PATCH] Force evolve added + tweaks
---
Assets/Resources/Games/nightWalkAgb.prefab | 9 ++--
.../Games/NightWalkAgb/AgbNightWalk.cs | 43 +++++++++++++++++--
.../Scripts/Games/NightWalkAgb/AgbPlatform.cs | 1 +
.../Games/NightWalkAgb/AgbStarHandler.cs | 14 +++++-
4 files changed, 59 insertions(+), 8 deletions(-)
diff --git a/Assets/Resources/Games/nightWalkAgb.prefab b/Assets/Resources/Games/nightWalkAgb.prefab
index 565af30a5..96500727d 100644
--- a/Assets/Resources/Games/nightWalkAgb.prefab
+++ b/Assets/Resources/Games/nightWalkAgb.prefab
@@ -82,7 +82,7 @@ MonoBehaviour:
heightAmount: 2
platformDistance: 3.8
playerXPos: -6.78
- starLength: 16
+ starLength: 17
starHeight: 0.0625
platformCount: 24
--- !u!1 &955264990193298390
@@ -626,6 +626,7 @@ MonoBehaviour:
firstEnable: 0
playYan: {fileID: 1314280037714680423}
platformHandler: {fileID: 6715217060937385611}
+ starHandler: {fileID: 1199319499783283110}
jumpPaths:
- name: Jump
preview: 0
@@ -846,9 +847,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
starRef: {fileID: -5335075775997835892, guid: 8df651ffe21e1dc4fb223e94fdc9f9cb, type: 3}
- boundaryX: 25
- boundaryY: 15
+ boundaryX: 23
+ boundaryY: 13
starCount: 80
+ blinkFrequency: 0.125
+ blinkAmount: 5
--- !u!1 &5576704226004728173
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
index 788836c79..31d109dfd 100644
--- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
+++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs
@@ -44,13 +44,13 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("type", "Platform Type")
{
- preFunction = delegate
- {
- var e = eventCaller.currentEntity;
+ preFunction = delegate
+ {
+ var e = eventCaller.currentEntity;
if (e["type"] == (int)AgbNightWalk.PlatformType.Umbrella)
{
AgbNightWalk.FillSound(e.beat, (AgbNightWalk.FillType)e["fill"]);
- }
+ }
},
parameters = new List()
{
@@ -78,6 +78,25 @@ namespace HeavenStudio.Games.Loaders
preFunction = delegate { var e = eventCaller.currentEntity; AgbNightWalk.WalkingCountIn(e.beat, e.length); },
defaultLength = 4,
resizable = true
+ },
+ new GameAction("evolveAmount", "Star Evolve Amount")
+ {
+ function = delegate { AgbNightWalk.instance.evolveAmount = eventCaller.currentEntity["am"]; },
+ defaultLength = 0.5f,
+ parameters = new List()
+ {
+ new Param("am", new EntityTypes.Integer(0, 100, 1), "Amount", "How many stars will evolve when play-yan jumps?"),
+ }
+ },
+ new GameAction("forceEvolve", "Force Star Evolve")
+ {
+ function = delegate { var e = eventCaller.currentEntity; AgbNightWalk.instance.ForceEvolve(e.beat, e.length, e["am"], e["repeat"]); },
+ resizable = true,
+ parameters = new List()
+ {
+ new Param("am", new EntityTypes.Integer(0, 100, 1), "Star Amount", "How many stars will evolve?"),
+ new Param("repeat", new EntityTypes.Integer(0, 100, 1), "Repeat Amount", "How many times will this event repeat?"),
+ }
}
});
}
@@ -107,6 +126,7 @@ namespace HeavenStudio.Games
public static AgbNightWalk instance;
public AgbPlayYan playYan;
[SerializeField] private AgbPlatformHandler platformHandler;
+ public AgbStarHandler starHandler;
[NonSerialized] public double countInBeat = double.MinValue;
[NonSerialized] public float countInLength = 8;
[Header("Curves")]
@@ -125,6 +145,8 @@ namespace HeavenStudio.Games
public FillType fillType;
}
+ [NonSerialized] public int evolveAmount = 1;
+
new void OnDrawGizmos()
{
base.OnDrawGizmos();
@@ -183,6 +205,19 @@ namespace HeavenStudio.Games
}
}
+ public void ForceEvolve(double beat, float length, int starAmount, int repeatAmount)
+ {
+ List actions = new();
+ for (int i = 0; i < repeatAmount; i++)
+ {
+ actions.Add(new BeatAction.Action(beat + (length * i), delegate
+ {
+ starHandler.Evolve(starAmount);
+ }));
+ }
+ BeatAction.New(instance.gameObject, actions);
+ }
+
public bool FishOnBeat(double beat)
{
return fishBeats.Contains(beat);
diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
index 4cdadf1ff..9811e04e8 100644
--- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
+++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatform.cs
@@ -255,6 +255,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
anim.DoScaledAnimationAsync("Umbrella", 0.5f);
break;
}
+ game.starHandler.Evolve(game.evolveAmount);
}
private void Miss(PlayerActionEvent caller)
diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs b/Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs
index 6e45d9ff2..674c12bee 100644
--- a/Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs
+++ b/Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using System;
+using System.Linq;
namespace HeavenStudio.Games.Scripts_AgbNightWalk
{
@@ -62,7 +63,18 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
{
for (int i = 0; i < amount; i++)
{
- currentStars[UnityEngine.Random.Range(0, currentStars.Length)].Evolve();
+ List nonEvolvedStars = currentStars.ToList().FindAll(x => x.evoStage == collectiveEvoStage);
+ if (nonEvolvedStars.Count > 0)
+ {
+ AgbStar randomStar = nonEvolvedStars[UnityEngine.Random.Range(0, nonEvolvedStars.Count)];
+ randomStar.Evolve();
+ }
+ else
+ {
+ collectiveEvoStage++;
+ if (collectiveEvoStage > 5) collectiveEvoStage = 5;
+ currentStars[UnityEngine.Random.Range(0, currentStars.Length)].Evolve();
+ }
}
}