mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-22 09:35:11 +00:00
lockstep fix (#971)
This commit is contained in:
parent
04ef373976
commit
2ae2cac02c
9 changed files with 156 additions and 188 deletions
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Jukebox;
|
using Jukebox;
|
||||||
using HeavenStudio.Games;
|
using HeavenStudio.Games;
|
||||||
|
using HeavenStudio.Util;
|
||||||
|
|
||||||
namespace HeavenStudio
|
namespace HeavenStudio
|
||||||
{
|
{
|
||||||
|
@ -66,7 +67,7 @@ namespace HeavenStudio
|
||||||
Minigames.Init(this);
|
Minigames.Init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CallEvent(RiqEntity entity, bool gameActive)
|
public void CallEvent(RiqEntity entity, bool gameActive, bool preEvent = false)
|
||||||
{
|
{
|
||||||
string[] details = entity.datamodel.Split('/');
|
string[] details = entity.datamodel.Split('/');
|
||||||
Minigames.Minigame game = minigames[details[0]];
|
Minigames.Minigame game = minigames[details[0]];
|
||||||
|
@ -77,14 +78,22 @@ namespace HeavenStudio
|
||||||
if (details.Length > 2) currentSwitchGame = details[2];
|
if (details.Length > 2) currentSwitchGame = details[2];
|
||||||
|
|
||||||
Minigames.GameAction action = game.actions.Find(c => c.actionName == details[1]);
|
Minigames.GameAction action = game.actions.Find(c => c.actionName == details[1]);
|
||||||
if (gameActive)
|
if (preEvent)
|
||||||
{
|
{
|
||||||
action.function.Invoke();
|
action.preFunction.Invoke();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
action.inactiveFunction.Invoke();
|
if (gameActive)
|
||||||
|
{
|
||||||
|
action.function.Invoke();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
action.inactiveFunction.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -92,22 +101,22 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CallPreEvent(RiqEntity entity)
|
// public void CallPreEvent(RiqEntity entity)
|
||||||
{
|
// {
|
||||||
string[] details = entity.datamodel.Split('/');
|
// string[] details = entity.datamodel.Split('/');
|
||||||
Minigames.Minigame game = minigames[details[0]];
|
// Minigames.Minigame game = minigames[details[0]];
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
currentEntity = entity;
|
// currentEntity = entity;
|
||||||
|
|
||||||
Minigames.GameAction action = game.actions.Find(c => c.actionName == details[1]);
|
// Minigames.GameAction action = game.actions.Find(c => c.actionName == details[1]);
|
||||||
action.preFunction.Invoke();
|
// action.preFunction.Invoke();
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
Debug.LogWarning("Event not found! May be spelled wrong or it is not implemented.\n" + ex);
|
// Debug.LogWarning("Event not found! May be spelled wrong or it is not implemented.\n" + ex);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static List<RiqEntity> GetAllInGameManagerList(string gameName)
|
public static List<RiqEntity> GetAllInGameManagerList(string gameName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -445,7 +445,8 @@ namespace HeavenStudio
|
||||||
|
|
||||||
foreach (RiqEntity entity in entitiesInRange)
|
foreach (RiqEntity entity in entitiesInRange)
|
||||||
{
|
{
|
||||||
eventCaller.CallPreEvent(entity);
|
// no, the second parameter doesn't matter here. i don't know a good way to make it work better, tho
|
||||||
|
eventCaller.CallEvent(entity, true, true);
|
||||||
currentPreSequence++;
|
currentPreSequence++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Loaders
|
||||||
function = delegate { AirRally.instance.SetDistance(e.currentEntity.beat, e.currentEntity["type"], e.currentEntity["ease"]); },
|
function = delegate { AirRally.instance.SetDistance(e.currentEntity.beat, e.currentEntity["type"], e.currentEntity["ease"]); },
|
||||||
parameters = new List<Param>()
|
parameters = new List<Param>()
|
||||||
{
|
{
|
||||||
new Param("type", AirRally.DistanceSound.close, "Type", "Set Forthington's distance."),
|
new Param("type", AirRally.DistanceSound.Close, "Type", "Set Forthington's distance."),
|
||||||
new Param("ease", EasingFunction.Ease.EaseOutQuad, "Ease", "Set the easing of the action.")
|
new Param("ease", EasingFunction.Ease.EaseOutQuad, "Ease", "Set the easing of the action.")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -375,10 +375,11 @@ namespace HeavenStudio.Games
|
||||||
instance = this;
|
instance = this;
|
||||||
forthTrans = Forthington.transform;
|
forthTrans = Forthington.transform;
|
||||||
baxterTrans = Baxter.transform;
|
baxterTrans = Baxter.transform;
|
||||||
if (!Conductor.instance.isPlaying)
|
// lags the game WAY too much when seeking
|
||||||
{
|
// if (!Conductor.instance.isPlaying)
|
||||||
InitClouds(0);
|
// {
|
||||||
}
|
// InitClouds(0);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -743,10 +744,10 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public enum DistanceSound
|
public enum DistanceSound
|
||||||
{
|
{
|
||||||
close = 0,
|
Close = 0,
|
||||||
far = 1,
|
Far = 1,
|
||||||
farther = 2,
|
Farther = 2,
|
||||||
farthest = 3
|
Farthest = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CountSound
|
public enum CountSound
|
||||||
|
@ -817,7 +818,7 @@ namespace HeavenStudio.Games
|
||||||
public static void ForthCountIn4(double beat, float length)
|
public static void ForthCountIn4(double beat, float length)
|
||||||
{
|
{
|
||||||
float realLength = length / 4;
|
float realLength = length / 4;
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
MultiSound.Play(new List<MultiSound.Sound>
|
||||||
{
|
{
|
||||||
new MultiSound.Sound("airRally/en/countIn1" + GetDistanceStringAtBeat(beat, true), beat, 1, 1, false, countInOffsets[0]),
|
new MultiSound.Sound("airRally/en/countIn1" + GetDistanceStringAtBeat(beat, true), beat, 1, 1, false, countInOffsets[0]),
|
||||||
new MultiSound.Sound("airRally/en/countIn2" + GetDistanceStringAtBeat(beat + (1 * realLength), true), beat + (1 * realLength), 1, 1, false, countInOffsets[1]),
|
new MultiSound.Sound("airRally/en/countIn2" + GetDistanceStringAtBeat(beat + (1 * realLength), true), beat + (1 * realLength), 1, 1, false, countInOffsets[1]),
|
||||||
|
@ -897,7 +898,7 @@ namespace HeavenStudio.Games
|
||||||
public static void ForthCountIn8(double beat, float length)
|
public static void ForthCountIn8(double beat, float length)
|
||||||
{
|
{
|
||||||
float realLength = length / 8;
|
float realLength = length / 8;
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
MultiSound.Play(new List<MultiSound.Sound>
|
||||||
{
|
{
|
||||||
new MultiSound.Sound("airRally/en/countIn1" + GetDistanceStringAtBeat(beat, true), beat, 1, 1, false, countInOffsets[0]),
|
new MultiSound.Sound("airRally/en/countIn1" + GetDistanceStringAtBeat(beat, true), beat, 1, 1, false, countInOffsets[0]),
|
||||||
new MultiSound.Sound("airRally/en/countIn2" + GetDistanceStringAtBeat(beat + (2 * realLength), true), beat + (2 * realLength), 1, 1, false, countInOffsets[1]),
|
new MultiSound.Sound("airRally/en/countIn2" + GetDistanceStringAtBeat(beat + (2 * realLength), true), beat + (2 * realLength), 1, 1, false, countInOffsets[1]),
|
||||||
|
@ -929,48 +930,23 @@ namespace HeavenStudio.Games
|
||||||
float offset = countInOffsets[type];
|
float offset = countInOffsets[type];
|
||||||
|
|
||||||
DistanceSound distance = DistanceAtBeat(beat);
|
DistanceSound distance = DistanceAtBeat(beat);
|
||||||
|
string countInType = GetDistanceStringAtBeat(beat);
|
||||||
|
|
||||||
switch (distance)
|
SoundByte.PlayOneShotGame($"airRally/en/countIn{type + 1}" + countInType, beat, 1, 1, false, true, offset);
|
||||||
{
|
|
||||||
case DistanceSound.close:
|
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
|
||||||
{
|
|
||||||
new MultiSound.Sound($"airRally/en/countIn{type + 1}", beat, 1, 1, false, offset),
|
|
||||||
}, forcePlay: true);
|
|
||||||
break;
|
|
||||||
case DistanceSound.far:
|
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
|
||||||
{
|
|
||||||
new MultiSound.Sound($"airRally/en/countIn{type + 1}Far", beat, 1, 1, false, offset),
|
|
||||||
}, forcePlay: true);
|
|
||||||
break;
|
|
||||||
case DistanceSound.farther:
|
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
|
||||||
{
|
|
||||||
new MultiSound.Sound($"airRally/en/countIn{type + 1}Farther", beat, 1, 1, false, offset),
|
|
||||||
}, forcePlay: true);
|
|
||||||
break;
|
|
||||||
case DistanceSound.farthest:
|
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
|
||||||
{
|
|
||||||
new MultiSound.Sound($"airRally/en/countIn{type + 1}Farthest", beat, 1, 1, false, offset),
|
|
||||||
}, forcePlay: true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void SetDistance(double beat, int type, int ease)
|
public void SetDistance(double beat, int type, int ease)
|
||||||
{
|
{
|
||||||
wayPointStartBeat = beat;
|
wayPointStartBeat = beat;
|
||||||
currentEase = (HeavenStudio.Util.EasingFunction.Ease)ease;
|
currentEase = (Util.EasingFunction.Ease)ease;
|
||||||
lastWayPointZForForth = wayPointZForForth;
|
lastWayPointZForForth = wayPointZForForth;
|
||||||
wayPointZForForth = (DistanceSound)type switch
|
wayPointZForForth = (DistanceSound)type switch
|
||||||
{
|
{
|
||||||
DistanceSound.close => 3.55f,
|
DistanceSound.Close => 3.55f,
|
||||||
DistanceSound.far => 35.16f,
|
DistanceSound.Far => 35.16f,
|
||||||
DistanceSound.farther => 105.16f,
|
DistanceSound.Farther => 105.16f,
|
||||||
DistanceSound.farthest => 255.16f,
|
DistanceSound.Farthest => 255.16f,
|
||||||
_ => throw new System.NotImplementedException()
|
_ => throw new System.NotImplementedException()
|
||||||
};
|
};
|
||||||
DistanceUpdate();
|
DistanceUpdate();
|
||||||
|
@ -979,45 +955,48 @@ namespace HeavenStudio.Games
|
||||||
private static DistanceSound DistanceAtBeat(double beat)
|
private static DistanceSound DistanceAtBeat(double beat)
|
||||||
{
|
{
|
||||||
var allDistances = EventCaller.GetAllInGameManagerList("airRally", new string[] { "set distance" }).FindAll(x => x.beat <= beat);
|
var allDistances = EventCaller.GetAllInGameManagerList("airRally", new string[] { "set distance" }).FindAll(x => x.beat <= beat);
|
||||||
if (allDistances.Count == 0) return DistanceSound.close;
|
if (allDistances.Count == 0) return DistanceSound.Close;
|
||||||
return (DistanceSound)allDistances[^1]["type"];
|
return (DistanceSound)allDistances[^1]["type"];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetDistanceStringAtBeat(double beat, bool emptyClose = false, bool farFarther = false)
|
private static string GetDistanceStringAtBeat(double beat, bool emptyClose = false, bool farFarther = false)
|
||||||
{
|
{
|
||||||
if (farFarther)
|
// var distanceAtBeat = DistanceAtBeat(beat);
|
||||||
{
|
return DistanceAtBeat(beat).ToString();
|
||||||
return DistanceAtBeat(beat) switch
|
// if (farFarther)
|
||||||
{
|
// {
|
||||||
DistanceSound.close => "Close",
|
|
||||||
DistanceSound.far => "Far",
|
// return DistanceAtBeat(beat) switch
|
||||||
DistanceSound.farther => "Far",
|
// {
|
||||||
DistanceSound.farthest => "Farthest",
|
// DistanceSound.Close => "Close",
|
||||||
_ => throw new System.NotImplementedException()
|
// DistanceSound.Far => "Far",
|
||||||
};
|
// DistanceSound.Farther => "Far",
|
||||||
}
|
// DistanceSound.Farthest => "Farthest",
|
||||||
else if (emptyClose)
|
// _ => throw new System.NotImplementedException()
|
||||||
{
|
// };
|
||||||
return DistanceAtBeat(beat) switch
|
// }
|
||||||
{
|
// else if (emptyClose)
|
||||||
DistanceSound.close => "",
|
// {
|
||||||
DistanceSound.far => "Far",
|
// return DistanceAtBeat(beat) switch
|
||||||
DistanceSound.farther => "Farther",
|
// {
|
||||||
DistanceSound.farthest => "Farthest",
|
// DistanceSound.Close => "",
|
||||||
_ => throw new System.NotImplementedException()
|
// DistanceSound.Far => "Far",
|
||||||
};
|
// DistanceSound.Farther => "Farther",
|
||||||
}
|
// DistanceSound.Farthest => "Farthest",
|
||||||
else
|
// _ => throw new System.NotImplementedException()
|
||||||
{
|
// };
|
||||||
return DistanceAtBeat(beat) switch
|
// }
|
||||||
{
|
// else
|
||||||
DistanceSound.close => "Close",
|
// {
|
||||||
DistanceSound.far => "Far",
|
// return DistanceAtBeat(beat) switch
|
||||||
DistanceSound.farther => "Farther",
|
// {
|
||||||
DistanceSound.farthest => "Farthest",
|
// DistanceSound.Close => "Close",
|
||||||
_ => throw new System.NotImplementedException()
|
// DistanceSound.Far => "Far",
|
||||||
};
|
// DistanceSound.Farther => "Farther",
|
||||||
}
|
// DistanceSound.Farthest => "Farthest",
|
||||||
|
// _ => throw new System.NotImplementedException()
|
||||||
|
// };
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryGetLastDistanceEvent(double beat, out RiqEntity distanceEvent)
|
private static bool TryGetLastDistanceEvent(double beat, out RiqEntity distanceEvent)
|
||||||
|
@ -1259,7 +1238,7 @@ namespace HeavenStudio.Games
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
ScheduleInput(beat, 1f, InputAction_FlickPress, RallyOnHit, RallyOnMiss, RallyEmpty);
|
ScheduleInput(beat, 1f, InputAction_FlickPress, RallyOnHit, RallyOnMiss, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsBaBumBeat(double beat)
|
private bool IsBaBumBeat(double beat)
|
||||||
|
@ -1350,7 +1329,7 @@ namespace HeavenStudio.Games
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiSound.Play(sounds.ToArray());
|
MultiSound.Play(sounds);
|
||||||
|
|
||||||
BeatAction.New(this, new List<BeatAction.Action>()
|
BeatAction.New(this, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
|
@ -1377,7 +1356,7 @@ namespace HeavenStudio.Games
|
||||||
new BeatAction.Action(beat + 4f, delegate { Forthington.DoScaledAnimationAsync("Ready", 0.5f); }),
|
new BeatAction.Action(beat + 4f, delegate { Forthington.DoScaledAnimationAsync("Ready", 0.5f); }),
|
||||||
});
|
});
|
||||||
|
|
||||||
ScheduleInput(beat, 4f, InputAction_FlickPress, LongShotOnHit, RallyOnMiss, RallyEmpty);
|
ScheduleInput(beat, 4f, InputAction_FlickPress, LongShotOnHit, RallyOnMiss, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1406,14 +1385,7 @@ namespace HeavenStudio.Games
|
||||||
ReturnObject(Conductor.instance.songPositionInBeatsAsDouble, caller.startBeat + caller.timer + 1f, false);
|
ReturnObject(Conductor.instance.songPositionInBeatsAsDouble, caller.startBeat + caller.timer + 1f, false);
|
||||||
hasMissed = false;
|
hasMissed = false;
|
||||||
ActiveShuttle.DoHit(DistanceAtBeat(caller.startBeat + caller.timer));
|
ActiveShuttle.DoHit(DistanceAtBeat(caller.startBeat + caller.timer));
|
||||||
string distanceString = DistanceAtBeat(caller.startBeat + caller.timer) switch
|
string distanceString = GetDistanceStringAtBeat(caller.startBeat + caller.timer);
|
||||||
{
|
|
||||||
DistanceSound.close => "Close",
|
|
||||||
DistanceSound.far => "Far",
|
|
||||||
DistanceSound.farther => "Farther",
|
|
||||||
DistanceSound.farthest => "Farthest",
|
|
||||||
_ => throw new System.NotImplementedException()
|
|
||||||
};
|
|
||||||
|
|
||||||
SoundByte.PlayOneShotGame("airRally/hitBaxter_" + distanceString);
|
SoundByte.PlayOneShotGame("airRally/hitBaxter_" + distanceString);
|
||||||
|
|
||||||
|
@ -1446,14 +1418,7 @@ namespace HeavenStudio.Games
|
||||||
hasMissed = false;
|
hasMissed = false;
|
||||||
ActiveShuttle.DoHit(DistanceAtBeat(caller.startBeat + caller.timer));
|
ActiveShuttle.DoHit(DistanceAtBeat(caller.startBeat + caller.timer));
|
||||||
|
|
||||||
string distanceString = DistanceAtBeat(caller.startBeat + caller.timer) switch
|
string distanceString = GetDistanceStringAtBeat(caller.startBeat + caller.timer);
|
||||||
{
|
|
||||||
DistanceSound.close => "Close",
|
|
||||||
DistanceSound.far => "Far",
|
|
||||||
DistanceSound.farther => "Farther",
|
|
||||||
DistanceSound.farthest => "Farthest",
|
|
||||||
_ => throw new System.NotImplementedException()
|
|
||||||
};
|
|
||||||
|
|
||||||
if (distanceString == "Close")
|
if (distanceString == "Close")
|
||||||
{
|
{
|
||||||
|
@ -1481,11 +1446,6 @@ namespace HeavenStudio.Games
|
||||||
shuttleActive = false;
|
shuttleActive = false;
|
||||||
ActiveShuttle = null;
|
ActiveShuttle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RallyEmpty(PlayerActionEvent caller)
|
|
||||||
{
|
|
||||||
//empty
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,29 +47,32 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cloud GetAvailableCloud()
|
|
||||||
{
|
|
||||||
foreach (Cloud cloud in pool)
|
|
||||||
{
|
|
||||||
if (!cloud.isWorking)
|
|
||||||
{
|
|
||||||
return cloud;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if (pool == null) return;
|
||||||
time += Time.deltaTime;
|
time += Time.deltaTime;
|
||||||
if (time - lastTime > cloudRepeatRate)
|
if (time - lastTime > cloudRepeatRate)
|
||||||
{
|
{
|
||||||
lastTime = time;
|
lastTime = time;
|
||||||
GetAvailableCloud()?.StartCloud(cloudRoot.position, false);
|
var cloud = GetAvailableCloud();
|
||||||
|
if (cloud != null) cloud.StartCloud(cloudRoot.position, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cloud GetAvailableCloud()
|
||||||
|
{
|
||||||
|
if (pool != null) {
|
||||||
|
foreach (Cloud cloud in pool)
|
||||||
|
{
|
||||||
|
if (!cloud.isWorking)
|
||||||
|
{
|
||||||
|
return cloud;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetCloudsPerSecond(int cloudsPerSec)
|
public void SetCloudsPerSecond(int cloudsPerSec)
|
||||||
{
|
{
|
||||||
cloudsPerSecond = cloudsPerSec;
|
cloudsPerSecond = cloudsPerSec;
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||||
[NonSerialized] public float flyPos;
|
[NonSerialized] public float flyPos;
|
||||||
[NonSerialized] public bool isReturning;
|
[NonSerialized] public bool isReturning;
|
||||||
[NonSerialized] public bool isTossed = false;
|
[NonSerialized] public bool isTossed = false;
|
||||||
[NonSerialized] public AirRally.DistanceSound currentDist = AirRally.DistanceSound.close;
|
[NonSerialized] public AirRally.DistanceSound currentDist = AirRally.DistanceSound.Close;
|
||||||
AirRally game;
|
AirRally game;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
@ -58,7 +58,7 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
|
|
||||||
bool isFartherOrMore = currentDist != AirRally.DistanceSound.close && currentDist != AirRally.DistanceSound.far;
|
bool isFartherOrMore = currentDist != AirRally.DistanceSound.Close && currentDist != AirRally.DistanceSound.Far;
|
||||||
|
|
||||||
Vector3 lastPos = transform.position;
|
Vector3 lastPos = transform.position;
|
||||||
if (!rb.simulated)
|
if (!rb.simulated)
|
||||||
|
@ -122,16 +122,16 @@ namespace HeavenStudio.Games.Scripts_AirRally
|
||||||
ParticleSystem.MainModule main = hitEffect.main;
|
ParticleSystem.MainModule main = hitEffect.main;
|
||||||
switch (distance)
|
switch (distance)
|
||||||
{
|
{
|
||||||
case AirRally.DistanceSound.close:
|
case AirRally.DistanceSound.Close:
|
||||||
main.startSize = 2f;
|
main.startSize = 2f;
|
||||||
break;
|
break;
|
||||||
case AirRally.DistanceSound.far:
|
case AirRally.DistanceSound.Far:
|
||||||
main.startSize = 3f;
|
main.startSize = 3f;
|
||||||
break;
|
break;
|
||||||
case AirRally.DistanceSound.farther:
|
case AirRally.DistanceSound.Farther:
|
||||||
main.startSize = 4f;
|
main.startSize = 4f;
|
||||||
break;
|
break;
|
||||||
case AirRally.DistanceSound.farthest:
|
case AirRally.DistanceSound.Farthest:
|
||||||
main.startSize = 6f;
|
main.startSize = 6f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace HeavenStudio.Games
|
||||||
assistantCanBop = false;
|
assistantCanBop = false;
|
||||||
string twoSound = "boardMeeting/two";
|
string twoSound = "boardMeeting/two";
|
||||||
if (beat % 1 != 0) twoSound = "boardMeeting/twoUra";
|
if (beat % 1 != 0) twoSound = "boardMeeting/twoUra";
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
MultiSound.Play(new List<MultiSound.Sound>
|
||||||
{
|
{
|
||||||
new MultiSound.Sound("boardMeeting/one", beat),
|
new MultiSound.Sound("boardMeeting/one", beat),
|
||||||
new MultiSound.Sound(twoSound, beat + 0.5f),
|
new MultiSound.Sound(twoSound, beat + 0.5f),
|
||||||
|
|
|
@ -215,7 +215,7 @@ namespace HeavenStudio.Games
|
||||||
{ SetFace(idx, 4); Lion[idx].GetComponent<Animator>().Play("Clap", 0, 0); }));
|
{ SetFace(idx, 4); Lion[idx].GetComponent<Animator>().Play("Clap", 0, 0); }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sounds.Count > 0) clapSounds = MultiSound.Play(sounds.ToArray());
|
if (sounds.Count > 0) clapSounds = MultiSound.Play(sounds);
|
||||||
if (actions.Count > 0) clapAction = BeatAction.New(this, actions);
|
if (actions.Count > 0) clapAction = BeatAction.New(this, actions);
|
||||||
|
|
||||||
// prepare player input
|
// prepare player input
|
||||||
|
|
|
@ -308,7 +308,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public override void OnGameSwitch(double beat)
|
public override void OnGameSwitch(double beat)
|
||||||
{
|
{
|
||||||
QueueSwitchBGs(beat);
|
QueueSwitches(beat);
|
||||||
foreach (var evt in scheduledInputs)
|
foreach (var evt in scheduledInputs)
|
||||||
{
|
{
|
||||||
evt.Disable();
|
evt.Disable();
|
||||||
|
@ -318,30 +318,28 @@ namespace HeavenStudio.Games
|
||||||
public override void OnPlay(double beat)
|
public override void OnPlay(double beat)
|
||||||
{
|
{
|
||||||
queuedInputs.Clear();
|
queuedInputs.Clear();
|
||||||
QueueSwitchBGs(beat);
|
QueueSwitches(beat);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QueueSwitchBGs(double beat)
|
private void QueueSwitches(double beat)
|
||||||
{
|
{
|
||||||
double nextGameSwitchBeat = double.MaxValue;
|
double nextGameSwitchBeat = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).Find(x => x.beat > beat)?.beat ?? double.MaxValue;
|
||||||
List<RiqEntity> allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).FindAll(x => x.beat > beat);
|
|
||||||
if (allEnds.Count > 0)
|
|
||||||
{
|
|
||||||
nextGameSwitchBeat = allEnds[0].beat;
|
|
||||||
}
|
|
||||||
|
|
||||||
var switchEventsOn = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "onbeatSwitch" });
|
foreach (var entity in gameManager.Beatmap.Entities)
|
||||||
foreach (var on in switchEventsOn)
|
|
||||||
{
|
{
|
||||||
if (on.beat >= nextGameSwitchBeat) continue;
|
switch (entity.datamodel)
|
||||||
OnbeatSwitch(on.beat, beat, on["visual"]);
|
{
|
||||||
}
|
case "lockstep/onbeatSwitch": {
|
||||||
|
if (entity.beat >= nextGameSwitchBeat) continue;
|
||||||
|
OnbeatSwitch(entity.beat, beat, entity["visual"]);
|
||||||
|
} break;
|
||||||
|
case "lockstep/offbeatSwitch": {
|
||||||
|
if (entity.beat >= nextGameSwitchBeat) continue;
|
||||||
|
OffbeatSwitch(entity.beat, beat, entity["visual"]);
|
||||||
|
} break;
|
||||||
|
|
||||||
var switchEventsOff = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "offbeatSwitch" });
|
default: continue;
|
||||||
foreach (var off in switchEventsOff)
|
}
|
||||||
{
|
|
||||||
if (off.beat >= nextGameSwitchBeat) continue;
|
|
||||||
OffbeatSwitch(off.beat, beat, off["visual"]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +355,6 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
EntityPreCheck(Conductor.instance.songPositionInBeatsAsDouble);
|
EntityPreCheck(Conductor.instance.songPositionInBeatsAsDouble);
|
||||||
|
|
||||||
|
|
||||||
masterSprite = masterStepperSprite.sprite;
|
masterSprite = masterStepperSprite.sprite;
|
||||||
stepswitcherLeft.gameObject.SetActive(lessSteppers);
|
stepswitcherLeft.gameObject.SetActive(lessSteppers);
|
||||||
stepswitcherRight.gameObject.SetActive(lessSteppers);
|
stepswitcherRight.gameObject.SetActive(lessSteppers);
|
||||||
|
@ -496,12 +493,11 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (sound)
|
if (sound)
|
||||||
{
|
{
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
MultiSound.Play(new List<MultiSound.Sound> {
|
||||||
{
|
new MultiSound.Sound("lockstep/nha1", beat, 1, 1, false, 0),
|
||||||
new MultiSound.Sound("lockstep/nha1", beat, 1, 1, false, 0),
|
new MultiSound.Sound("lockstep/nha2", beat + 0.5f, 1, 1, false, 0.01),
|
||||||
new MultiSound.Sound("lockstep/nha2", beat + 0.5f, 1, 1, false, 0.01),
|
new MultiSound.Sound("lockstep/nha1", beat + 1f, 1, 1, false, 0),
|
||||||
new MultiSound.Sound("lockstep/nha1", beat + 1f, 1, 1, false, 0),
|
new MultiSound.Sound("lockstep/nha2", beat + 1.5f, 1, 1, false, 0.01)
|
||||||
new MultiSound.Sound("lockstep/nha2", beat + 1.5f, 1, 1, false, 0.01)
|
|
||||||
}, forcePlay: true);
|
}, forcePlay: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +524,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
var haisActual = haisList.FindAll(x => x.beat < nextOffBeat);
|
var haisActual = haisList.FindAll(x => x.beat < nextOffBeat);
|
||||||
|
|
||||||
MultiSound.Play(haisActual.ToArray(), true, true);
|
MultiSound.Play(haisActual, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,14 +541,14 @@ namespace HeavenStudio.Games
|
||||||
new BeatAction.Action(beat + 1.5f, delegate
|
new BeatAction.Action(beat + 1.5f, delegate
|
||||||
{
|
{
|
||||||
if (visual) ChangeBeatBackGroundColour(true);
|
if (visual) ChangeBeatBackGroundColour(true);
|
||||||
|
if (!marchRecursing && !ForceStepOnBeat(beat + 2f)) MarchRecursive(beat + 2f);
|
||||||
}),
|
}),
|
||||||
new BeatAction.Action(beat + 1.5f, delegate { if (!marchRecursing && !ForceStepOnBeat(beat + 2f)) MarchRecursive(beat + 2f); }),
|
|
||||||
new BeatAction.Action(beat + 2f, delegate { if (visual) ChangeBeatBackGroundColour(false); }),
|
new BeatAction.Action(beat + 2f, delegate { if (visual) ChangeBeatBackGroundColour(false); }),
|
||||||
};
|
};
|
||||||
List<BeatAction.Action> actions = new();
|
List<BeatAction.Action> actions = new();
|
||||||
foreach (var action in allActions)
|
foreach (var action in allActions)
|
||||||
{
|
{
|
||||||
if (action.beat >= gameswitchBeat) actions.Add(action);
|
if (action.beat + 0.5 >= gameswitchBeat) actions.Add(action);
|
||||||
}
|
}
|
||||||
if (actions.Count > 0) BeatAction.New(instance, actions);
|
if (actions.Count > 0) BeatAction.New(instance, actions);
|
||||||
}
|
}
|
||||||
|
@ -561,8 +557,7 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
if (sound)
|
if (sound)
|
||||||
{
|
{
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
MultiSound.Play(new List<MultiSound.Sound> {
|
||||||
{
|
|
||||||
new MultiSound.Sound("lockstep/hai", beat, 1, 1, false, 0.018),
|
new MultiSound.Sound("lockstep/hai", beat, 1, 1, false, 0.018),
|
||||||
new MultiSound.Sound("lockstep/hai", beat + 1f, 1, 1, false, 0.018),
|
new MultiSound.Sound("lockstep/hai", beat + 1f, 1, 1, false, 0.018),
|
||||||
new MultiSound.Sound("lockstep/hai", beat + 2f, 1, 1, false, 0.018),
|
new MultiSound.Sound("lockstep/hai", beat + 2f, 1, 1, false, 0.018),
|
||||||
|
@ -594,7 +589,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
var hosActual = hos.FindAll(x => x.beat < nextOnBeat);
|
var hosActual = hos.FindAll(x => x.beat < nextOnBeat);
|
||||||
|
|
||||||
MultiSound.Play(hosActual.ToArray(), true, true);
|
MultiSound.Play(hosActual, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,19 +598,19 @@ namespace HeavenStudio.Games
|
||||||
List<BeatAction.Action> allActions = new List<BeatAction.Action>()
|
List<BeatAction.Action> allActions = new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { if (visual) ChangeBeatBackGroundColour(true); }),
|
new BeatAction.Action(beat, delegate { if (visual) ChangeBeatBackGroundColour(true); }),
|
||||||
new BeatAction.Action(beat + 1f, delegate { if (visual) ChangeBeatBackGroundColour(false); }),
|
new BeatAction.Action(beat + 1, delegate { if (visual) ChangeBeatBackGroundColour(false); }),
|
||||||
new BeatAction.Action(beat + 2f, delegate { if (visual) ChangeBeatBackGroundColour(true); }),
|
new BeatAction.Action(beat + 2, delegate { if (visual) ChangeBeatBackGroundColour(true); }),
|
||||||
new BeatAction.Action(beat + 3f, delegate
|
new BeatAction.Action(beat + 3, delegate
|
||||||
{
|
{
|
||||||
if (visual) ChangeBeatBackGroundColour(false);
|
if (visual) ChangeBeatBackGroundColour(false);
|
||||||
|
if (!marchRecursing && !ForceStepOnBeat(beat + 3.5)) MarchRecursive(beat + 3.5);
|
||||||
}),
|
}),
|
||||||
new BeatAction.Action(beat + 3f, delegate { if (!marchRecursing && !ForceStepOnBeat(beat + 3.5)) MarchRecursive(beat + 3.5f); }),
|
new BeatAction.Action(beat + 3.5, delegate { if (visual) ChangeBeatBackGroundColour(true); }),
|
||||||
new BeatAction.Action(beat + 3.5f, delegate { if (visual) ChangeBeatBackGroundColour(true); }),
|
|
||||||
};
|
};
|
||||||
List<BeatAction.Action> actions = new();
|
List<BeatAction.Action> actions = new();
|
||||||
foreach (var action in allActions)
|
foreach (var action in allActions)
|
||||||
{
|
{
|
||||||
if (action.beat >= gameswitchBeat) actions.Add(action);
|
if (action.beat + 0.5 >= gameswitchBeat) actions.Add(action);
|
||||||
}
|
}
|
||||||
if (actions.Count > 0) BeatAction.New(instance, actions);
|
if (actions.Count > 0) BeatAction.New(instance, actions);
|
||||||
}
|
}
|
||||||
|
@ -661,10 +656,10 @@ namespace HeavenStudio.Games
|
||||||
bool offBeat = beat % 1 != 0;
|
bool offBeat = beat % 1 != 0;
|
||||||
if (sound)
|
if (sound)
|
||||||
{
|
{
|
||||||
MultiSound.Sound[] sounds = new MultiSound.Sound[amount];
|
List<MultiSound.Sound> sounds = new(amount);
|
||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
{
|
{
|
||||||
sounds[i] = new MultiSound.Sound($"lockstep/" + (offBeat ? "ho" : "hai"), beat + i, 1, 1, false, offBeat ? 0.015 : 0.018);
|
sounds.Add(new MultiSound.Sound($"lockstep/" + (offBeat ? "ho" : "hai"), beat + i, 1, 1, false, offBeat ? 0.015 : 0.018));
|
||||||
}
|
}
|
||||||
MultiSound.Play(sounds, true, true);
|
MultiSound.Play(sounds, true, true);
|
||||||
}
|
}
|
||||||
|
@ -705,10 +700,10 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
if (sound)
|
if (sound)
|
||||||
{
|
{
|
||||||
MultiSound.Sound[] sounds = new MultiSound.Sound[amount];
|
List<MultiSound.Sound> sounds = new(amount);
|
||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
{
|
{
|
||||||
sounds[i] = new MultiSound.Sound($"lockstep/" + (offBeat ? "ho" : "hai"), beat + i, 1, 1, false, offBeat ? 0.015 : 0.018);
|
sounds.Add(new MultiSound.Sound($"lockstep/" + (offBeat ? "ho" : "hai"), beat + i, 1, 1, false, offBeat ? 0.015 : 0.018));
|
||||||
}
|
}
|
||||||
MultiSound.Play(sounds, true, true);
|
MultiSound.Play(sounds, true, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
|
|
||||||
BeatAction.New(this, actions);
|
BeatAction.New(this, actions);
|
||||||
MultiSound.Play(sounds.ToArray(), true, true);
|
MultiSound.Play(sounds, true, true);
|
||||||
|
|
||||||
if (autoPassTurn)
|
if (autoPassTurn)
|
||||||
{
|
{
|
||||||
|
@ -390,7 +390,7 @@ namespace HeavenStudio.Games
|
||||||
if (misses > 0) return;
|
if (misses > 0) return;
|
||||||
flowerParticles.Play();
|
flowerParticles.Play();
|
||||||
SoundByte.PlayOneShotGame($"tambourine/player/turnPass/sweep");
|
SoundByte.PlayOneShotGame($"tambourine/player/turnPass/sweep");
|
||||||
MultiSound.Play(new MultiSound.Sound[]
|
MultiSound.Play(new List<MultiSound.Sound>
|
||||||
{
|
{
|
||||||
new MultiSound.Sound("tambourine/player/turnPass/note1", beat),
|
new MultiSound.Sound("tambourine/player/turnPass/note1", beat),
|
||||||
new MultiSound.Sound("tambourine/player/turnPass/note2", beat + 0.1f),
|
new MultiSound.Sound("tambourine/player/turnPass/note2", beat + 0.1f),
|
||||||
|
|
Loading…
Reference in a new issue