added stencil operation shaders for lockstep
set default mixer snapshot to the main one (idk why it wasn't before)
This commit is contained in:
minenice55
2024-05-12 23:59:34 -04:00
parent e6bee045f1
commit 59e33e22a7
23 changed files with 1165 additions and 590 deletions

View File

@ -119,7 +119,8 @@ namespace HeavenStudio.Games.Loaders
},
new List<string>() {"ntr", "keep"},
"ntrbackbeat", "en",
new List<string>() {}
new List<string>() {},
chronologicalSortKey: 27
);
}
@ -200,10 +201,10 @@ namespace HeavenStudio.Games
// rendertextures update when the slave steppers change sprites
[SerializeField] Vector2 rtSize;
[SerializeField] Camera cameraNear1, cameraNear2, cameraDV;
[SerializeField] RawImage topT, topN, bottomL, bottomC, bottomR, bottomN;
[SerializeField] SpriteRenderer background;
[SerializeField] Material stepperMaterial;
[SerializeField] Material playerMaterial, stepperMaterial;
[SerializeField] Material topNear, bottomNear, distantView;
[Header("Properties")]
static List<QueuedMarch> queuedInputs = new();
@ -266,12 +267,16 @@ namespace HeavenStudio.Games
cameraNear2.targetTexture = renderTextures[1];
cameraDV.targetTexture = renderTextures[2];
topT.texture = renderTextures[2];
topN.texture = renderTextures[0];
bottomL.texture = renderTextures[2];
bottomC.texture = renderTextures[2];
bottomR.texture = renderTextures[2];
bottomN.texture = renderTextures[1];
// topT.texture = renderTextures[2];
// topN.texture = renderTextures[0];
// bottomL.texture = renderTextures[2];
// bottomC.texture = renderTextures[2];
// bottomR.texture = renderTextures[2];
// bottomN.texture = renderTextures[1];
topNear.SetTexture("_MainTex", renderTextures[0]);
bottomNear.SetTexture("_MainTex", renderTextures[1]);
distantView.SetTexture("_MainTex", renderTextures[2]);
}
void OnDestroy()
@ -290,7 +295,7 @@ namespace HeavenStudio.Games
private void PersistColors(double beat)
{
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "" }).FindAll(x => x.beat < beat);
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "set colours" }).FindAll(x => x.beat < beat);
if (allEventsBeforeBeat.Count > 0)
{
allEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat));
@ -306,14 +311,15 @@ namespace HeavenStudio.Games
public override void OnGameSwitch(double beat)
{
QueueSwitchBGs(beat);
PersistColors(beat);
}
public override void OnPlay(double beat)
{
queuedInputs.Clear();
QueueSwitchBGs(beat);
PersistColors(beat);
}
private void QueueSwitchBGs(double beat)
@ -345,6 +351,13 @@ namespace HeavenStudio.Games
stepperMaterial.SetColor("_ColorBravo", stepperDark);
stepperMaterial.SetColor("_ColorDelta", stepperLight);
playerMaterial.SetColor("_ColorAlpha", stepperOut);
playerMaterial.SetColor("_ColorBravo", stepperDark);
playerMaterial.SetColor("_ColorDelta", stepperLight);
EntityPreCheck(Conductor.instance.songPositionInBeatsAsDouble);
masterSprite = masterStepperSprite.sprite;
stepswitcherLeft.gameObject.SetActive(lessSteppers);
stepswitcherRight.gameObject.SetActive(lessSteppers);
@ -357,6 +370,11 @@ namespace HeavenStudio.Games
cameraDV.Render();
}
void EntityPreCheck(double beat)
{
PersistColors(beat);
}
void UpdateAndRenderSlaves()
{
foreach (var stepper in slaveSteppers)
@ -762,7 +780,10 @@ namespace HeavenStudio.Games
private void MissOn(PlayerActionEvent caller)
{
if (currentMissStage == HowMissed.MissedOn) return;
stepswitcherPlayer?.Play("OnbeatMiss", 0, 0);
if (stepswitcherPlayer is not null)
{
stepswitcherPlayer?.Play("OnbeatMiss", 0, 0);
}
SoundByte.PlayOneShotGame("lockstep/wayOff");
currentMissStage = HowMissed.MissedOn;
}
@ -770,7 +791,10 @@ namespace HeavenStudio.Games
private void MissOff(PlayerActionEvent caller)
{
if (currentMissStage == HowMissed.MissedOff) return;
stepswitcherPlayer?.Play("OffbeatMiss", 0, 0);
if (stepswitcherPlayer is not null)
{
stepswitcherPlayer?.Play("OffbeatMiss", 0, 0);
}
SoundByte.PlayOneShotGame("lockstep/wayOff");
currentMissStage = HowMissed.MissedOff;
}
@ -806,6 +830,10 @@ namespace HeavenStudio.Games
stepperMaterial.SetColor("_ColorAlpha", outlineColor);
stepperMaterial.SetColor("_ColorBravo", darkColor);
stepperMaterial.SetColor("_ColorDelta", lightColor);
playerMaterial.SetColor("_ColorAlpha", outlineColor);
playerMaterial.SetColor("_ColorBravo", darkColor);
playerMaterial.SetColor("_ColorDelta", lightColor);
}
public void Nothing(PlayerActionEvent caller) {}