Simplified ghost starting direction logic
This commit is contained in:
@@ -76,7 +76,6 @@ namespace Marro.PacManUdon
|
||||
private int housePelletCounter;
|
||||
private bool housePelletCounterActive;
|
||||
private int housePelletCounterLimit;
|
||||
private bool faceInStartingDirectionUntilUnfrozen;
|
||||
|
||||
// Cutscene
|
||||
private bool kinematic;
|
||||
@@ -133,6 +132,11 @@ namespace Marro.PacManUdon
|
||||
if (startState == PacManGhostStartState.TargetingIdlePosition1)
|
||||
{
|
||||
SetOffGridTarget(idlePosition1, false);
|
||||
SetTargetDirection(Direction.Up);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTargetDirection(Direction.Down);
|
||||
}
|
||||
ghostState = PacManGhostState.Entering;
|
||||
OffGridTargetReached();
|
||||
@@ -148,7 +152,6 @@ namespace Marro.PacManUdon
|
||||
rngState = 1;
|
||||
UpdateSpeed();
|
||||
|
||||
faceInStartingDirectionUntilUnfrozen = true;
|
||||
UpdateAnimator();
|
||||
|
||||
// Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}");
|
||||
@@ -519,15 +522,7 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
}
|
||||
|
||||
if (faceInStartingDirectionUntilUnfrozen && startState == PacManGhostStartState.TargetingIdlePosition1)
|
||||
{
|
||||
SetAnimatorDirection((int)Direction.Up);
|
||||
}
|
||||
else if (faceInStartingDirectionUntilUnfrozen && startState == PacManGhostStartState.TargetingIdlePosition2)
|
||||
{
|
||||
SetAnimatorDirection((int)Direction.Down);
|
||||
}
|
||||
else if (specialLook || targetDirection != Direction.Zero)
|
||||
if (specialLook || targetDirection != Direction.Zero)
|
||||
{
|
||||
SetAnimatorDirection((int)targetDirection);
|
||||
}
|
||||
@@ -680,12 +675,6 @@ namespace Marro.PacManUdon
|
||||
frozenState = PacManGhostFrozenState.NotFrozen;
|
||||
}
|
||||
animator.speed = frozen && !keepAnimating ? 0 : 1; // This would cause issues if the returning sprite was animated, luckily it isn't :)
|
||||
|
||||
if (frozen == false && faceInStartingDirectionUntilUnfrozen)
|
||||
{
|
||||
faceInStartingDirectionUntilUnfrozen = false;
|
||||
UpdateAnimator();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetHousePelletCounterActive(bool active)
|
||||
@@ -789,7 +778,6 @@ namespace Marro.PacManUdon
|
||||
data.AppendAsByte(housePelletCounter, ref index);
|
||||
data.Append(housePelletCounterActive, ref index);
|
||||
data.AppendAsByte(housePelletCounterLimit, ref index);
|
||||
data.Append(faceInStartingDirectionUntilUnfrozen, ref index);
|
||||
|
||||
base.CollectSyncedData(data, ref index, eventType);
|
||||
}
|
||||
@@ -817,7 +805,6 @@ namespace Marro.PacManUdon
|
||||
housePelletCounter = data.ReadByte(ref index);
|
||||
housePelletCounterActive = data.ReadBool(ref index);
|
||||
housePelletCounterLimit = data.ReadByte(ref index);
|
||||
faceInStartingDirectionUntilUnfrozen = data.ReadBool(ref index);
|
||||
|
||||
return base.WriteSyncedData(data, ref index, eventType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user