Force evolve added + tweaks

This commit is contained in:
Rapandrasmus 2023-06-24 22:51:34 +02:00
parent 1fcaaf1e29
commit 415d458fa0
4 changed files with 59 additions and 8 deletions

View file

@ -82,7 +82,7 @@ MonoBehaviour:
heightAmount: 2 heightAmount: 2
platformDistance: 3.8 platformDistance: 3.8
playerXPos: -6.78 playerXPos: -6.78
starLength: 16 starLength: 17
starHeight: 0.0625 starHeight: 0.0625
platformCount: 24 platformCount: 24
--- !u!1 &955264990193298390 --- !u!1 &955264990193298390
@ -626,6 +626,7 @@ MonoBehaviour:
firstEnable: 0 firstEnable: 0
playYan: {fileID: 1314280037714680423} playYan: {fileID: 1314280037714680423}
platformHandler: {fileID: 6715217060937385611} platformHandler: {fileID: 6715217060937385611}
starHandler: {fileID: 1199319499783283110}
jumpPaths: jumpPaths:
- name: Jump - name: Jump
preview: 0 preview: 0
@ -846,9 +847,11 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
starRef: {fileID: -5335075775997835892, guid: 8df651ffe21e1dc4fb223e94fdc9f9cb, type: 3} starRef: {fileID: -5335075775997835892, guid: 8df651ffe21e1dc4fb223e94fdc9f9cb, type: 3}
boundaryX: 25 boundaryX: 23
boundaryY: 15 boundaryY: 13
starCount: 80 starCount: 80
blinkFrequency: 0.125
blinkAmount: 5
--- !u!1 &5576704226004728173 --- !u!1 &5576704226004728173
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -78,6 +78,25 @@ namespace HeavenStudio.Games.Loaders
preFunction = delegate { var e = eventCaller.currentEntity; AgbNightWalk.WalkingCountIn(e.beat, e.length); }, preFunction = delegate { var e = eventCaller.currentEntity; AgbNightWalk.WalkingCountIn(e.beat, e.length); },
defaultLength = 4, defaultLength = 4,
resizable = true resizable = true
},
new GameAction("evolveAmount", "Star Evolve Amount")
{
function = delegate { AgbNightWalk.instance.evolveAmount = eventCaller.currentEntity["am"]; },
defaultLength = 0.5f,
parameters = new List<Param>()
{
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<Param>()
{
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 static AgbNightWalk instance;
public AgbPlayYan playYan; public AgbPlayYan playYan;
[SerializeField] private AgbPlatformHandler platformHandler; [SerializeField] private AgbPlatformHandler platformHandler;
public AgbStarHandler starHandler;
[NonSerialized] public double countInBeat = double.MinValue; [NonSerialized] public double countInBeat = double.MinValue;
[NonSerialized] public float countInLength = 8; [NonSerialized] public float countInLength = 8;
[Header("Curves")] [Header("Curves")]
@ -125,6 +145,8 @@ namespace HeavenStudio.Games
public FillType fillType; public FillType fillType;
} }
[NonSerialized] public int evolveAmount = 1;
new void OnDrawGizmos() new void OnDrawGizmos()
{ {
base.OnDrawGizmos(); base.OnDrawGizmos();
@ -183,6 +205,19 @@ namespace HeavenStudio.Games
} }
} }
public void ForceEvolve(double beat, float length, int starAmount, int repeatAmount)
{
List<BeatAction.Action> 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) public bool FishOnBeat(double beat)
{ {
return fishBeats.Contains(beat); return fishBeats.Contains(beat);

View file

@ -255,6 +255,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
anim.DoScaledAnimationAsync("Umbrella", 0.5f); anim.DoScaledAnimationAsync("Umbrella", 0.5f);
break; break;
} }
game.starHandler.Evolve(game.evolveAmount);
} }
private void Miss(PlayerActionEvent caller) private void Miss(PlayerActionEvent caller)

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using HeavenStudio.Util; using HeavenStudio.Util;
using System; using System;
using System.Linq;
namespace HeavenStudio.Games.Scripts_AgbNightWalk namespace HeavenStudio.Games.Scripts_AgbNightWalk
{ {
@ -62,7 +63,18 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
{ {
for (int i = 0; i < amount; i++) for (int i = 0; i < amount; i++)
{ {
currentStars[UnityEngine.Random.Range(0, currentStars.Length)].Evolve(); List<AgbStar> 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();
}
} }
} }