A lot of older work
This commit is contained in:
@@ -20,10 +20,7 @@ namespace Marro.PacManUdon
|
||||
{
|
||||
Debug.Log($"StartTimeSequence: {timeSequence}");
|
||||
|
||||
if (currentlyInTimeSequence)
|
||||
{
|
||||
TimeSequenceEndCurrent();
|
||||
}
|
||||
TimeSequenceTryEndCurrent();
|
||||
|
||||
TimeSequencePrepareForStart(timeSequence);
|
||||
|
||||
@@ -35,12 +32,24 @@ namespace Marro.PacManUdon
|
||||
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
||||
}
|
||||
|
||||
private void TimeSequenceEndCurrent()
|
||||
private void TimeSequenceTryEndCurrent()
|
||||
{
|
||||
if (!currentlyInTimeSequence)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"{gameObject} TimeSequenceEndCurrent");
|
||||
|
||||
jumpingToTimeSequence = true;
|
||||
TimeSequenceProgressToTime(100000f);
|
||||
Debug.LogWarning($"{gameObject} TimeSequenceEndCurrent");
|
||||
TryFinalizeTimeSequence();
|
||||
|
||||
|
||||
if (waitingForTimeSequenceFinalize)
|
||||
{
|
||||
TimeSequenceExecuteFinalize(currentTimeSequence);
|
||||
}
|
||||
|
||||
jumpingToTimeSequence = false;
|
||||
}
|
||||
|
||||
@@ -79,61 +88,40 @@ namespace Marro.PacManUdon
|
||||
if (timeSequenceProgress >= timeSequenceKeyframeTimes.Length)
|
||||
{
|
||||
currentlyInTimeSequence = false;
|
||||
TimeSequencePrepareForFinish(currentTimeSequence);
|
||||
TimeSequenceFinish(currentTimeSequence);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TimeSequencePrepareForFinish(PacManTimeSequence timeSequence)
|
||||
private void TimeSequenceFinish(PacManTimeSequence timeSequence)
|
||||
{
|
||||
//if (networkManager.IsOwner)
|
||||
//{
|
||||
Debug.LogWarning($"{gameObject} TimeSequencePrepareForFinish");
|
||||
TimeSequenceExecuteFinalize(timeSequence);
|
||||
networkManager.SendEventSoon(NetworkEventType.TimeSequenceSync);
|
||||
if (!jumpingToTimeSequence)
|
||||
{
|
||||
TimeSequenceExecuteFinished(timeSequence);
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// waitingForTimeSequenceFinalize = true;
|
||||
//}
|
||||
}
|
||||
|
||||
private void TryFinalizeTimeSequence()
|
||||
private void TimeSequenceSyncWithRemote(PacManTimeSequence currentTimeSequence, float timeSequenceSecondsPassed)
|
||||
{
|
||||
if (!waitingForTimeSequenceFinalize)
|
||||
// If the remote is in a time sequence but we're not, or we're in a different time sequence, or if we're behind,
|
||||
// jump to the remote's time sequence.
|
||||
if (!currentlyInTimeSequence
|
||||
|| currentTimeSequence != this.currentTimeSequence
|
||||
|| timeSequenceSecondsPassed < this.timeSequenceSecondsPassed)
|
||||
{
|
||||
return;
|
||||
StartTimeSequence(currentTimeSequence);
|
||||
}
|
||||
|
||||
TimeSequenceExecuteFinalize(currentTimeSequence);
|
||||
waitingForTimeSequenceFinalize = false;
|
||||
// If we're (now) in a time sequence, jump our progress to match the one on the remote
|
||||
if (currentlyInTimeSequence)
|
||||
{
|
||||
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
||||
}
|
||||
}
|
||||
|
||||
//private void TimeSequenceSyncWithRemote(bool currentlyInTimeSequence, PacManTimeSequence currentTimeSequence, float timeSequenceSecondsPassed)
|
||||
//{
|
||||
// // If the remote is in a time sequence but we're not, or we're in a different time sequence, jump to the remote's time sequence.
|
||||
// if (currentlyInTimeSequence && (!this.currentlyInTimeSequence || currentTimeSequence != this.currentTimeSequence))
|
||||
// {
|
||||
// StartTimeSequence(currentTimeSequence);
|
||||
// }
|
||||
|
||||
// // If we're (now) in a time sequence, jump our progress to match the one on the remote
|
||||
// if (this.currentlyInTimeSequence)
|
||||
// {
|
||||
// TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
||||
// }
|
||||
|
||||
// // If the remote has finished it's time sequence and we have one waiting to be finalized, we can do so now
|
||||
// if (!currentlyInTimeSequence)
|
||||
// {
|
||||
// TryFinalizeTimeSequence();
|
||||
// }
|
||||
//}
|
||||
|
||||
#region Events
|
||||
|
||||
public void JumpToTimeSequenceAttractScreenIntroduction()
|
||||
|
||||
Reference in New Issue
Block a user