Fixed ghost caught queue
This commit is contained in:
@@ -43,7 +43,7 @@ MonoBehaviour:
|
|||||||
Data:
|
Data:
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 16
|
Data: 17
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data:
|
Data:
|
||||||
@@ -890,6 +890,54 @@ MonoBehaviour:
|
|||||||
- Name:
|
- Name:
|
||||||
Entry: 8
|
Entry: 8
|
||||||
Data:
|
Data:
|
||||||
|
- Name:
|
||||||
|
Entry: 7
|
||||||
|
Data:
|
||||||
|
- Name: $k
|
||||||
|
Entry: 1
|
||||||
|
Data: frozen
|
||||||
|
- Name: $v
|
||||||
|
Entry: 7
|
||||||
|
Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
|
- Name: <Name>k__BackingField
|
||||||
|
Entry: 1
|
||||||
|
Data: frozen
|
||||||
|
- Name: <UserType>k__BackingField
|
||||||
|
Entry: 9
|
||||||
|
Data: 26
|
||||||
|
- Name: <SystemType>k__BackingField
|
||||||
|
Entry: 9
|
||||||
|
Data: 26
|
||||||
|
- 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: 48|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:
|
- Name:
|
||||||
Entry: 13
|
Entry: 13
|
||||||
Data:
|
Data:
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace Marro.PacManUdon
|
|||||||
private int[] ghostPositions = new int[4];
|
private int[] ghostPositions = new int[4];
|
||||||
private int pacManPosition;
|
private int pacManPosition;
|
||||||
|
|
||||||
|
private bool frozen;
|
||||||
|
|
||||||
public void Initialize(GameManager gameManager, BonusFruit bonusFruit, Ghost[] ghosts)
|
public void Initialize(GameManager gameManager, BonusFruit bonusFruit, Ghost[] ghosts)
|
||||||
{
|
{
|
||||||
this.gameManager = gameManager;
|
this.gameManager = gameManager;
|
||||||
@@ -49,13 +51,29 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
powerPellets = GetComponentsInChildren<Animator>(true);
|
powerPellets = GetComponentsInChildren<Animator>(true);
|
||||||
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
|
powerPelletBlinkToggleInterval = PacManConstants.GetPowerPelletBlinkToggleInterval();
|
||||||
SetPowerPelletsBlink(false);
|
|
||||||
|
|
||||||
collisionMap = PacManConstants.GetMazeCollisionInfo();
|
collisionMap = PacManConstants.GetMazeCollisionInfo();
|
||||||
|
|
||||||
RestoreAllPellets();
|
|
||||||
|
|
||||||
SubscribeToEvent(NetworkEventType.SyncPellets);
|
SubscribeToEvent(NetworkEventType.SyncPellets);
|
||||||
|
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
SetPowerPelletsBlink(false);
|
||||||
|
|
||||||
|
RestoreAllPellets();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void SetFrozen(bool frozen)
|
||||||
|
{
|
||||||
|
this.frozen = frozen;
|
||||||
|
|
||||||
|
if (!frozen)
|
||||||
|
{
|
||||||
|
SetPowerPelletsBlink(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Collision
|
#region Collision
|
||||||
@@ -74,7 +92,7 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
ghostPositions[ghostIndex] = tile;
|
ghostPositions[ghostIndex] = tile;
|
||||||
|
|
||||||
if (tile == pacManPosition)
|
if (!frozen && tile == pacManPosition)
|
||||||
{
|
{
|
||||||
Debug.Log("Ghost hit PacMan!");
|
Debug.Log("Ghost hit PacMan!");
|
||||||
ghosts[ghostIndex].HitPacMan();
|
ghosts[ghostIndex].HitPacMan();
|
||||||
@@ -90,20 +108,28 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
pacManPosition = tilemapIndex;
|
pacManPosition = tilemapIndex;
|
||||||
|
|
||||||
TryEatGhost(tilemapIndex);
|
if (!frozen)
|
||||||
|
{
|
||||||
|
PacManTryEatGhost();
|
||||||
|
}
|
||||||
|
|
||||||
TryCollectFruit(tile, position);
|
TryCollectFruit(tile, position);
|
||||||
return TryCollectPellet(tile, tilemapIndex);
|
return TryCollectPellet(tile, tilemapIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryEatGhost(int tilemapIndex)
|
internal void PacManTryEatGhost()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ghosts.Length; i++)
|
for (int i = 0; i < ghosts.Length; i++)
|
||||||
{
|
{
|
||||||
if (ghostPositions[i] == tilemapIndex)
|
if (ghostPositions[i] != pacManPosition)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ghosts[i].HitPacMan()) // Only one collision may happen at a time
|
||||||
{
|
{
|
||||||
Debug.Log("PacMan hit ghost!");
|
Debug.Log("PacMan hit ghost!");
|
||||||
ghosts[i].HitPacMan();
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,6 +274,8 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
data.Append((byte)PelletCollectedCount, ref index);
|
data.Append((byte)PelletCollectedCount, ref index);
|
||||||
data.Append(syncedPelletsCollected, ref index);
|
data.Append(syncedPelletsCollected, ref index);
|
||||||
|
|
||||||
|
data.Append(frozen, ref index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
||||||
@@ -261,6 +289,8 @@ namespace Marro.PacManUdon
|
|||||||
Array.Copy(data, index, syncedPelletsCollected, 0, syncedPelletsCollected.Length);
|
Array.Copy(data, index, syncedPelletsCollected, 0, syncedPelletsCollected.Length);
|
||||||
index += syncedPelletsCollected.Length;
|
index += syncedPelletsCollected.Length;
|
||||||
SetPelletsCollectedFromSync();
|
SetPelletsCollectedFromSync();
|
||||||
|
|
||||||
|
frozen = data.ReadBool(ref index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,8 +136,6 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
//Debug.Log($"{gameObject} New level started!");
|
//Debug.Log($"{gameObject} New level started!");
|
||||||
|
|
||||||
collisionManager.RestoreAllPellets();
|
|
||||||
|
|
||||||
ghostManager.NewLevel();
|
ghostManager.NewLevel();
|
||||||
|
|
||||||
mazeSpriteAnimator.SetBool("Blinking", false);
|
mazeSpriteAnimator.SetBool("Blinking", false);
|
||||||
@@ -153,7 +151,7 @@ namespace Marro.PacManUdon
|
|||||||
pacMan.Reset();
|
pacMan.Reset();
|
||||||
bonusFruit.Despawn();
|
bonusFruit.Despawn();
|
||||||
soundManager.Reset();
|
soundManager.Reset();
|
||||||
collisionManager.SetPowerPelletsBlink(false);
|
collisionManager.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrepareForCutscene()
|
private void PrepareForCutscene()
|
||||||
@@ -391,11 +389,7 @@ namespace Marro.PacManUdon
|
|||||||
pacMan.SetFrozen(frozen);
|
pacMan.SetFrozen(frozen);
|
||||||
bonusFruit.SetFrozen(frozen);
|
bonusFruit.SetFrozen(frozen);
|
||||||
ghostManager.SetFrozen(frozen, ignoreIfCaught: ghostIgnoreIfCaught);
|
ghostManager.SetFrozen(frozen, ignoreIfCaught: ghostIgnoreIfCaught);
|
||||||
|
collisionManager.SetFrozen(frozen);
|
||||||
if (!frozen)
|
|
||||||
{
|
|
||||||
collisionManager.SetPowerPelletsBlink(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
||||||
|
|||||||
@@ -593,18 +593,23 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void HitPacMan()
|
internal bool HitPacMan()
|
||||||
{
|
{
|
||||||
|
if (ghostState != PacManGhostState.Normal)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isScared)
|
if (isScared)
|
||||||
{
|
{
|
||||||
Debug.Log($"{gameObject} was cought!");
|
Debug.Log($"{gameObject} was cought!");
|
||||||
ghostManager.GhostCaughtQueue(this);
|
ghostManager.GhostCaught(this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (ghostState == PacManGhostState.Normal)
|
|
||||||
{
|
|
||||||
Debug.Log($"{gameObject} cought PacMan!");
|
Debug.Log($"{gameObject} cought PacMan!");
|
||||||
ghostManager.CapturedPacMan();
|
ghostManager.CapturedPacMan();
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Caught(int scoreBonus)
|
public void Caught(int scoreBonus)
|
||||||
@@ -695,16 +700,20 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false)
|
public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false)
|
||||||
{
|
{
|
||||||
|
animator.speed = frozen && !keepAnimating ? 0 : 1; // This would cause issues if the returning sprite was animated, luckily it isn't :)
|
||||||
|
|
||||||
if (frozen && !ignoreIfCaught)
|
if (frozen && !ignoreIfCaught)
|
||||||
{
|
{
|
||||||
frozenState = PacManGhostFrozenState.Frozen;
|
frozenState = PacManGhostFrozenState.Frozen;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (frozen && ignoreIfCaught)
|
|
||||||
|
if (frozen && ignoreIfCaught)
|
||||||
{
|
{
|
||||||
frozenState = PacManGhostFrozenState.FrozenIfNotCaught;
|
frozenState = PacManGhostFrozenState.FrozenIfNotCaught;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var oldFrozenState = frozenState;
|
var oldFrozenState = frozenState;
|
||||||
frozenState = PacManGhostFrozenState.NotFrozen;
|
frozenState = PacManGhostFrozenState.NotFrozen;
|
||||||
|
|
||||||
@@ -712,8 +721,12 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
UpdateAnimator();
|
UpdateAnimator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ghostState == PacManGhostState.CaughtScore)
|
||||||
|
{
|
||||||
|
ReturnHome(); // Return home when unfreezing after being caught
|
||||||
|
collisionManager.PacManTryEatGhost(); // We may have skipped collisions while frozen
|
||||||
}
|
}
|
||||||
animator.speed = frozen && !keepAnimating ? 0 : 1; // This would cause issues if the returning sprite was animated, luckily it isn't :)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHousePelletCounterActive(bool active)
|
public void SetHousePelletCounterActive(bool active)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ MonoBehaviour:
|
|||||||
Data:
|
Data:
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 33
|
Data: 32
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data:
|
Data:
|
||||||
@@ -1081,64 +1081,10 @@ MonoBehaviour:
|
|||||||
Data:
|
Data:
|
||||||
- Name: $k
|
- Name: $k
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: ghostScaredQueue
|
Data: blinkingActivated
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
|
||||||
Entry: 1
|
|
||||||
Data: ghostScaredQueue
|
|
||||||
- Name: <UserType>k__BackingField
|
|
||||||
Entry: 7
|
|
||||||
Data: 55|System.RuntimeType, mscorlib
|
|
||||||
- Name:
|
|
||||||
Entry: 1
|
|
||||||
Data: VRC.SDK3.Data.DataList, VRCSDK3
|
|
||||||
- Name:
|
|
||||||
Entry: 8
|
|
||||||
Data:
|
|
||||||
- Name: <SystemType>k__BackingField
|
|
||||||
Entry: 9
|
|
||||||
Data: 55
|
|
||||||
- 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: 56|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: blinkingActivated
|
|
||||||
- Name: $v
|
|
||||||
Entry: 7
|
|
||||||
Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: blinkingActivated
|
Data: blinkingActivated
|
||||||
@@ -1162,7 +1108,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1186,7 +1132,7 @@ MonoBehaviour:
|
|||||||
Data: blinkCountdown
|
Data: blinkCountdown
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: blinkCountdown
|
Data: blinkCountdown
|
||||||
@@ -1210,7 +1156,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1234,7 +1180,7 @@ MonoBehaviour:
|
|||||||
Data: blinkCurrentlyWhite
|
Data: blinkCurrentlyWhite
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: blinkCurrentlyWhite
|
Data: blinkCurrentlyWhite
|
||||||
@@ -1258,7 +1204,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 62|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1282,7 +1228,7 @@ MonoBehaviour:
|
|||||||
Data: scatterCounter
|
Data: scatterCounter
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: scatterCounter
|
Data: scatterCounter
|
||||||
@@ -1306,7 +1252,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 64|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1330,7 +1276,7 @@ MonoBehaviour:
|
|||||||
Data: scatterPatternIndex
|
Data: scatterPatternIndex
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: scatterPatternIndex
|
Data: scatterPatternIndex
|
||||||
@@ -1354,7 +1300,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1378,7 +1324,7 @@ MonoBehaviour:
|
|||||||
Data: elroyLevel
|
Data: elroyLevel
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 67|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: elroyLevel
|
Data: elroyLevel
|
||||||
@@ -1402,7 +1348,7 @@ MonoBehaviour:
|
|||||||
Data: true
|
Data: true
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 68|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1426,7 +1372,7 @@ MonoBehaviour:
|
|||||||
Data: sharedPelletCounterActive
|
Data: sharedPelletCounterActive
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: sharedPelletCounterActive
|
Data: sharedPelletCounterActive
|
||||||
@@ -1450,7 +1396,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 70|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1474,7 +1420,7 @@ MonoBehaviour:
|
|||||||
Data: sharedPelletCounter
|
Data: sharedPelletCounter
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: sharedPelletCounter
|
Data: sharedPelletCounter
|
||||||
@@ -1496,6 +1442,60 @@ MonoBehaviour:
|
|||||||
- Name: <IsSerialized>k__BackingField
|
- Name: <IsSerialized>k__BackingField
|
||||||
Entry: 5
|
Entry: 5
|
||||||
Data: false
|
Data: false
|
||||||
|
- Name: _fieldAttributes
|
||||||
|
Entry: 7
|
||||||
|
Data: 69|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: sharedPelletCounterReleaseValues
|
||||||
|
- Name: $v
|
||||||
|
Entry: 7
|
||||||
|
Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
|
- Name: <Name>k__BackingField
|
||||||
|
Entry: 1
|
||||||
|
Data: sharedPelletCounterReleaseValues
|
||||||
|
- Name: <UserType>k__BackingField
|
||||||
|
Entry: 7
|
||||||
|
Data: 71|System.RuntimeType, mscorlib
|
||||||
|
- Name:
|
||||||
|
Entry: 1
|
||||||
|
Data: System.Int32[], mscorlib
|
||||||
|
- Name:
|
||||||
|
Entry: 8
|
||||||
|
Data:
|
||||||
|
- Name: <SystemType>k__BackingField
|
||||||
|
Entry: 9
|
||||||
|
Data: 71
|
||||||
|
- 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
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
@@ -1519,64 +1519,10 @@ MonoBehaviour:
|
|||||||
Data:
|
Data:
|
||||||
- Name: $k
|
- Name: $k
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: sharedPelletCounterReleaseValues
|
Data: pelletTimeout
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
|
||||||
Entry: 1
|
|
||||||
Data: sharedPelletCounterReleaseValues
|
|
||||||
- Name: <UserType>k__BackingField
|
|
||||||
Entry: 7
|
|
||||||
Data: 74|System.RuntimeType, mscorlib
|
|
||||||
- Name:
|
|
||||||
Entry: 1
|
|
||||||
Data: System.Int32[], mscorlib
|
|
||||||
- Name:
|
|
||||||
Entry: 8
|
|
||||||
Data:
|
|
||||||
- Name: <SystemType>k__BackingField
|
|
||||||
Entry: 9
|
|
||||||
Data: 74
|
|
||||||
- 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: 75|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: pelletTimeout
|
|
||||||
- Name: $v
|
|
||||||
Entry: 7
|
|
||||||
Data: 76|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: pelletTimeout
|
Data: pelletTimeout
|
||||||
@@ -1600,7 +1546,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1624,7 +1570,7 @@ MonoBehaviour:
|
|||||||
Data: frozen
|
Data: frozen
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 78|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: frozen
|
Data: frozen
|
||||||
@@ -1648,7 +1594,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 79|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 76|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
@@ -1672,7 +1618,7 @@ MonoBehaviour:
|
|||||||
Data: kinematic
|
Data: kinematic
|
||||||
- Name: $v
|
- Name: $v
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 80|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
Data: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||||
- Name: <Name>k__BackingField
|
- Name: <Name>k__BackingField
|
||||||
Entry: 1
|
Entry: 1
|
||||||
Data: kinematic
|
Data: kinematic
|
||||||
@@ -1696,7 +1642,7 @@ MonoBehaviour:
|
|||||||
Data: false
|
Data: false
|
||||||
- Name: _fieldAttributes
|
- Name: _fieldAttributes
|
||||||
Entry: 7
|
Entry: 7
|
||||||
Data: 81|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
Data: 78|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||||
- Name:
|
- Name:
|
||||||
Entry: 12
|
Entry: 12
|
||||||
Data: 0
|
Data: 0
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ namespace Marro.PacManUdon
|
|||||||
private float powerPelletCountdown;
|
private float powerPelletCountdown;
|
||||||
private int powerPelletMultiplier;
|
private int powerPelletMultiplier;
|
||||||
|
|
||||||
private DataList ghostScaredQueue;
|
|
||||||
|
|
||||||
// Blink logic
|
// Blink logic
|
||||||
private const float blinkCycleRate = 0.233333333f;
|
private const float blinkCycleRate = 0.233333333f;
|
||||||
private bool blinkingActivated;
|
private bool blinkingActivated;
|
||||||
@@ -80,7 +78,6 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
public void RestartLevel(bool afterLifeLost = false)
|
public void RestartLevel(bool afterLifeLost = false)
|
||||||
{
|
{
|
||||||
ghostScaredQueue = new DataList();
|
|
||||||
powerPelletActive = false;
|
powerPelletActive = false;
|
||||||
scatterCounter = 0;
|
scatterCounter = 0;
|
||||||
scatterPatternIndex = 0;
|
scatterPatternIndex = 0;
|
||||||
@@ -186,7 +183,7 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GhostCaughtQueue(Ghost ghost)
|
public void GhostCaught(Ghost ghost)
|
||||||
{
|
{
|
||||||
if (gameController.GameState == PacManGameState.AttractMode)
|
if (gameController.GameState == PacManGameState.AttractMode)
|
||||||
{
|
{
|
||||||
@@ -194,34 +191,6 @@ namespace Marro.PacManUdon
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
|
|
||||||
//networkManager.SendEventSoon(NetworkEventType.TimeSequenceSync);
|
|
||||||
//networkManager.SendEventSoon(NetworkEventType.GhostUpdate);
|
|
||||||
|
|
||||||
ghostScaredQueue.Add(ghost);
|
|
||||||
GhostCaughtExecute(ghost);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GhostCaughtContinue()
|
|
||||||
{
|
|
||||||
// Debug.Log($"{gameObject} GhostCaughtContinue with ghost queue length {ghostScaredQueue.Count}");
|
|
||||||
if (!ghostScaredQueue.TryGetValue(0, out DataToken currentGhost))
|
|
||||||
{
|
|
||||||
Debug.LogError("Called GhostCaughtContinue without a ghost in the queue!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
((Ghost)currentGhost.Reference).ReturnHome();
|
|
||||||
ghostScaredQueue.RemoveAt(0);
|
|
||||||
|
|
||||||
if (ghostScaredQueue.TryGetValue(0, out DataToken nextGhost))
|
|
||||||
{
|
|
||||||
GhostCaughtExecute((Ghost)nextGhost.Reference);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GhostCaughtExecute(Ghost ghost)
|
|
||||||
{
|
|
||||||
int scoreBonus = 200 * (int)Math.Pow(2, powerPelletMultiplier);
|
int scoreBonus = 200 * (int)Math.Pow(2, powerPelletMultiplier);
|
||||||
powerPelletMultiplier += 1;
|
powerPelletMultiplier += 1;
|
||||||
ghost.Caught(scoreBonus);
|
ghost.Caught(scoreBonus);
|
||||||
@@ -518,20 +487,6 @@ namespace Marro.PacManUdon
|
|||||||
data.Append(kinematic, ref index);
|
data.Append(kinematic, ref index);
|
||||||
|
|
||||||
data.AppendAsByte(gameController.Level, ref index);
|
data.AppendAsByte(gameController.Level, ref index);
|
||||||
|
|
||||||
var ghostScaredQueueArray = new byte[ghosts.Length];
|
|
||||||
for (int i = 0; i < ghostScaredQueueArray.Length; i++)
|
|
||||||
{
|
|
||||||
var add = ghostScaredQueue.TryGetValue(i, out var ghost);
|
|
||||||
if (!add)
|
|
||||||
{
|
|
||||||
ghostScaredQueueArray[i] = byte.MaxValue; // Add a terminator
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ghostScaredQueueArray[i] = (byte)((Ghost)ghost.Reference).Index;
|
|
||||||
}
|
|
||||||
//Debug.Log($"{gameObject} Sent a ghostScareQueue of length {ghostScaredQueue.Count}");
|
|
||||||
data.Append(ghostScaredQueueArray, ref index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
||||||
@@ -569,19 +524,6 @@ namespace Marro.PacManUdon
|
|||||||
var level = data.ReadByte(ref index);
|
var level = data.ReadByte(ref index);
|
||||||
SetLevelConstants(level);
|
SetLevelConstants(level);
|
||||||
|
|
||||||
ghostScaredQueue.Clear();
|
|
||||||
for (int i = 0; i < ghosts.Length; i++)
|
|
||||||
{
|
|
||||||
var ghostIndex = data[index + i];
|
|
||||||
if (ghostIndex > ghosts.Length) // Reached terminator
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ghostScaredQueue.Add(ghosts[ghostIndex]);
|
|
||||||
}
|
|
||||||
index += ghosts.Length;
|
|
||||||
//Debug.Log($"{gameObject} Read back a ghostScareQueue of length {ghostScaredQueue.Count}");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
if (!IsOwner)
|
if (!IsOwner)
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Attempted {nameof(SendEventSoon)} while not the owner!");
|
//Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Attempted {nameof(SendEventSoon)} while not the owner!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -323,7 +323,6 @@ namespace Marro.PacManUdon
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
SetPelletsActive(true);
|
SetPelletsActive(true);
|
||||||
collisionManager.RestoreAllPellets();
|
|
||||||
statusDisplay.SetGameOverTextVisible(true);
|
statusDisplay.SetGameOverTextVisible(true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
// Unfreeze and reveal pacman
|
// Unfreeze and reveal pacman
|
||||||
SetPacManActive(true);
|
SetPacManActive(true);
|
||||||
SetFrozen(false);
|
SetFrozen(false); // This also makes the caught ghost return home
|
||||||
ghostManager.GhostCaughtContinue();
|
|
||||||
soundManager.SetGhostRetreat(true);
|
soundManager.SetGhostRetreat(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user