Cleaning a bit
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
namespace Marro.PacManUdon
|
using UdonSharp;
|
||||||
{
|
|
||||||
using UdonSharp;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDK3.Data;
|
using VRC.SDK3.Data;
|
||||||
using VRC.SDKBase;
|
|
||||||
using VRC.Udon;
|
|
||||||
|
|
||||||
|
namespace Marro.PacManUdon
|
||||||
|
{
|
||||||
|
[RequireComponent(typeof(Animator))]
|
||||||
|
[RequireComponent(typeof(Renderer))]
|
||||||
|
[RequireComponent(typeof(Collider))]
|
||||||
public class BonusFruit : UdonSharpBehaviour
|
public class BonusFruit : UdonSharpBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField, UdonSynced, FieldChangeCallback(nameof(FruitType))] PacManFruitType fruitType;
|
PacManFruitType fruitType;
|
||||||
|
|
||||||
Animator animator;
|
Animator animator;
|
||||||
new Renderer renderer;
|
new Renderer renderer;
|
||||||
@@ -67,7 +68,6 @@
|
|||||||
this.fruitType = fruitType;
|
this.fruitType = fruitType;
|
||||||
value = (int)fruitScoreValue[PacManConstants.FruitTypeToValue(fruitType)];
|
value = (int)fruitScoreValue[PacManConstants.FruitTypeToValue(fruitType)];
|
||||||
animator.SetFloat("FruitType", PacManConstants.FruitTypeToValue(fruitType));
|
animator.SetFloat("FruitType", PacManConstants.FruitTypeToValue(fruitType));
|
||||||
RequestSerialization();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFrozen(bool frozen)
|
public void SetFrozen(bool frozen)
|
||||||
@@ -80,7 +80,6 @@
|
|||||||
renderer.enabled = active;
|
renderer.enabled = active;
|
||||||
collider.enabled = active;
|
collider.enabled = active;
|
||||||
this.active = active;
|
this.active = active;
|
||||||
RequestSerialization();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacManFruitType FruitType
|
public PacManFruitType FruitType
|
||||||
@@ -101,7 +100,7 @@
|
|||||||
get => active;
|
get => active;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataDictionary fruitScoreValue = new DataDictionary()
|
private readonly DataDictionary fruitScoreValue = new DataDictionary()
|
||||||
{
|
{
|
||||||
{(int)PacManFruitType.None , 0},
|
{(int)PacManFruitType.None , 0},
|
||||||
{(int)PacManFruitType.Cherries , 100},
|
{(int)PacManFruitType.Cherries , 100},
|
||||||
@@ -113,6 +112,5 @@
|
|||||||
{(int)PacManFruitType.Bell , 3000},
|
{(int)PacManFruitType.Bell , 3000},
|
||||||
{(int)PacManFruitType.Key , 5000}
|
{(int)PacManFruitType.Key , 5000}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,10 +315,6 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
// Debug.Log($"{gameObject} State transitioning from {gameState} to {newGameState}");
|
// Debug.Log($"{gameObject} State transitioning from {gameState} to {newGameState}");
|
||||||
gameState = newGameState;
|
gameState = newGameState;
|
||||||
if (Networking.IsOwner(gameObject))
|
|
||||||
{
|
|
||||||
RequestSerialization();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IncrementLevel()
|
private void IncrementLevel()
|
||||||
@@ -348,7 +344,6 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetScore(this.score + score);
|
SetScore(this.score + score);
|
||||||
RequestSerialization();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetScore(int score)
|
void SetScore(int score)
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ namespace Marro.PacManUdon
|
|||||||
|
|
||||||
faceInStartingDirectionUntilUnfrozen = true;
|
faceInStartingDirectionUntilUnfrozen = true;
|
||||||
UpdateAnimator();
|
UpdateAnimator();
|
||||||
RequestSerialization();
|
|
||||||
|
|
||||||
// Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}");
|
// Debug.Log($"{gameObject} reset with state: {state}, target: {target}, offGrid: {offGrid}");
|
||||||
}
|
}
|
||||||
@@ -666,7 +665,6 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
this.scattering = scattering;
|
this.scattering = scattering;
|
||||||
UpdateAnimator();
|
UpdateAnimator();
|
||||||
RequestSerialization();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false)
|
public void SetFrozen(bool frozen, bool ignoreIfCaught = false, bool keepAnimating = false)
|
||||||
|
|||||||
@@ -92,7 +92,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetScattering(true, reverseDirection: false);
|
SetScattering(true, reverseDirection: false);
|
||||||
RequestSerialization();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NewLevel()
|
public void NewLevel()
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
namespace Marro.PacManUdon
|
using System;
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using UdonSharp;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDKBase;
|
|
||||||
using VRC.Udon;
|
|
||||||
using VRC.SDK3.Components;
|
using VRC.SDK3.Components;
|
||||||
|
using VRC.SDKBase;
|
||||||
|
|
||||||
|
namespace Marro.PacManUdon
|
||||||
|
{
|
||||||
|
[RequireComponent(typeof(Animator))]
|
||||||
|
[RequireComponent(typeof(Renderer))]
|
||||||
public class PacMan : GridMover
|
public class PacMan : GridMover
|
||||||
{
|
{
|
||||||
private GameManager gameController;
|
private GameManager gameController;
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
private Vector2[] predefinedPath;
|
private Vector2[] predefinedPath;
|
||||||
private int predefinedPathIndex;
|
private int predefinedPathIndex;
|
||||||
|
|
||||||
private Vector2 syncedPosition;
|
|
||||||
private Vector2 targetDirection;
|
private Vector2 targetDirection;
|
||||||
private float freezeSeconds;
|
private float freezeSeconds;
|
||||||
private bool frozen;
|
private bool frozen;
|
||||||
@@ -62,8 +61,7 @@
|
|||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
// Debug.Log($"{gameObject} Reset!");
|
// Debug.Log($"{gameObject} Reset!");
|
||||||
transform.localPosition = startPosition;
|
transform.SetLocalPositionAndRotation(startPosition, startRotation);
|
||||||
transform.localRotation = startRotation;
|
|
||||||
transform.localScale = startScale;
|
transform.localScale = startScale;
|
||||||
direction = Vector2.left;
|
direction = Vector2.left;
|
||||||
targetDirection = Vector2.left;
|
targetDirection = Vector2.left;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Marro.PacManUdon
|
|||||||
bool waitingForTimeSequenceFinalize;
|
bool waitingForTimeSequenceFinalize;
|
||||||
bool jumpingToTimeSequence;
|
bool jumpingToTimeSequence;
|
||||||
PacManTimeSequence currentTimeSequence;
|
PacManTimeSequence currentTimeSequence;
|
||||||
[UdonSynced] float timeSequenceSecondsPassed;
|
float timeSequenceSecondsPassed;
|
||||||
int timeSequenceProgress;
|
int timeSequenceProgress;
|
||||||
float[] timeSequenceKeyframeTimes;
|
float[] timeSequenceKeyframeTimes;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user