Compare commits
4 Commits
8dec85e9f2
...
4ef936bf16
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ef936bf16 | |||
| a15f977107 | |||
| f53a41f70c | |||
| 16b0a348e4 |
@@ -44,14 +44,14 @@
|
|||||||
|
|
||||||
public void Spawn()
|
public void Spawn()
|
||||||
{
|
{
|
||||||
Debug.Log($"{gameObject} Spawned");
|
// Debug.Log($"{gameObject} Spawned");
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
activeCountdown = Random.Range(9, 10);
|
activeCountdown = Random.Range(9, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Despawn()
|
public void Despawn()
|
||||||
{
|
{
|
||||||
Debug.Log($"{gameObject} Despawned");
|
// Debug.Log($"{gameObject} Despawned");
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -192,6 +192,13 @@ namespace Marro.PacManUdon
|
|||||||
pelletManager.SetPowerPelletsBlink(false);
|
pelletManager.SetPowerPelletsBlink(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PrepareForCutscene()
|
||||||
|
{
|
||||||
|
HideEverything();
|
||||||
|
RestartLevel();
|
||||||
|
SetFrozen(true);
|
||||||
|
}
|
||||||
|
|
||||||
public void GotPellet(bool addScore = true)
|
public void GotPellet(bool addScore = true)
|
||||||
{
|
{
|
||||||
pelletCountRemaining--;
|
pelletCountRemaining--;
|
||||||
@@ -283,7 +290,6 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
private void HideEverything()
|
private void HideEverything()
|
||||||
{
|
{
|
||||||
SetMazeActive(false);
|
|
||||||
SetPelletsActive(false);
|
SetPelletsActive(false);
|
||||||
SetMazeVisible(false);
|
SetMazeVisible(false);
|
||||||
SetGhostsActive(false);
|
SetGhostsActive(false);
|
||||||
@@ -298,11 +304,6 @@ namespace Marro.PacManUdon
|
|||||||
demo.gameObject.SetActive(false);
|
demo.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMazeActive(bool active)
|
|
||||||
{
|
|
||||||
maze.gameObject.SetActive(active);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPelletsActive(bool active)
|
void SetPelletsActive(bool active)
|
||||||
{
|
{
|
||||||
pelletPool.gameObject.SetActive(active);
|
pelletPool.gameObject.SetActive(active);
|
||||||
|
|||||||
@@ -558,10 +558,10 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateSpeed()
|
public void UpdateSpeed()
|
||||||
{
|
{
|
||||||
speed = ghostManager.GetTargetSpeed(this, ghostState, isScared, inTunnel);
|
speed = ghostManager.GetTargetSpeed(this, ghostState, isScared, inTunnel);
|
||||||
Debug.Log($"Ghost updated speed to {speed}, level: {ghostManager.elroyLevel}");
|
// Debug.Log($"Ghost with type {ghostType} updated speed to {speed}, ghostState: {ghostState}, isScared: {isScared}, inTunnel: {inTunnel}, elroyLevel: {ghostManager.elroyLevel}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetHousePelletCounter()
|
public void ResetHousePelletCounter()
|
||||||
@@ -695,14 +695,10 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
animator.speed = frozen && !keepAnimating ? 0 : 1; // This would cause issues if the returning sprite was animated, luckily it isn't :)
|
animator.speed = frozen && !keepAnimating ? 0 : 1; // This would cause issues if the returning sprite was animated, luckily it isn't :)
|
||||||
|
|
||||||
if (frozen == false)
|
if (frozen == false && faceInStartingDirectionUntilUnfrozen)
|
||||||
{
|
{
|
||||||
|
faceInStartingDirectionUntilUnfrozen = false;
|
||||||
if (faceInStartingDirectionUntilUnfrozen)
|
UpdateAnimator();
|
||||||
{
|
|
||||||
faceInStartingDirectionUntilUnfrozen = false;
|
|
||||||
UpdateAnimator();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,14 +190,14 @@
|
|||||||
gameController.GhostCaught(0);
|
gameController.GhostCaught(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
|
// Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
|
||||||
ghostScaredQueue.Add(ghost);
|
ghostScaredQueue.Add(ghost);
|
||||||
GhostCaughtExecute(ghost);
|
GhostCaughtExecute(ghost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GhostCaughtContinue()
|
public void GhostCaughtContinue()
|
||||||
{
|
{
|
||||||
Debug.Log($"{gameObject} GhostCaughtContinue with ghost queue length {ghostScaredQueue.Count}");
|
// Debug.Log($"{gameObject} GhostCaughtContinue with ghost queue length {ghostScaredQueue.Count}");
|
||||||
if (!ghostScaredQueue.TryGetValue(0, out DataToken currentGhost))
|
if (!ghostScaredQueue.TryGetValue(0, out DataToken currentGhost))
|
||||||
{
|
{
|
||||||
Debug.LogError("Called GhostCaughtContinue without a ghost in the queue!");
|
Debug.LogError("Called GhostCaughtContinue without a ghost in the queue!");
|
||||||
@@ -326,9 +326,10 @@
|
|||||||
pelletTimeoutLimit = PacManConstants.GetGhostHousePelletTimeoutLimitForLevel(level);
|
pelletTimeoutLimit = PacManConstants.GetGhostHousePelletTimeoutLimitForLevel(level);
|
||||||
|
|
||||||
int[] privatePelletCounterReleaseValues = PacManConstants.GetGhostHousePrivatePelletCounterLimitForLevel(level);
|
int[] privatePelletCounterReleaseValues = PacManConstants.GetGhostHousePrivatePelletCounterLimitForLevel(level);
|
||||||
for (int i = 0; i < Math.Min(sharedPelletCounterReleaseValues.Length, ghosts.Length); i++)
|
for (int i = 0; i < ghosts.Length; i++)
|
||||||
{
|
{
|
||||||
ghosts[i].SetHousePelletCounterLimit(privatePelletCounterReleaseValues[i]);
|
ghosts[i].SetHousePelletCounterLimit(privatePelletCounterReleaseValues[i]);
|
||||||
|
ghosts[i].Reset(); // Reset needed to properly apply level
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,18 +8,18 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
public virtual Vector2 GetPosition()
|
public virtual Vector2 GetPosition()
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"{gameObject} does not implement GetPosition");
|
Debug.LogError($"{gameObject} does not implement GetPosition");
|
||||||
return Vector2.zero;
|
return Vector2.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetPosition(Vector2 position)
|
public virtual void SetPosition(Vector2 position)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"{gameObject} does not implement SetPosition");
|
Debug.LogError($"{gameObject} does not implement SetPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Vector2 GetDirection()
|
public virtual Vector2 GetDirection()
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"{gameObject} does not implement GetDirection");
|
Debug.LogError($"{gameObject} does not implement GetDirection");
|
||||||
return Vector2.zero;
|
return Vector2.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,14 +101,12 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
if (level == PoleStrechLevels.Strech1 || level == PoleStrechLevels.Separated) // Step forward timed procedure
|
if (level == PoleStrechLevels.Strech1 || level == PoleStrechLevels.Separated) // Step forward timed procedure
|
||||||
{
|
{
|
||||||
Debug.Log($"Intermission2Pole Intermission2PoleUpdate");
|
|
||||||
_gameManager.Intermission2PoleUpdate();
|
_gameManager.Intermission2PoleUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetStrechLevel(PoleStrechLevels level)
|
public void SetStrechLevel(PoleStrechLevels level)
|
||||||
{
|
{
|
||||||
Debug.Log($"Intermission2Pole SetStrechLevel {level}");
|
|
||||||
_animator.SetFloat("Strech", GetAnimatorValueForStrechLevel(level));
|
_animator.SetFloat("Strech", GetAnimatorValueForStrechLevel(level));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
powerPellets = GetComponentsInChildren<Animator>(true);
|
powerPellets = GetComponentsInChildren<Animator>(true);
|
||||||
Debug.Log($"{gameObject} Initialized, powerPellets: {powerPellets}");
|
// Debug.Log($"{gameObject} Initialized, powerPellets: {powerPellets}");
|
||||||
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
|
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
|
||||||
SetPowerPelletsBlink(false);
|
SetPowerPelletsBlink(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,20 +9,17 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
SetGameState(PacManGameState.AttractModeDemo);
|
SetGameState(PacManGameState.AttractModeDemo);
|
||||||
HideEverything();
|
|
||||||
SetFrozen(true);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
InitializeLevel();
|
InitializeLevel();
|
||||||
SetMazeActive(true);
|
|
||||||
SetMazeVisible(true);
|
SetMazeVisible(true);
|
||||||
SetLevel(1);
|
SetLevel(1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// Reset ghosts
|
// Setup ghosts
|
||||||
RestartLevel();
|
|
||||||
|
|
||||||
ghostManager.Ghosts[0].SetPredefinedPath(new Vector2[]{ // Blinky
|
ghostManager.Ghosts[0].SetPredefinedPath(new Vector2[]{ // Blinky
|
||||||
Vector2.down,
|
Vector2.down,
|
||||||
Vector2.left,
|
Vector2.left,
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
SetGameState(PacManGameState.AttractMode);
|
SetGameState(PacManGameState.AttractMode);
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
soundManager.SuppressSound(true);
|
soundManager.SuppressSound(true);
|
||||||
RestartLevel();
|
|
||||||
HideEverything();
|
|
||||||
SetFrozen(true);
|
|
||||||
attractScreen.gameObject.SetActive(true);
|
attractScreen.gameObject.SetActive(true);
|
||||||
attractScreen.Initialize();
|
attractScreen.Initialize();
|
||||||
for (int i = 0; i <= 15; i++)
|
for (int i = 0; i <= 15; i++)
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
// Show just level display
|
// Show just level display
|
||||||
RestartLevel();
|
|
||||||
statusDisplay.SetLevelDisplayVisible(true);
|
statusDisplay.SetLevelDisplayVisible(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -20,7 +21,6 @@ namespace Marro.PacManUdon
|
|||||||
soundManager.SuppressSound(false);
|
soundManager.SuppressSound(false);
|
||||||
soundManager.StartIntermissionSound();
|
soundManager.StartIntermissionSound();
|
||||||
|
|
||||||
pacMan.Reset();
|
|
||||||
pacMan.SetLevel(4);
|
pacMan.SetLevel(4);
|
||||||
pacMan.SetPowerPellet(false); // Update speed
|
pacMan.SetPowerPellet(false); // Update speed
|
||||||
pacMan.SetKinematic(true);
|
pacMan.SetKinematic(true);
|
||||||
@@ -28,7 +28,6 @@ namespace Marro.PacManUdon
|
|||||||
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
|
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
|
||||||
pacMan.SetDirection(Vector2.left);
|
pacMan.SetDirection(Vector2.left);
|
||||||
|
|
||||||
ghostManager.Reset();
|
|
||||||
ghostManager.SetLevel(5);
|
ghostManager.SetLevel(5);
|
||||||
ghostManager.SetKinematic(true);
|
ghostManager.SetKinematic(true);
|
||||||
ghostManager.gameObject.SetActive(true);
|
ghostManager.gameObject.SetActive(true);
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
// Show just level display
|
// Show just level display
|
||||||
RestartLevel();
|
|
||||||
statusDisplay.SetLevelDisplayVisible(true);
|
statusDisplay.SetLevelDisplayVisible(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -27,7 +28,6 @@ namespace Marro.PacManUdon
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// Start animation, pacman running and blinky prepared to chase
|
// Start animation, pacman running and blinky prepared to chase
|
||||||
pacMan.Reset();
|
|
||||||
pacMan.SetLevel(4);
|
pacMan.SetLevel(4);
|
||||||
pacMan.SetPowerPellet(false); // Update speed
|
pacMan.SetPowerPellet(false); // Update speed
|
||||||
pacMan.SetKinematic(true);
|
pacMan.SetKinematic(true);
|
||||||
@@ -35,7 +35,6 @@ namespace Marro.PacManUdon
|
|||||||
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
|
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
|
||||||
pacMan.SetDirection(Vector2.left);
|
pacMan.SetDirection(Vector2.left);
|
||||||
|
|
||||||
ghostManager.Reset();
|
|
||||||
ghostManager.SetLevel(5);
|
ghostManager.SetLevel(5);
|
||||||
ghostManager.SetKinematic(true);
|
ghostManager.SetKinematic(true);
|
||||||
ghostManager.gameObject.SetActive(true);
|
ghostManager.gameObject.SetActive(true);
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
// Show just level display
|
// Show just level display
|
||||||
RestartLevel();
|
|
||||||
statusDisplay.SetLevelDisplayVisible(true);
|
statusDisplay.SetLevelDisplayVisible(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -20,7 +21,6 @@ namespace Marro.PacManUdon
|
|||||||
soundManager.SuppressSound(false);
|
soundManager.SuppressSound(false);
|
||||||
soundManager.StartIntermissionSound();
|
soundManager.StartIntermissionSound();
|
||||||
|
|
||||||
pacMan.Reset();
|
|
||||||
pacMan.SetLevel(4);
|
pacMan.SetLevel(4);
|
||||||
pacMan.SetPowerPellet(false); // Update speed
|
pacMan.SetPowerPellet(false); // Update speed
|
||||||
pacMan.SetKinematic(true);
|
pacMan.SetKinematic(true);
|
||||||
@@ -28,7 +28,6 @@ namespace Marro.PacManUdon
|
|||||||
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
|
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
|
||||||
pacMan.SetDirection(Vector2.left);
|
pacMan.SetDirection(Vector2.left);
|
||||||
|
|
||||||
ghostManager.Reset();
|
|
||||||
ghostManager.SetLevel(5);
|
ghostManager.SetLevel(5);
|
||||||
ghostManager.SetKinematic(true);
|
ghostManager.SetKinematic(true);
|
||||||
ghostManager.gameObject.SetActive(true);
|
ghostManager.gameObject.SetActive(true);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Marro.PacManUdon
|
|||||||
soundManager.PlayDeathSound();
|
soundManager.PlayDeathSound();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// Hide pacman, start next state
|
// Hide pacman
|
||||||
SetPacManActive(false);
|
SetPacManActive(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,35 +12,21 @@ namespace Marro.PacManUdon
|
|||||||
// Prepare new game, hide everything except score bar
|
// Prepare new game, hide everything except score bar
|
||||||
gameState = PacManGameState.InGame;
|
gameState = PacManGameState.InGame;
|
||||||
|
|
||||||
HideEverything();
|
|
||||||
|
|
||||||
SetMazeActive(true);
|
|
||||||
|
|
||||||
InitializeNewGame();
|
InitializeNewGame();
|
||||||
InitializeLevel();
|
InitializeLevel();
|
||||||
RestartLevel();
|
PrepareForCutscene();
|
||||||
SetFrozen(true);
|
|
||||||
soundManager.SuppressSound(false);
|
soundManager.SuppressSound(false);
|
||||||
soundManager.PlayGameStartSound();
|
soundManager.PlayGameStartSound();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// Show maze, lives indicator, level indicator, player 1 and ready text
|
// Show maze, lives indicator, level indicator, player 1 and ready text
|
||||||
|
|
||||||
// SOMEWHERE IN HERE UNITY (EDITOR) APPEARS TO HAVE A SMALL RANDOM CHANCE OF CRASHING !!
|
|
||||||
Debug.Log("Log dump in case of crash");
|
|
||||||
Debug.Log("Setting pellets visible");
|
|
||||||
SetPelletsActive(true);
|
SetPelletsActive(true);
|
||||||
Debug.Log("Setting maze visible");
|
|
||||||
SetMazeVisible(true);
|
SetMazeVisible(true);
|
||||||
Debug.Log("Setting extra lives display visible");
|
|
||||||
statusDisplay.SetExtraLivesDisplayVisible(true);
|
statusDisplay.SetExtraLivesDisplayVisible(true);
|
||||||
Debug.Log("Setting level display visible");
|
|
||||||
statusDisplay.SetLevelDisplayVisible(true);
|
statusDisplay.SetLevelDisplayVisible(true);
|
||||||
Debug.Log("Setting player 1 text visible");
|
|
||||||
statusDisplay.SetPlayer1TextVisible(true);
|
statusDisplay.SetPlayer1TextVisible(true);
|
||||||
Debug.Log("Setting ready text visible");
|
|
||||||
statusDisplay.SetReadyTextVisible(true);
|
statusDisplay.SetReadyTextVisible(true);
|
||||||
Debug.Log("Starting 1UP blink");
|
|
||||||
statusDisplay.SetLabel1UPTextBlinking(true);
|
statusDisplay.SetLabel1UPTextBlinking(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
// Reset, show maze and score display
|
// Reset, show maze and score display
|
||||||
InitializeLevel();
|
InitializeLevel();
|
||||||
RestartLevel();
|
|
||||||
SetMazeVisible(true);
|
SetMazeVisible(true);
|
||||||
statusDisplay.SetScoreDisplayVisible(true);
|
statusDisplay.SetScoreDisplayVisible(true);
|
||||||
soundManager.SuppressSound(false);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// Increment level, show ready, show pellets, show lives indicators
|
// Increment level, show ready, show pellets, show lives indicators
|
||||||
@@ -39,6 +39,7 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
// Unfreeze
|
// Unfreeze
|
||||||
SetFrozen(false);
|
SetFrozen(false);
|
||||||
|
soundManager.SuppressSound(false);
|
||||||
soundManager.StartGhostSound();
|
soundManager.StartGhostSound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,31 +13,23 @@ namespace Marro.PacManUdon
|
|||||||
// I'm not redoing this unless I get instantiatable classes before I wrap up this project.
|
// I'm not redoing this unless I get instantiatable classes before I wrap up this project.
|
||||||
bool currentlyInTimeSequence;
|
bool currentlyInTimeSequence;
|
||||||
bool waitingForTimeSequenceFinish;
|
bool waitingForTimeSequenceFinish;
|
||||||
|
bool jumpingToTimeSequence;
|
||||||
PacManTimeSequence currentTimeSequence;
|
PacManTimeSequence currentTimeSequence;
|
||||||
bool hasTimeSequenceQueued;
|
|
||||||
private DataList timeSequenceQueue;
|
|
||||||
[UdonSynced] float timeSequenceSecondsPassed;
|
[UdonSynced] float timeSequenceSecondsPassed;
|
||||||
int timeSequenceProgress;
|
int timeSequenceProgress;
|
||||||
float[] timeSequenceKeyframeTimes;
|
float[] timeSequenceKeyframeTimes;
|
||||||
|
|
||||||
private void StartTimeSequence(PacManTimeSequence timeSequence)
|
private void StartTimeSequence(PacManTimeSequence timeSequence)
|
||||||
{
|
{
|
||||||
if (timeSequenceQueue == null)
|
|
||||||
{
|
|
||||||
timeSequenceQueue = new DataList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentlyInTimeSequence == true)
|
|
||||||
{
|
|
||||||
int timeSequenceInt = (int)timeSequence; // Doing the conversion in the line below crashes the script. I love working in Udon
|
|
||||||
timeSequenceQueue.Add(timeSequenceInt);
|
|
||||||
hasTimeSequenceQueued = true;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log($"StartTimeSequence: {timeSequence}");
|
Debug.Log($"StartTimeSequence: {timeSequence}");
|
||||||
|
|
||||||
|
if (currentlyInTimeSequence)
|
||||||
|
{
|
||||||
|
TimeSequenceEndCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeSequencePrepareForStart(timeSequence);
|
||||||
|
|
||||||
currentlyInTimeSequence = true;
|
currentlyInTimeSequence = true;
|
||||||
currentTimeSequence = timeSequence;
|
currentTimeSequence = timeSequence;
|
||||||
timeSequenceProgress = 0;
|
timeSequenceProgress = 0;
|
||||||
@@ -45,32 +37,22 @@ namespace Marro.PacManUdon
|
|||||||
timeSequenceKeyframeTimes = GetTimeSequenceKeyframeTimes(timeSequence);
|
timeSequenceKeyframeTimes = GetTimeSequenceKeyframeTimes(timeSequence);
|
||||||
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TimeSequenceEndCurrent()
|
||||||
|
{
|
||||||
|
jumpingToTimeSequence = true;
|
||||||
|
TimeSequenceProgressToTime(100000f);
|
||||||
|
jumpingToTimeSequence = false;
|
||||||
|
}
|
||||||
|
|
||||||
private void TimeSequenceUpdate(float deltaSeconds)
|
private void TimeSequenceUpdate(float deltaSeconds)
|
||||||
{
|
{
|
||||||
if (!currentlyInTimeSequence && hasTimeSequenceQueued)
|
if (!currentlyInTimeSequence)
|
||||||
{
|
{
|
||||||
timeSequenceQueue.TryGetValue(0, out DataToken nextTimeSequence);
|
|
||||||
StartTimeSequence((PacManTimeSequence)nextTimeSequence.Int);
|
|
||||||
timeSequenceQueue.RemoveAt(0);
|
|
||||||
hasTimeSequenceQueued = timeSequenceQueue.Count > 0 ? true : false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentlyInTimeSequence)
|
TimeSequenceProgressToTime(timeSequenceSecondsPassed + deltaSeconds);
|
||||||
{
|
|
||||||
if (hasTimeSequenceQueued)
|
|
||||||
{
|
|
||||||
while (currentlyInTimeSequence)
|
|
||||||
{
|
|
||||||
TimeSequenceSkipToNextStep();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TimeSequenceProgressToTime(timeSequenceSecondsPassed + deltaSeconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TimeSequenceSkipToNextStep()
|
private void TimeSequenceSkipToNextStep()
|
||||||
@@ -92,26 +74,26 @@ namespace Marro.PacManUdon
|
|||||||
timeSequenceSecondsPassed = seconds;
|
timeSequenceSecondsPassed = seconds;
|
||||||
while (timeSequenceSecondsPassed >= timeSequenceKeyframeTimes[timeSequenceProgress])
|
while (timeSequenceSecondsPassed >= timeSequenceKeyframeTimes[timeSequenceProgress])
|
||||||
{
|
{
|
||||||
TimeSequenceExecuteStep(timeSequenceProgress);
|
TimeSequenceExecuteStep(currentTimeSequence, timeSequenceProgress);
|
||||||
|
|
||||||
timeSequenceProgress += 1;
|
timeSequenceProgress += 1;
|
||||||
if (timeSequenceProgress >= timeSequenceKeyframeTimes.Length)
|
if (timeSequenceProgress >= timeSequenceKeyframeTimes.Length)
|
||||||
{
|
{
|
||||||
currentlyInTimeSequence = false;
|
currentlyInTimeSequence = false;
|
||||||
TimeSequencePrepareForFinish();
|
TimeSequencePrepareForFinish(currentTimeSequence);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TimeSequencePrepareForFinish()
|
private void TimeSequencePrepareForFinish(PacManTimeSequence timeSequence)
|
||||||
{
|
{
|
||||||
if (Networking.IsOwner(gameObject))
|
if (Networking.IsOwner(gameObject))
|
||||||
{
|
{
|
||||||
TimeSequenceExecuteFinalize();
|
TimeSequenceExecuteFinalize(timeSequence);
|
||||||
if (!hasTimeSequenceQueued)
|
if (!jumpingToTimeSequence)
|
||||||
{
|
{
|
||||||
TimeSequenceExecuteFinished();
|
TimeSequenceExecuteFinished(timeSequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -201,10 +183,37 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
#region Jump tables
|
#region Jump tables
|
||||||
|
|
||||||
private void TimeSequenceExecuteStep(int sequenceProgress)
|
private void TimeSequencePrepareForStart(PacManTimeSequence timeSequence)
|
||||||
|
{
|
||||||
|
switch (timeSequence)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
Debug.LogError($"{gameObject} No time sequence start known for sequence {currentTimeSequence}");
|
||||||
|
break;
|
||||||
|
case PacManTimeSequence.AttractScreenIntroduction:
|
||||||
|
case PacManTimeSequence.AttractScreenDemo:
|
||||||
|
case PacManTimeSequence.StartNewGame:
|
||||||
|
case PacManTimeSequence.WaitForStart:
|
||||||
|
case PacManTimeSequence.StartNewLevel:
|
||||||
|
case PacManTimeSequence.Intermission1:
|
||||||
|
case PacManTimeSequence.Intermission2:
|
||||||
|
case PacManTimeSequence.Intermission3:
|
||||||
|
case PacManTimeSequence.AttractScreenWaitToRestart:
|
||||||
|
case PacManTimeSequence.WaitForStartTimeout:
|
||||||
|
case PacManTimeSequence.GhostCaught:
|
||||||
|
case PacManTimeSequence.GameOver:
|
||||||
|
case PacManTimeSequence.PacManCaught:
|
||||||
|
case PacManTimeSequence.BoardClear:
|
||||||
|
case PacManTimeSequence.RestartLevel:
|
||||||
|
// These don't have start logic
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TimeSequenceExecuteStep(PacManTimeSequence timeSequence, int sequenceProgress)
|
||||||
{
|
{
|
||||||
// Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
|
// Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
|
||||||
switch (currentTimeSequence)
|
switch (timeSequence)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
Debug.LogError($"{gameObject} No time sequence keyframes known for sequence {currentTimeSequence}");
|
Debug.LogError($"{gameObject} No time sequence keyframes known for sequence {currentTimeSequence}");
|
||||||
@@ -255,10 +264,10 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TimeSequenceExecuteFinalize()
|
private void TimeSequenceExecuteFinalize(PacManTimeSequence timeSequence)
|
||||||
{
|
{
|
||||||
// Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
|
// Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
|
||||||
switch (currentTimeSequence)
|
switch (timeSequence)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
Debug.LogError($"{gameObject} No time sequence finalize known for sequence {currentTimeSequence}");
|
Debug.LogError($"{gameObject} No time sequence finalize known for sequence {currentTimeSequence}");
|
||||||
@@ -299,10 +308,10 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TimeSequenceExecuteFinished()
|
private void TimeSequenceExecuteFinished(PacManTimeSequence timeSequence)
|
||||||
{
|
{
|
||||||
// Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
|
// Debug.Log($"{gameObject} Triggered time sequence step for sequence {currentTimeSequence} with progress {sequenceProgress}");
|
||||||
switch (currentTimeSequence)
|
switch (timeSequence)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
Debug.LogError($"{gameObject} No time sequence finish known for sequence {currentTimeSequence}");
|
Debug.LogError($"{gameObject} No time sequence finish known for sequence {currentTimeSequence}");
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a11df70b39ac2924c825f9951b58dafd
|
guid: 506fd020620e6d24787a909c153b2da5
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -7,8 +7,9 @@ namespace Marro.PacManUdon
|
|||||||
switch (sequenceProgress)
|
switch (sequenceProgress)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
PrepareForCutscene();
|
||||||
|
|
||||||
SetGameState(PacManGameState.WaitForStart);
|
SetGameState(PacManGameState.WaitForStart);
|
||||||
HideEverything();
|
|
||||||
soundManager.SuppressSound(false);
|
soundManager.SuppressSound(false);
|
||||||
soundManager.PlayCoinSound();
|
soundManager.PlayCoinSound();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -188,17 +188,17 @@ public class SoundManager : UdonSharpBehaviour
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!audioSource.isPlaying || audioSource.clip == null)
|
||||||
|
{
|
||||||
|
PlaySound(audioSource, audioClip, loop);
|
||||||
|
}
|
||||||
|
|
||||||
if (audioSource.clip == audioClip)
|
if (audioSource.clip == audioClip)
|
||||||
{
|
{
|
||||||
// No need to switch
|
// No need to switch
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!audioSource.isPlaying || audioSource.clip == null)
|
|
||||||
{
|
|
||||||
PlaySound(audioSource, audioClip, loop);
|
|
||||||
}
|
|
||||||
|
|
||||||
var newTimeSamples = (int)(audioSource.timeSamples / (double)audioSource.clip.samples * audioClip.samples);
|
var newTimeSamples = (int)(audioSource.timeSamples / (double)audioSource.clip.samples * audioClip.samples);
|
||||||
|
|
||||||
audioSource.clip = audioClip;
|
audioSource.clip = audioClip;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
{
|
{
|
||||||
extraLifeIndicators[i - 1] = extraLifeIndicatorTransforms[i].gameObject;
|
extraLifeIndicators[i - 1] = extraLifeIndicatorTransforms[i].gameObject;
|
||||||
}
|
}
|
||||||
Debug.Log($"{gameObject} extraLifeIndicators.Length: {extraLifeIndicators.Length}");
|
// Debug.Log($"{gameObject} extraLifeIndicators.Length: {extraLifeIndicators.Length}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ PlayerSettings:
|
|||||||
m_Automatic: 0
|
m_Automatic: 0
|
||||||
- m_BuildTarget: iOSSupport
|
- m_BuildTarget: iOSSupport
|
||||||
m_APIs: 10000000
|
m_APIs: 10000000
|
||||||
m_Automatic: 1
|
m_Automatic: 0
|
||||||
- m_BuildTarget: WindowsStandaloneSupport
|
- m_BuildTarget: WindowsStandaloneSupport
|
||||||
m_APIs: 02000000
|
m_APIs: 02000000
|
||||||
m_Automatic: 0
|
m_Automatic: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user