Intermission 2

This commit is contained in:
2025-12-21 17:40:26 +01:00
parent fb539bfdf5
commit 346ae7884e
41 changed files with 2541 additions and 542 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -38,6 +38,7 @@ namespace Marro.PacManUdon
private Maze maze;
private VRCObjectPool pelletPool;
private Intermission2Pole intermission2Pole;
private Animator mazeSpriteAnimator;
private int pelletCountTotal;
@@ -53,10 +54,6 @@ namespace Marro.PacManUdon
public void Start()
{
maze = mazes[0];
pelletPool = maze.pelletContainer.GetComponent<VRCObjectPool>();
mazeSpriteAnimator = maze.mazeSprite.GetComponent<Animator>();
attractScreenElements = new GameObject[attractScreen.transform.childCount];
for (int i = 0; i < attractScreenElements.Length; i++)
{
@@ -69,6 +66,11 @@ namespace Marro.PacManUdon
intermissionScreenElements[i] = intermissionScreen.transform.GetChild(i).gameObject;
}
maze = mazes[0];
pelletPool = maze.pelletContainer.GetComponent<VRCObjectPool>();
mazeSpriteAnimator = maze.mazeSprite.GetComponent<Animator>();
intermission2Pole = intermissionScreenElements[4].GetComponent<Intermission2Pole>();
ghostManager.Initialize(maze.ghostTargets, pacMan, this);
pacMan.Initialize(playerInput, pelletPool, this);
bonusFruit.Initialize();
@@ -76,6 +78,9 @@ namespace Marro.PacManUdon
statusDisplay.Initialize();
playerInput.Initialize(this);
soundManager.Initialize();
intermission2Pole.Initialize(this, ghostManager.Ghosts[0]);
HideEverything();
SetScore(0);
SetHighScore(0);
@@ -258,6 +263,11 @@ namespace Marro.PacManUdon
soundManager.SetGhostRetreat(false);
}
public void Intermission2PoleUpdate()
{
TimeSequenceSkipToNextStep();
}
void BoardClearAnimation()
{
ghostManager.gameObject.SetActive(false);
@@ -273,6 +283,7 @@ namespace Marro.PacManUdon
SetGhostsActive(false);
SetPacManActive(false);
SetPressStartButtonScreenVisible(false);
SetIntermissionScreenVisible(false);
statusDisplay.SetGameOverTextVisible(false);
statusDisplay.SetExtraLivesDisplayVisible(false);
statusDisplay.SetLevelDisplayVisible(false);
@@ -311,6 +322,11 @@ namespace Marro.PacManUdon
pressStartButtonScreen.SetActive(visible);
}
void SetIntermissionScreenVisible(bool visible)
{
intermissionScreen.SetActive(visible);
}
void SetGameState(PacManGameState newGameState)
{
// Debug.Log($"{gameObject} State transitioning from {gameState} to {newGameState}");
@@ -622,6 +638,9 @@ namespace Marro.PacManUdon
case PacManTimeSequence.Intermission1:
TimeSequenceStepIntermission1(sequenceProgress);
break;
case PacManTimeSequence.Intermission2:
TimeSequenceStepIntermission2(sequenceProgress);
break;
}
}
@@ -657,6 +676,8 @@ namespace Marro.PacManUdon
return DeltaToAbsolute(new float[] { 0, 1.95f });
case PacManTimeSequence.Intermission1:
return DeltaToAbsolute(new float[] { 0, 0.316f, 4.26f, 2.15f, 4.03f });
case PacManTimeSequence.Intermission2:
return DeltaToAbsolute(new float[] { 0, 0.25f, 0.083f, 0.3f, 1.43f, 2.5f, 1.816f, 1.25f, 0.017f, 1f, 1.966f, 0.033f });
}
}

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 37
Data: 38
- Name:
Entry: 7
Data:
@@ -1057,13 +1057,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: followingPredefinedPath
Data: specialLook
- Name: $v
Entry: 7
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: followingPredefinedPath
Data: specialLook
- Name: <UserType>k__BackingField
Entry: 9
Data: 48
@@ -1105,25 +1105,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: predefinedPath
Data: followingPredefinedPath
- Name: $v
Entry: 7
Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPath
Data: followingPredefinedPath
- Name: <UserType>k__BackingField
Entry: 7
Data: 59|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
Entry: 9
Data: 48
- Name: <SystemType>k__BackingField
Entry: 9
Data: 59
Data: 48
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1138,7 +1132,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1159,19 +1153,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: predefinedPathIndex
Data: predefinedPath
- Name: $v
Entry: 7
Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: predefinedPathIndex
Data: predefinedPath
- Name: <UserType>k__BackingField
Entry: 9
Data: 4
Entry: 7
Data: 61|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector2[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 4
Data: 61
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1207,13 +1207,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: rngState
Data: predefinedPathIndex
- Name: $v
Entry: 7
Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: rngState
Data: predefinedPathIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 4
@@ -1224,8 +1224,8 @@ MonoBehaviour:
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
Entry: 6
Data:
- Name:
Entry: 8
Data:
@@ -1235,12 +1235,60 @@ MonoBehaviour:
- Name: _fieldAttributes
Entry: 7
Data: 64|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: rngState
- Name: $v
Entry: 7
Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: rngState
- Name: <UserType>k__BackingField
Entry: 9
Data: 4
- Name: <SystemType>k__BackingField
Entry: 9
Data: 4
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 65|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 67|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1264,7 +1312,7 @@ MonoBehaviour:
Data: syncedPosition
- Name: $v
Entry: 7
Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: syncedPosition
@@ -1288,13 +1336,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 69|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 68|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 70|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1318,13 +1366,13 @@ MonoBehaviour:
Data: speed
- Name: $v
Entry: 7
Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: speed
- Name: <UserType>k__BackingField
Entry: 7
Data: 70|System.RuntimeType, mscorlib
Data: 72|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
@@ -1333,7 +1381,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 70
Data: 72
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1348,13 +1396,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 71|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 73|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 72|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 74|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1378,7 +1426,7 @@ MonoBehaviour:
Data: direction
- Name: $v
Entry: 7
Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: direction
@@ -1402,13 +1450,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 76|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 75|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 77|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1432,7 +1480,7 @@ MonoBehaviour:
Data: target
- Name: $v
Entry: 7
Data: 76|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 78|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: target
@@ -1456,13 +1504,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 79|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 78|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 80|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1486,7 +1534,7 @@ MonoBehaviour:
Data: offGrid
- Name: $v
Entry: 7
Data: 79|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 81|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: offGrid
@@ -1510,13 +1558,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 80|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 82|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 81|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 83|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1540,7 +1588,7 @@ MonoBehaviour:
Data: inTunnel
- Name: $v
Entry: 7
Data: 82|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 84|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: inTunnel
@@ -1564,13 +1612,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 83|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 85|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 84|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 86|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1594,13 +1642,13 @@ MonoBehaviour:
Data: ghostState
- Name: $v
Entry: 7
Data: 85|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 87|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ghostState
- Name: <UserType>k__BackingField
Entry: 7
Data: 86|System.RuntimeType, mscorlib
Data: 88|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManGhostState, Assembly-CSharp
@@ -1624,13 +1672,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 87|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 89|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 88|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 90|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1654,7 +1702,7 @@ MonoBehaviour:
Data: isScared
- Name: $v
Entry: 7
Data: 89|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 91|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isScared
@@ -1678,13 +1726,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 90|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 92|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 91|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 93|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1708,7 +1756,7 @@ MonoBehaviour:
Data: scattering
- Name: $v
Entry: 7
Data: 92|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 94|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: scattering
@@ -1732,13 +1780,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 93|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 95|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 94|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 96|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1762,13 +1810,13 @@ MonoBehaviour:
Data: frozenState
- Name: $v
Entry: 7
Data: 95|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 97|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: frozenState
- Name: <UserType>k__BackingField
Entry: 7
Data: 96|System.RuntimeType, mscorlib
Data: 98|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PacManGhostFrozenState, Assembly-CSharp
@@ -1792,13 +1840,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 97|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 99|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 98|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 100|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1822,7 +1870,7 @@ MonoBehaviour:
Data: hideUntilUnfrozen
- Name: $v
Entry: 7
Data: 99|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 101|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: hideUntilUnfrozen
@@ -1846,14 +1894,14 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 100|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 102|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 101|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 103|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1877,7 +1925,7 @@ MonoBehaviour:
Data: housePelletCounter
- Name: $v
Entry: 7
Data: 102|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 104|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: housePelletCounter
@@ -1901,14 +1949,14 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 103|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 105|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 104|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 106|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1932,7 +1980,7 @@ MonoBehaviour:
Data: housePelletCounterActive
- Name: $v
Entry: 7
Data: 105|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 107|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: housePelletCounterActive
@@ -1956,14 +2004,14 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 106|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 108|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 107|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 109|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1987,7 +2035,7 @@ MonoBehaviour:
Data: turnAroundSoon
- Name: $v
Entry: 7
Data: 108|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 110|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: turnAroundSoon
@@ -2011,14 +2059,14 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 109|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 111|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 110|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 112|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:

View File

@@ -18,7 +18,8 @@ namespace Marro.PacManUdon
Blinky,
Pinky,
Inky,
Clyde
Clyde,
Special,
}
public enum PacManGhostState
@@ -65,6 +66,7 @@ namespace Marro.PacManUdon
private int housePelletCounterLimit;
private bool faceInStartingDirectionUntilUnfrozen;
private bool specialLook;
private bool followingPredefinedPath;
private Vector2[] predefinedPath;
@@ -137,7 +139,7 @@ namespace Marro.PacManUdon
kinematic = false;
followingPredefinedPath = false;
turnAroundSoon = false;
// scattering = true;
specialLook = false;
rngState = 1;
UpdateSpeed();
@@ -145,7 +147,7 @@ namespace Marro.PacManUdon
faceInStartingDirectionUntilUnfrozen = true;
UpdateAnimator();
RequestSerialization();
// animator.Play(0, -1, 0);
// Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}");
}
@@ -482,7 +484,11 @@ namespace Marro.PacManUdon
return;
// Debug.Log($"{gameObject} UpdateAnimator with state: {ghostState}, isScared: {isScared}, direction: {direction}");
if (isScared)
if (specialLook)
{
animator.SetFloat("GhostType", GhostTypeToAnimationValue(PacManGhostType.Special));
}
else if (isScared)
{
float currentGhostType = animator.GetFloat("GhostType");
if (currentGhostType > 0.5f && currentGhostType < 2.5f)
@@ -519,7 +525,7 @@ namespace Marro.PacManUdon
animator.SetFloat("DirX", 0);
animator.SetFloat("DirY", -1);
}
else if (!direction.Equals(Vector2.zero))
else if (specialLook || !direction.Equals(Vector2.zero))
{
animator.SetFloat("DirX", direction.x);
animator.SetFloat("DirY", direction.y);
@@ -531,6 +537,8 @@ namespace Marro.PacManUdon
switch (ghostType)
{
default:
Debug.LogError("Invalid ghost animation value!");
return 0;
case PacManGhostType.Caught:
return 0;
case PacManGhostType.Scared:
@@ -545,6 +553,8 @@ namespace Marro.PacManUdon
return 5;
case PacManGhostType.Clyde:
return 6;
case PacManGhostType.Special:
return 7;
}
}
@@ -754,12 +764,18 @@ namespace Marro.PacManUdon
predefinedPathIndex = 0;
}
void SetInTunnel(bool inTunnel)
public void SetInTunnel(bool inTunnel)
{
this.inTunnel = inTunnel;
UpdateSpeed();
}
public void SetSpecialLook(bool enabled)
{
specialLook = enabled;
UpdateAnimator();
}
void SetVisibility(bool visible)
{
renderer.enabled = visible;
@@ -794,6 +810,12 @@ namespace Marro.PacManUdon
RequestSerialization();
}
public void SetSpeed(float speed)
{
this.speed = speed;
UpdateAnimator();
}
public override void OnPreSerialization()
{
syncedPosition = GetPosition();

View File

@@ -143,7 +143,6 @@
void UpdatePowerPellet()
{
powerPelletCountdown -= Time.deltaTime;
if (powerPelletCountdown <= 0)
{

View File

@@ -0,0 +1,280 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: Intermission2Pole
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 33352f027da089a48a08445f114d9370, type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 5561162f0532eab4ea6c388cb2d33504, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 288864006765975011
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 4
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _animator
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _gameManager
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _gameManager
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.GameManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _ghost
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ghost
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.Ghost, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _lastUpdate
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _lastUpdate
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: Marro.PacManUdon.PoleStrechLevels, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 14|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 69101ecb2e061304d8eab6d8ab57a356
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,140 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace Marro.PacManUdon
{
public enum PoleStrechLevels
{
None = 0,
Strech1 = 1,
Strech2 = 2,
Strech3 = 3,
Separated = 4,
}
[RequireComponent(typeof(Animator))]
public class Intermission2Pole : UdonSharpBehaviour
{
Animator _animator;
GameManager _gameManager;
Ghost _ghost;
PoleStrechLevels _lastUpdate;
const float Strech1Distance = 0f;
const float Strech2Distance = 0.250f;
const float Strech3Distance = 0.625f;
const float SeparatedDistance = 1f;
public void Initialize(GameManager gameManager, Ghost ghost)
{
_ghost = ghost;
_gameManager = gameManager;
_animator = GetComponent<Animator>();
Reset();
}
public void Reset()
{
_lastUpdate = PoleStrechLevels.None;
SetStrechLevel(PoleStrechLevels.None);
}
public void FixedUpdate()
{
if (!_ghost.gameObject.activeInHierarchy)
{
return;
}
var ghostDistance = -(_ghost.GetPosition().x - GetPosition().x);
// Debug.Log(ghostDistance);
if (ghostDistance < 0)
{
return;
}
var level = PoleStrechLevels.None;
if (ghostDistance >= SeparatedDistance)
{
level = PoleStrechLevels.Separated;
}
else if (ghostDistance >= Strech3Distance)
{
level = PoleStrechLevels.Strech3;
}
else if (ghostDistance >= Strech2Distance)
{
level = PoleStrechLevels.Strech2;
}
else if (ghostDistance >= Strech1Distance)
{
level = PoleStrechLevels.Strech1;
}
ProcessDistanceUpdate(level);
}
private void ProcessDistanceUpdate(PoleStrechLevels level)
{
if ((int)_lastUpdate >= (int)level)
{
return;
}
_lastUpdate = level;
if (level != PoleStrechLevels.Separated) // This one is done later via the timed procedure
{
SetStrechLevel(level);
}
else
{
// Align ghost nicely with pole :)
_ghost.SetPosition(new Vector2(GetPosition().x - SeparatedDistance, _ghost.GetPosition().y));
}
if (level == PoleStrechLevels.Strech1 || level == PoleStrechLevels.Separated) // Step forward timed procedure
{
Debug.Log($"Intermission2Pole Intermission2PoleUpdate");
_gameManager.Intermission2PoleUpdate();
}
}
public void SetStrechLevel(PoleStrechLevels level)
{
Debug.Log($"Intermission2Pole SetStrechLevel {level}");
_animator.SetFloat("Strech", GetAnimatorValueForStrechLevel(level));
}
private float GetAnimatorValueForStrechLevel(PoleStrechLevels level)
{
switch (level)
{
case PoleStrechLevels.None:
return 0f;
case PoleStrechLevels.Strech1:
return 1f;
case PoleStrechLevels.Strech2:
return 2f;
case PoleStrechLevels.Strech3:
return 3f;
case PoleStrechLevels.Separated:
return 4f;
default:
Debug.LogError("Invalid pole strech level!");
return 0f;
}
}
public Vector2 GetPosition()
{
return (Vector2)transform.localPosition;
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 07078a284b77f1345b55f46089841280
guid: 5561162f0532eab4ea6c388cb2d33504
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -16,9 +16,10 @@ namespace Marro.PacManUdon
statusDisplay.SetLevelDisplayVisible(true);
break;
case 1:
// Start animation, blinky chasing pacman
// Start animation, pacman running and blinky prepared to chase
soundManager.SuppressSound(false);
soundManager.StartIntermissionSound();
pacMan.Reset();
pacMan.SetLevel(4);
pacMan.SetPowerPellet(false); // Update speed
@@ -35,10 +36,14 @@ namespace Marro.PacManUdon
blinky.SetPosition(intermissionScreenElements[1].transform.localPosition);
blinky.SetDirection(Vector2.left);
blinky.SetState(PacManGhostState.Normal);
blinky.SetActive(true);
SetFrozen(false);
break;
case 2:
// Start blinky chasing
blinky.SetActive(true);
break;
case 3:
// Reached end, make ghost scared and turn around
blinky.BecomeScared();
blinky.SetPosition(intermissionScreenElements[3].transform.localPosition);
@@ -47,12 +52,12 @@ namespace Marro.PacManUdon
pacMan.SetPowerPellet(true);
break;
case 3:
case 4:
// Pacman starts changing ghosts
pacMan.SetDirection(Vector2.right);
pacMan.BecomeBig();
break;
case 4:
case 5:
// End cutscene
soundManager.StopAllSound();
SetFrozen(true);

View File

@@ -0,0 +1,89 @@
using UnityEngine;
namespace Marro.PacManUdon
{
public partial class GameManager
{
private void TimeSequenceStepIntermission2(int sequenceProgress)
{
var blinky = ghostManager.Ghosts[0];
switch (sequenceProgress)
{
case 0:
// Show just level display
RestartLevel();
statusDisplay.SetLevelDisplayVisible(true);
break;
case 1:
// Show pole
SetIntermissionScreenVisible(true);
intermission2Pole.Reset();
break;
case 2:
// Start music
soundManager.SuppressSound(false);
soundManager.StartIntermissionSound();
break;
case 3:
// Start animation, pacman running and blinky prepared to chase
pacMan.Reset();
pacMan.SetLevel(4);
pacMan.SetPowerPellet(false); // Update speed
pacMan.SetKinematic(true);
pacMan.SetActive(true);
pacMan.SetPosition(intermissionScreenElements[0].transform.localPosition);
pacMan.SetDirection(Vector2.left);
ghostManager.Reset();
ghostManager.SetLevel(5);
ghostManager.SetKinematic(true);
ghostManager.gameObject.SetActive(true);
blinky.SetElroy(2);
blinky.SetPosition(intermissionScreenElements[1].transform.localPosition);
blinky.SetDirection(Vector2.left);
blinky.SetState(PacManGhostState.Normal);
SetFrozen(false);
break;
case 4:
// Start blinky chasing
blinky.SetActive(true);
break;
case 5:
// Blinky catches on pole
blinky.SetSpeed(1.25f);
break;
case 6:
// Blinky cover about to tear
blinky.SetFrozen(true);
break;
case 7:
// Blinky cover tears
intermission2Pole.SetStrechLevel(PoleStrechLevels.Separated);
break;
case 8:
// Blinky sprite updates with broken cover
blinky.SetSpecialLook(true);
blinky.SetDirection(Vector2.up);
blinky.SetPosition(blinky.GetPosition() + new Vector2(-0.250f, 0f));
break;
case 9:
// Blinky looks at broken cover
blinky.SetDirection(Vector2.down);
break;
case 10:
// Cutscene starts to unload
blinky.SetDirection(Vector2.zero);
break;
case 11:
// End cutscene
SetIntermissionScreenVisible(false);
soundManager.StopAllSound();
SetFrozen(true);
StartTimeSequence(PacManTimeSequence.StartNewLevel);
break;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 902323f14d974674c82c40bb2061609b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +0,0 @@
namespace Marro.PacManUdon
{
public partial class GameManager
{
}
}