This commit is contained in:
Rapandrasmus 2023-02-27 04:05:40 +01:00 committed by GitHub
parent 06e4db40ec
commit 31da780d3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 25 deletions

View file

@ -72,6 +72,17 @@ MonoBehaviour:
anim: {fileID: 7858206046593675365} anim: {fileID: 7858206046593675365}
isSparkler: 0 isSparkler: 0
startBeat: 0 startBeat: 0
applause: 0
mixedCircularPS:
- {fileID: 7664406765439523904}
- {fileID: 3673341205867944704}
- {fileID: 4167151421496848976}
GreenOne: {fileID: 5765098608399448656, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3}
GreenTwo: {fileID: 4752919973026276924, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3}
BlueOne: {fileID: -6520747926329190954, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3}
BlueTwo: {fileID: 6428321784998494127, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3}
RedOne: {fileID: -4336169615699320128, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3}
RedTwo: {fileID: -590329476313837788, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3}
--- !u!1 &8256302341307776916 --- !u!1 &8256302341307776916
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1092,7 +1103,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.size propertyPath: UVModule.sprites.Array.size
value: 2 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: InitialModule.startSpeed.scalar propertyPath: InitialModule.startSpeed.scalar
@ -1121,7 +1132,7 @@ PrefabInstance:
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.data[0].sprite propertyPath: UVModule.sprites.Array.data[0].sprite
value: value:
objectReference: {fileID: 5765098608399448656, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.data[1].sprite propertyPath: UVModule.sprites.Array.data[1].sprite
value: value:
@ -1519,16 +1530,16 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
--- !u!4 &5350963641646200442 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7040894076345082557, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 3167216702444885191}
m_PrefabAsset: {fileID: 0}
--- !u!198 &6724070840057534837 stripped --- !u!198 &6724070840057534837 stripped
ParticleSystem: ParticleSystem:
m_CorrespondingSourceObject: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} m_CorrespondingSourceObject: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 3167216702444885191} m_PrefabInstance: {fileID: 3167216702444885191}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!4 &5350963641646200442 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7040894076345082557, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 3167216702444885191}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3817871415756461651 --- !u!1001 &3817871415756461651
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1870,16 +1881,16 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
--- !u!4 &6146720836347458798 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7040894076345082557, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 3817871415756461651}
m_PrefabAsset: {fileID: 0}
--- !u!198 &4782622495038528481 stripped --- !u!198 &4782622495038528481 stripped
ParticleSystem: ParticleSystem:
m_CorrespondingSourceObject: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} m_CorrespondingSourceObject: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 3817871415756461651} m_PrefabInstance: {fileID: 3817871415756461651}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!4 &6146720836347458798 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7040894076345082557, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 3817871415756461651}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &4551524690038054270 --- !u!1001 &4551524690038054270
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2216,7 +2227,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.size propertyPath: UVModule.sprites.Array.size
value: 2 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: ClampVelocityModule.x.scalar propertyPath: ClampVelocityModule.x.scalar
@ -2261,7 +2272,7 @@ PrefabInstance:
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.data[0].sprite propertyPath: UVModule.sprites.Array.data[0].sprite
value: value:
objectReference: {fileID: -4336169615699320128, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.data[1].sprite propertyPath: UVModule.sprites.Array.data[1].sprite
value: value:
@ -2392,6 +2403,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
--- !u!198 &3673341205867944704 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 4926604151301346994}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5435400981192353645 --- !u!1001 &5435400981192353645
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2983,7 +2999,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.size propertyPath: UVModule.sprites.Array.size
value: 2 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: InitialModule.startSpeed.scalar propertyPath: InitialModule.startSpeed.scalar
@ -3012,7 +3028,7 @@ PrefabInstance:
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.data[0].sprite propertyPath: UVModule.sprites.Array.data[0].sprite
value: value:
objectReference: {fileID: -6520747926329190954, guid: 106ee017e5083fb428d5c224afd8cb96, type: 3} objectReference: {fileID: 0}
- target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} - target: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
propertyPath: UVModule.sprites.Array.data[1].sprite propertyPath: UVModule.sprites.Array.data[1].sprite
value: value:
@ -3143,6 +3159,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
--- !u!198 &4167151421496848976 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 8549103140033023410, guid: 2b7f3b3b11d182f48a2ef357c8e876fc, type: 3}
m_PrefabInstance: {fileID: 5724134643533168610}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5833564722906346759 --- !u!1001 &5833564722906346759
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -15,25 +15,27 @@ namespace HeavenStudio.Games.Loaders
{ {
new GameAction("firework", "Firework") new GameAction("firework", "Firework")
{ {
preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, false, e["whereToSpawn"], e["toggle"], e["explosionType"], e["applause"]); }, preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, false, e["whereToSpawn"], e["toggle"], e["explosionType"], e["applause"], e["offSet"]); },
defaultLength = 4f, defaultLength = 4f,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("whereToSpawn", Fireworks.WhereToSpawn.Middle, "Where to spawn?", "Where should the firework spawn?"), new Param("whereToSpawn", Fireworks.WhereToSpawn.Middle, "Where to spawn?", "Where should the firework spawn?"),
new Param("explosionType", Fireworks.ExplosionType.MixedCircular, "Explosion Pattern", "What pattern should the firework explode with?"), new Param("explosionType", Fireworks.ExplosionType.MixedCircular, "Explosion Pattern", "What pattern should the firework explode with?"),
new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"), new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"),
new Param("offSet", new EntityTypes.Float(0, 4, 0), "Vertical Offset", "What vertical Offset should the rocket have?"),
new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?") new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?")
} }
}, },
new GameAction("sparkler", "Sparkler") new GameAction("sparkler", "Sparkler")
{ {
preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, true, e["whereToSpawn"], e["toggle"], e["explosionType"], e["applause"]); }, preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, true, e["whereToSpawn"], e["toggle"], e["explosionType"], e["applause"], e["offSet"]); },
defaultLength = 2f, defaultLength = 2f,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("whereToSpawn", Fireworks.WhereToSpawn.Middle, "Where to spawn?", "Where should the firework spawn?"), new Param("whereToSpawn", Fireworks.WhereToSpawn.Middle, "Where to spawn?", "Where should the firework spawn?"),
new Param("explosionType", Fireworks.ExplosionType.MixedCircular, "Explosion Pattern", "What pattern should the firework explode with?"), new Param("explosionType", Fireworks.ExplosionType.MixedCircular, "Explosion Pattern", "What pattern should the firework explode with?"),
new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"), new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"),
new Param("offSet", new EntityTypes.Float(0, 4, 0), "Vertical Offset", "What vertical Offset should the rocket have?"),
new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?") new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?")
} }
}, },
@ -91,6 +93,7 @@ namespace HeavenStudio.Games
public bool practice; public bool practice;
public int explosionType; public int explosionType;
public bool applause; public bool applause;
public float verticalOffset;
} }
public enum WhereToSpawn public enum WhereToSpawn
{ {
@ -142,7 +145,7 @@ namespace HeavenStudio.Games
{ {
foreach (var firework in queuedFireworks) foreach (var firework in queuedFireworks)
{ {
SpawnFirework(firework.beat, firework.isSparkler, firework.whereToSpawn, firework.practice, firework.explosionType, firework.applause); SpawnFirework(firework.beat, firework.isSparkler, firework.whereToSpawn, firework.practice, firework.explosionType, firework.applause, firework.verticalOffset);
} }
queuedFireworks.Clear(); queuedFireworks.Clear();
} }
@ -186,7 +189,7 @@ namespace HeavenStudio.Games
} }
} }
public static void PreSpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause) public static void PreSpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset)
{ {
if (isSparkler) if (isSparkler)
{ {
@ -208,18 +211,18 @@ namespace HeavenStudio.Games
{ {
new BeatAction.Action(beat, delegate new BeatAction.Action(beat, delegate
{ {
Fireworks.instance.SpawnFirework(beat, isSparkler, whereToSpawn, practice, explosionType, applause); Fireworks.instance.SpawnFirework(beat, isSparkler, whereToSpawn, practice, explosionType, applause, verticalOffset);
}) })
}); });
} }
else else
{ {
queuedFireworks.Add(new QueuedFirework { beat = beat, isSparkler = isSparkler, whereToSpawn = whereToSpawn, practice = practice, explosionType = explosionType, applause = applause }); queuedFireworks.Add(new QueuedFirework { beat = beat, isSparkler = isSparkler, whereToSpawn = whereToSpawn, practice = practice, explosionType = explosionType, applause = applause, verticalOffset = verticalOffset });
} }
} }
void SpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause) void SpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause, float verticalOffset)
{ {
if (isSparkler && practice) if (isSparkler && practice)
{ {
@ -254,6 +257,7 @@ namespace HeavenStudio.Games
} }
Rocket spawnedRocket = Instantiate(firework, spawnPoint, false); Rocket spawnedRocket = Instantiate(firework, spawnPoint, false);
spawnedRocket.isSparkler = isSparkler; spawnedRocket.isSparkler = isSparkler;
spawnedRocket.offSet = verticalOffset;
spawnedRocket.applause = applause; spawnedRocket.applause = applause;
spawnedRocket.Init(beat, explosionType); spawnedRocket.Init(beat, explosionType);
} }

