mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-15 06:05:10 +00:00
Merge branch 'release_1'
This commit is contained in:
commit
a22eecacfe
5 changed files with 247 additions and 219 deletions
|
@ -317,7 +317,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 5.12, y: 5.12}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &646572621760847893
|
||||
|
@ -1408,7 +1408,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 5.12, y: 5.12}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &2618106657828263176
|
||||
|
@ -4191,19 +4191,16 @@ MonoBehaviour:
|
|||
alienSpeakCount: 0
|
||||
translatorSpeakCount: 0
|
||||
hasMissed: 0
|
||||
alien: {fileID: 7783123803599722790}
|
||||
translator: {fileID: 179726693367595051}
|
||||
dummyHolder: {fileID: 0}
|
||||
alien: {fileID: 1725356918350344904}
|
||||
translator: {fileID: 2669316826032871973}
|
||||
missionControl: {fileID: 1703073459706337243}
|
||||
liveBar: {fileID: 6386057715023792916}
|
||||
liveBar: {fileID: 6529724687638495651}
|
||||
alienTextbox: {fileID: 4232889953588772276}
|
||||
alienText: {fileID: 8658955634054422971}
|
||||
translateTextbox: {fileID: 2397353702484880984}
|
||||
translateText: {fileID: 115920198331035770}
|
||||
translateFailTextbox: {fileID: 224928759238017390}
|
||||
translateFailText: {fileID: 907427456758261759}
|
||||
intervalStarted: 0
|
||||
beatInterval: 4
|
||||
noHitOnce: 0
|
||||
isSpeaking: 0
|
||||
lookAtLength: 1
|
||||
|
|
|
@ -2,9 +2,11 @@ using System;
|
|||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using HeavenStudio.Util;
|
||||
using TMPro;
|
||||
using Jukebox;
|
||||
using UnityEngine.Assertions.Must;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
|
@ -17,10 +19,11 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
new GameAction("beat intervals", "Start Interval")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.SetIntervalStart(e.beat, e.length, e["dialogue"]); },
|
||||
preFunction = delegate { var e = eventCaller.currentEntity; FirstContact.PreInterval(e.beat, e.length, e["dialogue"], e["auto"]); },
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("dialogue", "REPLACE THIS", "Mistranslation Dialogue", "The line to use when messing up the translation")
|
||||
new Param("dialogue", "REPLACE THIS", "Mistranslation Dialogue", "The line to use when messing up the translation"),
|
||||
new Param("auto", true, "Auto Pass Turn")
|
||||
},
|
||||
defaultLength = 4f,
|
||||
resizable = true,
|
||||
|
@ -28,19 +31,18 @@ namespace HeavenStudio.Games.Loaders
|
|||
},
|
||||
new GameAction("alien speak", "Bob Speak")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.AlienSpeak(e.beat, e["dialogue"], e["spaceNum"]); },
|
||||
defaultLength = 0.5f,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("spaceNum", new EntityTypes.Integer(0, 12, 0), "Amount of spaces", "Spaces to add before the untranslated icon"),
|
||||
new Param("dotdotdot", false, "Has ellipses?", "Will the man symbol be proceeded by a <...>?"),
|
||||
new Param("dialogue", "", "Dialogue", "What should this sound translate to?")
|
||||
},
|
||||
priority = 1
|
||||
},
|
||||
new GameAction("alien turnover", "Pass Turn")
|
||||
{
|
||||
function = delegate { FirstContact.instance.AlienTurnOver(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
|
||||
resizable = true
|
||||
function = delegate { FirstContact.instance.PassTurnStandalone(eventCaller.currentEntity.beat); },
|
||||
},
|
||||
new GameAction("alien success", "Success")
|
||||
{
|
||||
|
@ -92,23 +94,21 @@ namespace HeavenStudio.Games
|
|||
const string MID_MSG_MISS = "<color=\"red\"> ..? </color>";
|
||||
const string MSG_ALIEN = "<sprite name=\"AlienIcn\">";
|
||||
const string MSG_MAN = "<sprite name=\"ManIcn\">";
|
||||
const string MSG_MAN_DDD = "...<sprite name=\"ManIcn\">";
|
||||
// I should add a DonkTroll sprite 🫰🫰🫰🫰🫰
|
||||
|
||||
public static FirstContact instance { get; private set; }
|
||||
|
||||
[Header("Properties")]
|
||||
public int alienSpeakCount;
|
||||
public int translatorSpeakCount;
|
||||
public bool hasMissed;
|
||||
//[Header("Properties")]
|
||||
private bool hasMissed;
|
||||
private double lastReportedBeat = 0;
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] GameObject alien;
|
||||
[SerializeField] GameObject translator;
|
||||
[SerializeField] Animator alien;
|
||||
[SerializeField] Animator translator;
|
||||
//[SerializeField] GameObject alienSpeech;
|
||||
[SerializeField] GameObject dummyHolder;
|
||||
[SerializeField] GameObject missionControl;
|
||||
[SerializeField] GameObject liveBar;
|
||||
[SerializeField] Animator liveBar;
|
||||
|
||||
[SerializeField] GameObject alienTextbox;
|
||||
[SerializeField] TMP_Text alienText;
|
||||
|
@ -119,9 +119,6 @@ namespace HeavenStudio.Games
|
|||
|
||||
[Header("Variables")]
|
||||
int currentVoicelineIndex = -1;
|
||||
public bool intervalStarted;
|
||||
double intervalStartBeat;
|
||||
public float beatInterval = 4f;
|
||||
public bool noHitOnce, isSpeaking;
|
||||
//public int version;
|
||||
public float lookAtLength = 1f;
|
||||
|
@ -133,14 +130,14 @@ namespace HeavenStudio.Games
|
|||
string respDiagBuffer = "";
|
||||
List<string> callDiagList = new List<string>();
|
||||
int callDiagIndex = 0;
|
||||
|
||||
|
||||
static List<QueuedSecondContactInput> queuedInputs = new List<QueuedSecondContactInput>();
|
||||
struct QueuedSecondContactInput
|
||||
private struct QueuedInterval
|
||||
{
|
||||
public double beatAwayFromStart;
|
||||
public string dialogue;
|
||||
public double beat;
|
||||
public float interval;
|
||||
public bool autoPassTurn;
|
||||
public string outDialogue;
|
||||
}
|
||||
private static List<QueuedInterval> queuedIntervals = new List<QueuedInterval>();
|
||||
|
||||
//public enum VersionOfContact
|
||||
//{
|
||||
|
@ -163,10 +160,6 @@ namespace HeavenStudio.Games
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused)
|
||||
{
|
||||
if (queuedInputs.Count > 0) queuedInputs.Clear();
|
||||
}
|
||||
foreach (var evt in scheduledInputs)
|
||||
{
|
||||
evt.Disable();
|
||||
|
@ -190,47 +183,115 @@ namespace HeavenStudio.Games
|
|||
translateFailTextbox.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetIntervalStart(double beat, float interval, string outDialogue)
|
||||
private List<RiqEntity> GetAllSpeaksInBetweenBeat(double beat, double endBeat)
|
||||
{
|
||||
translator.GetComponent<Animator>().Play("translator_lookAtAlien", 0, 0);
|
||||
if (!intervalStarted)
|
||||
List<RiqEntity> speakEvents = EventCaller.GetAllInGameManagerList("firstContact", new string[] { "alien speak" });
|
||||
List<RiqEntity> tempEvents = new();
|
||||
|
||||
foreach (var entity in speakEvents)
|
||||
{
|
||||
//alienSpeakCount = 0;
|
||||
//translatorSpeakCount = 0;
|
||||
intervalStarted = true;
|
||||
if (entity.beat >= beat && entity.beat < endBeat)
|
||||
{
|
||||
tempEvents.Add(entity);
|
||||
}
|
||||
}
|
||||
return tempEvents;
|
||||
}
|
||||
|
||||
intervalStartBeat = beat;
|
||||
beatInterval = interval;
|
||||
private RiqEntity GetLastIntervalBeforeBeat(double beat)
|
||||
{
|
||||
List<RiqEntity> intervalEvents = EventCaller.GetAllInGameManagerList("firstContact", new string[] { "beat intervals" });
|
||||
if (intervalEvents.Count == 0) return null;
|
||||
var tempEvents = intervalEvents.FindAll(x => x.beat <= beat);
|
||||
tempEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
return tempEvents[^1];
|
||||
}
|
||||
|
||||
onOutDialogue = outDialogue;
|
||||
callDiagBuffer = "";
|
||||
respDiagBuffer = "";
|
||||
callDiagList.Clear();
|
||||
callDiagIndex = 0;
|
||||
public static void PreInterval(double beat, float interval, string outDialogue, bool autoPassTurn)
|
||||
{
|
||||
if (GameManager.instance.currentGame == "firstContact")
|
||||
{
|
||||
instance.SetIntervalStart(beat, interval, outDialogue, beat, autoPassTurn);
|
||||
}
|
||||
else
|
||||
{
|
||||
queuedIntervals.Add(new QueuedInterval
|
||||
{
|
||||
beat = beat,
|
||||
interval = interval,
|
||||
outDialogue = outDialogue,
|
||||
autoPassTurn = autoPassTurn
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
alienText.text = "";
|
||||
translateText.text = "";
|
||||
translateFailText.text = "";
|
||||
private void SetIntervalStart(double beat, float interval, string outDialogue, double gameSwitchBeat, bool autoPassTurn)
|
||||
{
|
||||
List<RiqEntity> relevantSpeakEvents = GetAllSpeaksInBetweenBeat(beat, beat + interval);
|
||||
relevantSpeakEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
List<BeatAction.Action> queuedSpeaks = new()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
translator.Play("translator_lookAtAlien", 0, 0);
|
||||
|
||||
alienTextbox.SetActive(false);
|
||||
translateTextbox.SetActive(false);
|
||||
translateFailTextbox.SetActive(false);
|
||||
onOutDialogue = outDialogue;
|
||||
callDiagBuffer = "";
|
||||
respDiagBuffer = "";
|
||||
callDiagList.Clear();
|
||||
callDiagIndex = 0;
|
||||
|
||||
alienText.text = "";
|
||||
translateText.text = "";
|
||||
translateFailText.text = "";
|
||||
|
||||
alienTextbox.SetActive(false);
|
||||
translateTextbox.SetActive(false);
|
||||
translateFailTextbox.SetActive(false);
|
||||
if (autoPassTurn)
|
||||
{
|
||||
AlienTurnOver(beat + interval, beat, beat + interval);
|
||||
}
|
||||
})
|
||||
};
|
||||
for (int i = 0; i < relevantSpeakEvents.Count; i++)
|
||||
{
|
||||
RiqEntity speakEventToCheck = relevantSpeakEvents[i];
|
||||
if (speakEventToCheck.beat >= gameSwitchBeat)
|
||||
{
|
||||
queuedSpeaks.Add(new BeatAction.Action(speakEventToCheck.beat, delegate
|
||||
{
|
||||
AlienSpeak(speakEventToCheck.beat, speakEventToCheck["spaceNum"], speakEventToCheck["dotdotdot"]);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
AlienSpeakInactive(speakEventToCheck["spaceNum"]);
|
||||
}
|
||||
}
|
||||
BeatAction.New(gameObject, queuedSpeaks);
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat)
|
||||
{
|
||||
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|
||||
{
|
||||
if (queuedIntervals.Count > 0)
|
||||
{
|
||||
foreach (var interval in queuedIntervals)
|
||||
{
|
||||
SetIntervalStart(interval.beat, interval.interval, interval.outDialogue, beat, interval.autoPassTurn);
|
||||
}
|
||||
queuedIntervals.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused)
|
||||
{
|
||||
if (queuedInputs.Count > 0) queuedInputs.Clear();
|
||||
}
|
||||
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted)
|
||||
{
|
||||
intervalStarted = false;
|
||||
}
|
||||
if (Conductor.instance.ReportBeat(ref lastReportedBeat, offset: liveBarBeatOffset))
|
||||
{
|
||||
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
|
||||
liveBar.Play("liveBar", 0, 0);
|
||||
}
|
||||
else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat)
|
||||
{
|
||||
|
@ -239,7 +300,7 @@ namespace HeavenStudio.Games
|
|||
|
||||
if (PlayerInput.Pressed(true) && !IsExpectingInputNow(InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN))
|
||||
{
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_eh", 0.5f);
|
||||
translator.DoScaledAnimationAsync("translator_eh", 0.5f);
|
||||
if (isSpeaking)
|
||||
{
|
||||
if (callDiagIndex == 0)
|
||||
|
@ -273,42 +334,47 @@ namespace HeavenStudio.Games
|
|||
switch (alienLookAt)
|
||||
{
|
||||
case 0:
|
||||
alien.GetComponent<Animator>().Play("alien_lookAt", 0, 0);
|
||||
alien.Play("alien_lookAt", 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
alien.GetComponent<Animator>().Play("alien_idle", 0, 0);
|
||||
alien.Play("alien_idle", 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (translatorLookAt)
|
||||
{
|
||||
case 0:
|
||||
translator.GetComponent<Animator>().Play("translator_lookAtAlien", 0, 0);
|
||||
translator.Play("translator_lookAtAlien", 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
|
||||
translator.Play("translator_idle", 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AlienSpeak(double beat, string dialogue, int spaceNum)
|
||||
private void AlienSpeak(double beat, int spaceNum, bool hasDDD)
|
||||
{
|
||||
queuedInputs.Add(new QueuedSecondContactInput()
|
||||
{
|
||||
beatAwayFromStart = beat - intervalStartBeat,
|
||||
dialogue = dialogue
|
||||
});
|
||||
int voiceline = UnityEngine.Random.Range(1, 11);
|
||||
if (voiceline == currentVoicelineIndex) voiceline++;
|
||||
if (voiceline > 10) voiceline = 1;
|
||||
currentVoicelineIndex = voiceline;
|
||||
SoundByte.PlayOneShotGame("firstContact/Bob" + voiceline, beat, SoundByte.GetPitchFromCents(UnityEngine.Random.Range(-100, 0), false));
|
||||
SoundByte.PlayOneShotGame("firstContact/BobB");
|
||||
alien.GetComponent<Animator>().DoScaledAnimationAsync("alien_talk", 0.5f);
|
||||
if (UnityEngine.Random.Range(0, 5) == 0) translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_lookAtAlien_nod", 0.5f);
|
||||
callDiagList.Add(dialogue);
|
||||
alien.DoScaledAnimationAsync("alien_talk", 0.5f);
|
||||
if (UnityEngine.Random.Range(0, 5) == 0) translator.DoScaledAnimationAsync("translator_lookAtAlien_nod", 0.5f);
|
||||
|
||||
alienTextbox.SetActive(true);
|
||||
for (int i = 0; i < spaceNum * 2; i++)
|
||||
{
|
||||
callDiagBuffer += " ";
|
||||
}
|
||||
callDiagBuffer += hasDDD ? MSG_MAN_DDD : MSG_MAN;
|
||||
UpdateAlienTextbox();
|
||||
}
|
||||
|
||||
private void AlienSpeakInactive(int spaceNum)
|
||||
{
|
||||
alienTextbox.SetActive(true);
|
||||
for (int i = 0; i < spaceNum * 2; i++)
|
||||
{
|
||||
|
@ -318,28 +384,38 @@ namespace HeavenStudio.Games
|
|||
UpdateAlienTextbox();
|
||||
}
|
||||
|
||||
public void AlienTurnOver(double beat, float length)
|
||||
public void PassTurnStandalone(double beat)
|
||||
{
|
||||
if (queuedInputs.Count == 0) return;
|
||||
SoundByte.PlayOneShotGame("firstContact/turnover");
|
||||
alienTextbox.SetActive(false);
|
||||
alien.GetComponent<Animator>().Play("alien_point", 0, 0);
|
||||
RiqEntity lastInterval = GetLastIntervalBeforeBeat(beat);
|
||||
if (lastInterval == null) return;
|
||||
AlienTurnOver(beat, lastInterval.beat, lastInterval.beat + lastInterval.length);
|
||||
}
|
||||
|
||||
isSpeaking = true;
|
||||
intervalStarted = false;
|
||||
BeatAction.New(alien, new List<BeatAction.Action>()
|
||||
private void AlienTurnOver(double beat, double intervalBeat, double endBeat)
|
||||
{
|
||||
var inputs = GetAllSpeaksInBetweenBeat(intervalBeat, endBeat);
|
||||
inputs.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
for (int i = 0; i < inputs.Count; i++)
|
||||
{
|
||||
new BeatAction.Action(beat + 0.5f, delegate { alien.GetComponent<Animator>().Play("alien_idle", 0, 0); })
|
||||
var input = inputs[i];
|
||||
double relativeBeat = input.beat - intervalBeat;
|
||||
ScheduleInput(beat, 1 + relativeBeat, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, AlienTapping, AlienOnMiss, AlienEmpty);
|
||||
callDiagList.Add(input["dialogue"]);
|
||||
}
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
isSpeaking = true;
|
||||
SoundByte.PlayOneShotGame("firstContact/turnover");
|
||||
alienTextbox.SetActive(false);
|
||||
alien.Play("alien_point", 0, 0);
|
||||
}),
|
||||
new BeatAction.Action(beat + 0.5f, delegate
|
||||
{
|
||||
alien.Play("alien_idle", 0, 0);
|
||||
})
|
||||
});
|
||||
if (!isSpeaking)
|
||||
{
|
||||
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
|
||||
}
|
||||
foreach (var input in queuedInputs)
|
||||
{
|
||||
ScheduleInput(beat, length + input.beatAwayFromStart, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, AlienTapping, AlienOnMiss, AlienEmpty);
|
||||
}
|
||||
queuedInputs.Clear();
|
||||
}
|
||||
|
||||
public void AlienSuccess(double beat)
|
||||
|
@ -372,14 +448,13 @@ namespace HeavenStudio.Games
|
|||
|
||||
MultiSound.Play(sound.ToArray());
|
||||
|
||||
BeatAction.New(alien, new List<BeatAction.Action>()
|
||||
BeatAction.New(gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); }),
|
||||
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); }),
|
||||
new BeatAction.Action(beat, delegate { alien.Play(animString, 0, 0); }),
|
||||
new BeatAction.Action(beat + .5f, delegate { alien.Play(animString, 0, 0); }),
|
||||
new BeatAction.Action(beat + 1, delegate { alienTextbox.SetActive(false); translateTextbox.SetActive(false); translateFailTextbox.SetActive(false); })
|
||||
});
|
||||
|
||||
intervalStarted = false;
|
||||
isSpeaking = false;
|
||||
hasMissed = false;
|
||||
noHitOnce = false;
|
||||
|
@ -430,8 +505,8 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
|
||||
missionControl.GetComponentInParent<Animator>().Play(textToPut, 0, 0);
|
||||
alien.GetComponentInParent<Animator>().Play("alien_idle", 0, 0);
|
||||
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
|
||||
alien.Play("alien_idle", 0, 0);
|
||||
translator.Play("translator_idle", 0, 0);
|
||||
|
||||
if (!stay)
|
||||
{
|
||||
|
@ -444,16 +519,13 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
missionControl.SetActive(true);
|
||||
}
|
||||
|
||||
alienSpeakCount = 0;
|
||||
translatorSpeakCount = 0;
|
||||
isSpeaking = false;
|
||||
}
|
||||
|
||||
void FailContact()
|
||||
{
|
||||
SoundByte.PlayOneShotGame("firstContact/failContact");
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
translator.DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
if (!hasMissed && callDiagIndex == 0)
|
||||
{
|
||||
translateFailTextbox.SetActive(true);
|
||||
|
@ -467,7 +539,7 @@ namespace HeavenStudio.Games
|
|||
void TrailingContact()
|
||||
{
|
||||
SoundByte.PlayOneShotGame("firstContact/slightlyFail");
|
||||
translator.GetComponent<Animator>().Play("translator_eh", 0, 0);
|
||||
translator.Play("translator_eh", 0, 0);
|
||||
if (!hasMissed)
|
||||
{
|
||||
respDiagBuffer += MID_MSG_MISS;
|
||||
|
@ -495,13 +567,13 @@ namespace HeavenStudio.Games
|
|||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
translator.DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
if (callDiagIndex == 0) return;
|
||||
TrailingContact();
|
||||
return;
|
||||
}
|
||||
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
translator.DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
|
||||
SoundByte.PlayOneShotGame("firstContact/ALIEN_PLAYER_B");
|
||||
if (hasMissed)
|
||||
|
@ -533,7 +605,7 @@ namespace HeavenStudio.Games
|
|||
hasMissed = true;
|
||||
}
|
||||
|
||||
alien.GetComponent<Animator>().Play("alien_noHit", 0, 0);
|
||||
alien.Play("alien_noHit", 0, 0);
|
||||
}
|
||||
|
||||
public void AlienEmpty(PlayerActionEvent caller) { } //OnEmpty
|
||||
|
|
|
@ -171,8 +171,6 @@ namespace HeavenStudio.Games
|
|||
public GameObject DroppedHairsHolder;
|
||||
|
||||
[Header("Variables")]
|
||||
private double passTurnBeat;
|
||||
private double passTurnEndBeat = 2;
|
||||
private static List<QueuedPeek> queuedPeeks = new List<QueuedPeek>();
|
||||
|
||||
[Header("Sprites")]
|
||||
|
|
|
@ -356,8 +356,6 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
public static Rockers instance;
|
||||
|
||||
public static CallAndResponseHandler crHandlerInstance;
|
||||
|
||||
[Header("Rockers")]
|
||||
public RockersRocker JJ;
|
||||
public RockersRocker Soshi;
|
||||
|
@ -392,10 +390,6 @@ namespace HeavenStudio.Games
|
|||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
if (crHandlerInstance == null)
|
||||
{
|
||||
crHandlerInstance = new CallAndResponseHandler();
|
||||
}
|
||||
var tempEvents = EventCaller.GetAllInGameManagerList("rockers", new string[] { "prepare" });
|
||||
foreach (var tempEvent in tempEvents)
|
||||
{
|
||||
|
@ -470,6 +464,15 @@ namespace HeavenStudio.Games
|
|||
return tempEvents;
|
||||
}
|
||||
|
||||
private RiqEntity GetLastIntervalBeforeBeat(double beat)
|
||||
{
|
||||
List<RiqEntity> intervalEvents = EventCaller.GetAllInGameManagerList("rockers", new string[] { "intervalStart" });
|
||||
if (intervalEvents.Count == 0) return null;
|
||||
var tempEvents = intervalEvents.FindAll(x => x.beat <= beat);
|
||||
tempEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
return tempEvents[^1];
|
||||
}
|
||||
|
||||
private List<RiqEntity> GrabAllTogetherEvents(double beat)
|
||||
{
|
||||
var tempEvents = EventCaller.GetAllInGameManagerList("rockers", new string[] { "riffTogether", "riffTogetherEnd" });
|
||||
|
@ -536,11 +539,6 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnPlay(double beat)
|
||||
{
|
||||
crHandlerInstance = null;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (queuedCameraEvents.Count > 0) queuedCameraEvents.Clear();
|
||||
|
@ -741,7 +739,7 @@ namespace HeavenStudio.Games
|
|||
public void TogetherPrepare(double beat, bool cmon, bool muteSound, float muteBeat, float goToMiddleBeat, bool moveCamera)
|
||||
{
|
||||
List<RiqEntity> togetherEvents = GrabAllTogetherEvents(beat);
|
||||
if (togetherEvents.Count == 0 || crHandlerInstance.IntervalIsActive()) return;
|
||||
if (togetherEvents.Count == 0) return;
|
||||
if (!muteSound) SoundByte.PlayOneShotGame(cmon ? "rockers/Cmon" : "rockers/LastOne");
|
||||
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
||||
if (moveCamera)
|
||||
|
@ -841,9 +839,6 @@ namespace HeavenStudio.Games
|
|||
|
||||
public void StartInterval(double beat, float length, double gameSwitchBeat, bool autoPassTurn, bool moveCamera)
|
||||
{
|
||||
CallAndResponseHandler newHandler = new();
|
||||
crHandlerInstance = newHandler;
|
||||
crHandlerInstance.StartInterval(beat, length);
|
||||
List<RiqEntity> relevantInputs = GrabAllInputsBetween(beat, beat + length);
|
||||
List<double> riffUsedBeats = new List<double>();
|
||||
List<double> bendUsedBeats = new();
|
||||
|
@ -854,21 +849,6 @@ namespace HeavenStudio.Games
|
|||
RiqEntity foundEvent = riffEvents.Find(x => x.beat == input.beat);
|
||||
if ((foundEvent == null || (riffUsedBeats.Count > 0 && riffUsedBeats.Contains((float)foundEvent.beat))) && riffEvents.Count > 1) continue;
|
||||
riffUsedBeats.Add(input.beat);
|
||||
if (input["respond"])
|
||||
{
|
||||
crHandlerInstance.AddEvent(input.beat, input.length, "riff", new List<CallAndResponseHandler.CallAndResponseEventParam>()
|
||||
{
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("gleeClub", input["gcS"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("1", input["1S"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("2", input["2S"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("3", input["3S"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("4", input["4S"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("5", input["5S"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("6", input["6S"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("sample", input["sampleS"]),
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("sampleTones", input["pitchSampleS"])
|
||||
});
|
||||
}
|
||||
if (input.beat >= gameSwitchBeat)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
|
@ -889,18 +869,11 @@ namespace HeavenStudio.Games
|
|||
else
|
||||
{
|
||||
if (riffEvents.Count == 0) continue;
|
||||
RiqEntity foundEvent = bendEvents.Find(x => x.beat == beat);
|
||||
RiqEntity foundEvent = bendEvents.Find(x => x.beat == input.beat);
|
||||
if ((foundEvent == null || (bendUsedBeats.Count > 0 && bendUsedBeats.Contains((float)foundEvent.beat))) && bendEvents.Count > 1) continue;
|
||||
RiqEntity riffEventToCheck = riffEvents.Find(x => beat >= x.beat && beat < x.beat + x.length);
|
||||
RiqEntity riffEventToCheck = riffEvents.Find(x => input.beat >= x.beat && input.beat < x.beat + x.length);
|
||||
if (riffEventToCheck == null) continue;
|
||||
bendUsedBeats.Add(beat);
|
||||
if (input["respond"])
|
||||
{
|
||||
crHandlerInstance.AddEvent(input.beat, input.length, "bend", new List<CallAndResponseHandler.CallAndResponseEventParam>()
|
||||
{
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("Pitch", input["1S"]),
|
||||
});
|
||||
}
|
||||
if (input.beat >= gameSwitchBeat)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
|
@ -926,7 +899,7 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}),
|
||||
});
|
||||
if (autoPassTurn) PassTurn(beat + length, moveCamera, newHandler);
|
||||
if (autoPassTurn) PassTurn(beat + length, moveCamera, beat, length);
|
||||
}
|
||||
|
||||
public void Riff(double beat, float length, int[] pitches, bool gleeClubJJ, int sampleJJ, int sampleTonesJJ, bool noRespond)
|
||||
|
@ -1004,12 +977,15 @@ namespace HeavenStudio.Games
|
|||
|
||||
private void StandalonePassTurn(double beat, bool moveCamera)
|
||||
{
|
||||
if (crHandlerInstance != null) PassTurn(beat, moveCamera, crHandlerInstance);
|
||||
RiqEntity lastInterval = GetLastIntervalBeforeBeat(beat);
|
||||
if (lastInterval == null) return;
|
||||
PassTurn(beat, moveCamera, lastInterval.beat, lastInterval.length);
|
||||
}
|
||||
|
||||
private void PassTurn(double beat, bool moveCamera, CallAndResponseHandler handler)
|
||||
private void PassTurn(double beat, bool moveCamera, double intervalStartBeat, float intervalLength)
|
||||
{
|
||||
if (crHandlerInstance.queuedEvents.Count > 0)
|
||||
var relevantInputs = GrabAllInputsBetween(intervalStartBeat, intervalStartBeat + intervalLength);
|
||||
if (relevantInputs.Count > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
|
@ -1024,25 +1000,38 @@ namespace HeavenStudio.Games
|
|||
}),
|
||||
new BeatAction.Action(beat -0.25, delegate
|
||||
{
|
||||
List<CallAndResponseHandler.CallAndResponseEvent> crEvents = handler.queuedEvents;
|
||||
|
||||
foreach (var crEvent in crEvents)
|
||||
List<double> riffUsedBeats = new List<double>();
|
||||
List<double> bendUsedBeats = new();
|
||||
foreach (var crEvent in relevantInputs)
|
||||
{
|
||||
if (crEvent.tag == "riff")
|
||||
if (!crEvent["respond"]) continue;
|
||||
double relativeBeat = crEvent.beat - intervalStartBeat;
|
||||
if (crEvent.datamodel == "rockers/riff")
|
||||
{
|
||||
RiqEntity foundEvent = riffEvents.Find(x => x.beat == crEvent.beat);
|
||||
if ((foundEvent == null || (riffUsedBeats.Count > 0 && riffUsedBeats.Contains((float)foundEvent.beat))) && riffEvents.Count > 1) continue;
|
||||
riffUsedBeats.Add(crEvent.beat);
|
||||
|
||||
RockersInput riffComp = Instantiate(rockerInputRef, transform);
|
||||
riffComp.Init(crEvent["gleeClub"], new int[6] { crEvent["1"], crEvent["2"], crEvent["3"], crEvent["4"], crEvent["5"], crEvent["6"] }, beat, crEvent.relativeBeat,
|
||||
(PremadeSamples)crEvent["sample"], crEvent["sampleTones"]);
|
||||
ScheduleInput(beat, crEvent.relativeBeat + crEvent.length, InputType.STANDARD_DOWN, JustMute, MuteMiss, Empty);
|
||||
riffComp.Init(crEvent["gcS"], new int[6] { crEvent["1S"], crEvent["2S"], crEvent["3S"], crEvent["4S"], crEvent["5S"], crEvent["6S"] }, beat, relativeBeat,
|
||||
(PremadeSamples)crEvent["sampleS"], crEvent["pitchSampleS"]);
|
||||
if (crEvent.length > 0.5f) ScheduleAutoplayInput(beat, relativeBeat + crEvent.length, InputType.STANDARD_DOWN, JustMute, MuteMiss, Empty);
|
||||
else ScheduleInput(beat, relativeBeat + crEvent.length, InputType.STANDARD_DOWN, JustMute, MuteMiss, Empty);
|
||||
}
|
||||
else if (crEvent.tag == "bend")
|
||||
else
|
||||
{
|
||||
if (riffEvents.Count == 0) continue;
|
||||
RiqEntity foundEvent = bendEvents.Find(x => x.beat == crEvent.beat);
|
||||
if ((foundEvent == null || (bendUsedBeats.Count > 0 && bendUsedBeats.Contains((float)foundEvent.beat))) && bendEvents.Count > 1) continue;
|
||||
RiqEntity riffEventToCheck = riffEvents.Find(x => crEvent.beat >= x.beat && crEvent.beat < x.beat + x.length);
|
||||
if (riffEventToCheck == null) continue;
|
||||
bendUsedBeats.Add(beat);
|
||||
|
||||
RockerBendInput bendComp = Instantiate(rockerBendInputRef, transform);
|
||||
bendComp.Init(crEvent["Pitch"], beat, crEvent.relativeBeat);
|
||||
ScheduleInput(beat, crEvent.relativeBeat + crEvent.length, InputType.DIRECTION_UP, JustUnBend, UnBendMiss, Empty);
|
||||
bendComp.Init(crEvent["1S"], beat, relativeBeat);
|
||||
ScheduleAutoplayInput(beat, relativeBeat + crEvent.length, InputType.DIRECTION_UP, JustUnBend, UnBendMiss, Empty);
|
||||
}
|
||||
}
|
||||
handler.queuedEvents.Clear();
|
||||
}),
|
||||
new BeatAction.Action(beat, delegate
|
||||
{
|
||||
|
|
|
@ -206,7 +206,6 @@ namespace HeavenStudio.Games
|
|||
public Sprite redArrowSprite;
|
||||
|
||||
public static WorkingDough instance;
|
||||
private static CallAndResponseHandler crHandlerInstance;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
|
@ -232,7 +231,7 @@ namespace HeavenStudio.Games
|
|||
shipObject.SetActive(!bgDisabled && !shipOnly);
|
||||
}
|
||||
|
||||
private static List<RiqEntity> GetAllBallsInBetweenBeat(double beat, double endBeat)
|
||||
private List<RiqEntity> GetAllBallsInBetweenBeat(double beat, double endBeat)
|
||||
{
|
||||
List<RiqEntity> ballEvents = EventCaller.GetAllInGameManagerList("workingDough", new string[] { "small ball", "big ball" });
|
||||
List<RiqEntity> tempEvents = new();
|
||||
|
@ -247,11 +246,17 @@ namespace HeavenStudio.Games
|
|||
return tempEvents;
|
||||
}
|
||||
|
||||
private RiqEntity GetLastIntervalBeforeBeat(double beat)
|
||||
{
|
||||
List<RiqEntity> intervalEvents = EventCaller.GetAllInGameManagerList("workingDough", new string[] { "beat intervals" });
|
||||
if (intervalEvents.Count == 0) return null;
|
||||
var tempEvents = intervalEvents.FindAll(x => x.beat <= beat);
|
||||
tempEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
return tempEvents[^1];
|
||||
}
|
||||
|
||||
public void SetIntervalStart(double beat, double gameSwitchBeat, float interval = 8f, bool autoPassTurn = true)
|
||||
{
|
||||
CallAndResponseHandler newHandler = new();
|
||||
crHandlerInstance = newHandler;
|
||||
crHandlerInstance.StartInterval(beat, interval);
|
||||
List<RiqEntity> relevantBalls = GetAllBallsInBetweenBeat(beat, beat + interval);
|
||||
bool hasBigBall = false;
|
||||
foreach (var ball in relevantBalls)
|
||||
|
@ -260,17 +265,14 @@ namespace HeavenStudio.Games
|
|||
if (ball.beat >= gameSwitchBeat)
|
||||
{
|
||||
SpawnBall(ball.beat - 1, isBig, isBig && ball["hasGandw"]);
|
||||
OnSpawnBall(ball.beat, isBig, isBig && ball["hasGandw"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnSpawnBallInactive(ball.beat, isBig, isBig && ball["hasGandw"]);
|
||||
OnSpawnBall(ball.beat, isBig);
|
||||
}
|
||||
if (isBig) hasBigBall = true;
|
||||
}
|
||||
Debug.Log(autoPassTurn);
|
||||
if (autoPassTurn)
|
||||
{
|
||||
PassTurn(beat + interval, interval, newHandler);
|
||||
PassTurn(beat + interval, interval, beat);
|
||||
}
|
||||
BeatAction.New(ballTransporterLeftNPC, new List<BeatAction.Action>()
|
||||
{
|
||||
|
@ -305,10 +307,12 @@ namespace HeavenStudio.Games
|
|||
|
||||
private void PassTurnStandalone(double beat)
|
||||
{
|
||||
if (crHandlerInstance != null) PassTurn(beat, crHandlerInstance.intervalLength, crHandlerInstance);
|
||||
RiqEntity lastInterval = GetLastIntervalBeforeBeat(beat);
|
||||
if (lastInterval == null) return;
|
||||
PassTurn(beat, lastInterval.length, lastInterval.beat);
|
||||
}
|
||||
|
||||
private void PassTurn(double beat, double length, CallAndResponseHandler crHandler)
|
||||
private void PassTurn(double beat, double length, double startBeat)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
|
@ -316,15 +320,17 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
ballTransporterRightPlayer.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
|
||||
ballTransporterLeftPlayer.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
|
||||
if (crHandler.queuedEvents.Count > 0)
|
||||
var relevantBallEvents = GetAllBallsInBetweenBeat(startBeat, startBeat + length);
|
||||
if (relevantBallEvents.Count > 0)
|
||||
{
|
||||
bool hasBig = false;
|
||||
foreach (var ball in crHandler.queuedEvents)
|
||||
foreach (var ball in relevantBallEvents)
|
||||
{
|
||||
SpawnPlayerBall(beat + ball.relativeBeat - 1, ball.tag == "big", ball["hasGandw"]);
|
||||
if (ball.tag == "big") hasBig = true;
|
||||
double relativeBeat = ball.beat - startBeat;
|
||||
bool isBig = ball.datamodel == "workingDough/big ball";
|
||||
SpawnPlayerBall(beat + relativeBeat - 1, isBig, isBig ? ball["hasGandw"] : false);
|
||||
if (isBig) hasBig = true;
|
||||
}
|
||||
crHandler.queuedEvents.Clear();
|
||||
bigModePlayer = hasBig;
|
||||
if (bigModePlayer)
|
||||
{
|
||||
|
@ -335,7 +341,7 @@ namespace HeavenStudio.Games
|
|||
new BeatAction.Action(beat + 1, delegate
|
||||
{
|
||||
if (gandwHasEntered && !bgDisabled) gandwAnim.Play("MrGameAndWatchLeverDown", 0, 0);
|
||||
if (crHandlerInstance == null || !crHandlerInstance.IntervalIsActive())
|
||||
if (beat + 1 > GetLastIntervalBeforeBeat(beat + 1).beat + GetLastIntervalBeforeBeat(beat + 1).length)
|
||||
{
|
||||
ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftClose", 0, 0);
|
||||
ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightClose", 0, 0);
|
||||
|
@ -381,24 +387,8 @@ namespace HeavenStudio.Games
|
|||
});
|
||||
}
|
||||
|
||||
public static void OnSpawnBallInactive(double beat, bool isBig, bool hasGandw)
|
||||
public void OnSpawnBall(double beat, bool isBig)
|
||||
{
|
||||
if (crHandlerInstance == null)
|
||||
{
|
||||
crHandlerInstance = new CallAndResponseHandler();
|
||||
}
|
||||
crHandlerInstance.AddEvent(beat, 0, isBig ? "big" : "small", new List<CallAndResponseHandler.CallAndResponseEventParam>()
|
||||
{
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("hasGandw", hasGandw)
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSpawnBall(double beat, bool isBig, bool hasGandw)
|
||||
{
|
||||
crHandlerInstance.AddEvent(beat, 0, isBig ? "big" : "small", new List<CallAndResponseHandler.CallAndResponseEventParam>()
|
||||
{
|
||||
new CallAndResponseHandler.CallAndResponseEventParam("hasGandw", hasGandw)
|
||||
});
|
||||
SoundByte.PlayOneShotGame(isBig ? "workingDough/hitBigOther" : "workingDough/hitSmallOther", beat);
|
||||
SoundByte.PlayOneShotGame(isBig ? "workingDough/bigOther" : "workingDough/smallOther", beat);
|
||||
}
|
||||
|
@ -445,19 +435,6 @@ namespace HeavenStudio.Games
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
if (crHandlerInstance != null && !Conductor.instance.isPlaying)
|
||||
{
|
||||
crHandlerInstance = null;
|
||||
}
|
||||
foreach (var evt in scheduledInputs)
|
||||
{
|
||||
evt.Disable();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat)
|
||||
{
|
||||
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|
||||
|
@ -473,11 +450,6 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnPlay(double beat)
|
||||
{
|
||||
crHandlerInstance = null;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (spaceshipRising && !bgDisabled) spaceshipAnimator.DoScaledAnimation("RiseSpaceship", risingStartBeat, risingLength);
|
||||
|
|
Loading…
Reference in a new issue