Intermission 2
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user