View file

@ -18,16 +18,55 @@ namespace HeavenStudio.Games.Scripts_Fireworks
public bool applause; public bool applause;
private bool exploded; private bool exploded;
private float startY; private float startY;
public float offSet;
[SerializeField] List<ParticleSystem> mixedCircularPS = new List<ParticleSystem>();
[SerializeField] Sprite GreenOne;
[SerializeField] Sprite GreenTwo;
[SerializeField] Sprite BlueOne;
[SerializeField] Sprite BlueTwo;
[SerializeField] Sprite RedOne;
[SerializeField] Sprite RedTwo;
void Awake() void Awake()
{ {
game = Fireworks.instance; game = Fireworks.instance;
startY = transform.position.y; List<string> colors = new List<string>()
{
"Green",
"Red",
"Blue"
};
for (int i = 0; i < mixedCircularPS.Count; i++)
{
var ts = mixedCircularPS[i].textureSheetAnimation;
var pickedColor = colors[UnityEngine.Random.Range(0, colors.Count)];
switch (pickedColor)
{
case "Green":
ts.AddSprite(GreenOne);
ts.AddSprite(GreenTwo);
break;
case "Red":
ts.AddSprite(RedOne);
ts.AddSprite(RedTwo);
break;
case "Blue":
ts.AddSprite(BlueOne);
ts.AddSprite(BlueTwo);
break;
default:
ts.AddSprite(GreenOne);
ts.AddSprite(GreenTwo);
break;
}
colors.Remove(pickedColor);
}
} }
public void Init(float beat, int explosionToChoose) public void Init(float beat, int explosionToChoose)
{ {
startBeat = beat; startBeat = beat;
startY = transform.position.y - offSet;
game.ScheduleInput(beat, isSparkler ? 1f : 3f, InputType.STANDARD_DOWN, Just, Out, Out); game.ScheduleInput(beat, isSparkler ? 1f : 3f, InputType.STANDARD_DOWN, Just, Out, Out);
anim.DoScaledAnimationAsync(isSparkler ? "Sparkler" : "Rocket", isSparkler ? 1f : 0.5f); anim.DoScaledAnimationAsync(isSparkler ? "Sparkler" : "Rocket", isSparkler ? 1f : 0.5f);
selectedParticleEffect = particleEffects[explosionToChoose]; selectedParticleEffect = particleEffects[explosionToChoose];
@ -40,7 +79,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
if (!exploded && cond.isPlaying && !cond.isPaused) if (!exploded && cond.isPlaying && !cond.isPaused)
{ {
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.Linear); EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.Linear);
float newPosY = func(startY, 7f, normalizedBeat * (isSparkler ? 0.5f : 0.4f)); float newPosY = func(startY, 7f - offSet, normalizedBeat * (isSparkler ? 0.5f : 0.4f));
transform.position = new Vector3(transform.position.x, newPosY, transform.position.z); transform.position = new Vector3(transform.position.x, newPosY, transform.position.z);
} }
if (normalizedBeat > 3f && !selectedParticleEffect.isPlaying) Destroy(gameObject); if (normalizedBeat > 3f && !selectedParticleEffect.isPlaying) Destroy(gameObject);