Cleaning up
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,22 +25,12 @@ namespace Marro.PacManUdon
|
|||||||
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:
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ namespace Marro.PacManUdon
|
|||||||
RestartLevel();
|
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 +38,7 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
// Unfreeze
|
// Unfreeze
|
||||||
SetFrozen(false);
|
SetFrozen(false);
|
||||||
|
soundManager.SuppressSound(false);
|
||||||
soundManager.StartGhostSound();
|
soundManager.StartGhostSound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
if (currentlyInTimeSequence)
|
if (currentlyInTimeSequence)
|
||||||
{
|
{
|
||||||
PrepareToStartTimeSequence(timeSequence);
|
TimeSequenceEndCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimeSequencePrepareForStart(timeSequence);
|
||||||
|
|
||||||
currentlyInTimeSequence = true;
|
currentlyInTimeSequence = true;
|
||||||
currentTimeSequence = timeSequence;
|
currentTimeSequence = timeSequence;
|
||||||
timeSequenceProgress = 0;
|
timeSequenceProgress = 0;
|
||||||
@@ -36,7 +38,7 @@ namespace Marro.PacManUdon
|
|||||||
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
TimeSequenceProgressToTime(timeSequenceSecondsPassed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrepareToStartTimeSequence(PacManTimeSequence timeSequence)
|
private void TimeSequenceEndCurrent()
|
||||||
{
|
{
|
||||||
jumpingToTimeSequence = true;
|
jumpingToTimeSequence = true;
|
||||||
TimeSequenceProgressToTime(100000f);
|
TimeSequenceProgressToTime(100000f);
|
||||||
@@ -72,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 (!jumpingToTimeSequence)
|
if (!jumpingToTimeSequence)
|
||||||
{
|
{
|
||||||
TimeSequenceExecuteFinished();
|
TimeSequenceExecuteFinished(timeSequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -181,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}");
|
||||||
@@ -235,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}");
|
||||||
@@ -279,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}");
|
||||||
|
|||||||
@@ -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