- Replaced one skee-ball machine with two arcade machines.

- Added Black Horse And The Cherry Tree by KT Tunstall to the horse playlist.
- Added Buckin' My Horse by Sir Mix-A-Lot to the horse playlist.
This commit is contained in:
2026-02-11 02:58:41 -05:00
parent a7bcc5f056
commit 542e04afed
352 changed files with 45502 additions and 4988 deletions
@@ -0,0 +1,53 @@
%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: Controllable
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 3bc7de0704bb76147938d8bf414bfa94,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 41e733f1ee3aa8942bbe5f75c5b750fe, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 2152247940940176816
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: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e5a49a14e51a3b4a998426cc4392d55
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace myro.arcade
{
public class Controllable : UdonSharpBehaviour
{
void Start()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41e733f1ee3aa8942bbe5f75c5b750fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,383 @@
%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: HeliCaveGameSettings
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: f510386991419ac498c00512054576ed,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 4f06ef35002d2714da4a1b2df97d4aff, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 1
hasInteractEvent: 0
scriptID: -1372396491425811685
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: 6
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: RenderTextureToUse
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: RenderTextureToUse
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.RenderTexture, UnityEngine.CoreModule
- 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: true
- 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: ScreenShaderEmissionPropertyName
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ScreenShaderEmissionPropertyName
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 6
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 7|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: SharedScoreboardPrefab
- Name: $v
Entry: 7
Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: SharedScoreboardPrefab
- Name: <UserType>k__BackingField
Entry: 7
Data: 9|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: myro.arcade.SharedScoreboard, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 10|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: true
- 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: Music
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: Music
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.AudioClip, UnityEngine.AudioModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 13
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 14|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: GameDuration
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: GameDuration
- Name: <UserType>k__BackingField
Entry: 7
Data: 16|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 17|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: NumberWalls
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: NumberWalls
- Name: <UserType>k__BackingField
Entry: 9
Data: 16
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 20|UnityEngine.HideInInspector, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 62e2088b900862449a223feaa2ea37e9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace myro.arcade
{
public class HeliCaveGameSettings : GameSettings
{
public int GameDuration = 120;
[HideInInspector]
public int NumberWalls = 15; //currently hidden, because a different number can cause some issues
void Start()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f06ef35002d2714da4a1b2df97d4aff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3d80acb6ac7e63245b2bb47a6bedd433
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,662 @@
using TMPro;
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
namespace myro.arcade
{
public enum GameState
{
START_SCREEN,
EXPLANATIONS,
PLAY,
PAUSE,
FINISH
}
public class MainGame : UdonSharpBehaviour
{
public HeliCaveGameSettings GameSettingsInstance;
//Basically the boundaries of the game, used to determine where stuff needs to be spawned
public Transform TopBoundary;
public Transform BottomBoundary;
public Transform RightBoundary;
public Transform LeftBoundary;
public Transform PawnDefaultPosition;
//Each canvas used in-game
public GameObject CanvasPressStart;
public GameObject CanvasExplanation;
public GameObject CanvasTimer;
public GameObject CanvasFinalScore;
public GameObject CanvasPauseScreen;
public GameObject CanvasScoreboard;
//Prefabs that get spawned
public GameObject PrefabWall;
private Vector3 _boundingBoxPrefabWall;
public GameObject PrefabControllable;
public TextMeshProUGUI ProgressTxt;
public TextMeshProUGUI ScoreTxt;
public TextMeshProUGUI FinalScoreTxt;
public TextMeshProUGUI TimerTxt;
//SFX
public AudioClip ClipExplosion;
public AudioClip ClipJump;
public AudioClip ClipSelection;
public AudioSource SoundEffectSource;
public AudioSource SoundEffectHelicopter;
public AudioSource Music;
public GameObject SpawnedWallsWrapper;
private GameObject[] _spawnedWallsBottom;
private GameObject[] _spawnedWallsTop;
private GameObject _spawnedControllable;
[UdonSynced]
private GameState _gameState;
private GameState _gameStateSaved;
[UdonSynced]
private int _seed;
private int _seedSaved;
private int _currentSeed;
[UdonSynced]
private double _startGameTime;
[UdonSynced]
private double _startRoundTime;
[UdonSynced]
private Vector3 _positionPlayer;
[UdonSynced]
private float _currentScore;
private bool _gameStarted;
private double _timePlayed;
private float _distanceBetweenEachWall;
private float _currentTraveledDistanceByWall;
private int _indexLastWall;
private float _currentDistanceBetweenTopAndBottomWall;
private float _currentMiddleWallPosition;
private float _currentTime;
private int _currentFrameSinceNewGame;
private bool _buttonPressed;
private bool _gameCanBeStarted;
private float _currentUpSpeed;
private bool _inputBlocked;
void Start()
{
SpawnWalls();
SpawnPawn();
ResetGame();
}
private void ShowCanvas(GameObject canvasToShow)
{
CanvasPressStart.SetActive(false);
CanvasExplanation.SetActive(false);
CanvasTimer.SetActive(false);
CanvasFinalScore.SetActive(false);
CanvasPauseScreen.SetActive(false);
if (canvasToShow != null)
{
canvasToShow.SetActive(true);
}
}
private void SpawnWalls()
{
_spawnedWallsBottom = new GameObject[GameSettingsInstance.NumberWalls];
_spawnedWallsTop = new GameObject[GameSettingsInstance.NumberWalls];
float direction = (RightBoundary.localPosition - LeftBoundary.localPosition).x;
_distanceBetweenEachWall = direction / (GameSettingsInstance.NumberWalls - 1);
for (int i = 0; i < GameSettingsInstance.NumberWalls; i++)
{
GameObject objBottom = SpawnWall();
GameObject objTop = SpawnWall();
_spawnedWallsBottom[GameSettingsInstance.NumberWalls - i - 1] = objBottom;
_spawnedWallsTop[GameSettingsInstance.NumberWalls - i - 1] = objTop;
//objBottom.transform.localRotation = new Quaternion(0, 0, 180, 0);
}
}
public void PlayerPickedUpJoystick()
{
if (_gameState == GameState.PAUSE && IsLocalPlayerPlaying())
{
_gameState = GameState.PLAY;
SetNewRoundTimer();
RequestSerialization();
HandleOnDeserialization();
}
else
{
Networking.SetOwner(Networking.LocalPlayer, gameObject);
PrepareResetGame();
}
}
private void SpawnPawn()
{
_spawnedControllable = Instantiate(PrefabControllable);
_spawnedControllable.transform.parent = gameObject.transform;
_spawnedControllable.transform.localScale = new Vector3(1, 1, 1);
}
private void PositionWall(GameObject wall, float positionX, bool shouldScaleToTop)
{
if (wall == null)
return;
float positionY = _currentDistanceBetweenTopAndBottomWall * (shouldScaleToTop ? 1 : -1) + _currentMiddleWallPosition;
wall.transform.localPosition = new Vector3(0, positionY, 0);
MoveWall(wall, positionX, shouldScaleToTop);
}
private void MoveWall(GameObject wall, float directionX, bool shouldScaleToTop)
{
if (wall == null)
return;
float positionY = wall.transform.localPosition.y;
float requiredWidth = (RightBoundary.localPosition - LeftBoundary.localPosition).x / (GameSettingsInstance.NumberWalls - 1);
float requiredHeight = shouldScaleToTop
? TopBoundary.localPosition.y - positionY
: positionY - BottomBoundary.localPosition.y;
Vector3 newPosition = new Vector3(wall.transform.localPosition.x, positionY, 0);
newPosition += new Vector3(directionX, 0, 0);
wall.transform.localRotation = new Quaternion(0, 0, shouldScaleToTop ? 0 : 180, 0);
wall.transform.localScale = new Vector3(requiredWidth / _boundingBoxPrefabWall.x, requiredHeight / _boundingBoxPrefabWall.y, 1);
wall.transform.localPosition = newPosition;
//TODO adapt position and scaling on x axis so there's no "bleeding"
}
private GameObject SpawnWall()
{
GameObject obj = Instantiate(PrefabWall);
Wall wall = obj.GetComponent<Wall>();
if (wall)
{
wall.MainGameInstance = this;
}
obj.transform.parent = SpawnedWallsWrapper.transform;
if (_boundingBoxPrefabWall == Vector3.zero)
{
_boundingBoxPrefabWall = obj.GetComponent<MeshRenderer>().bounds.size;
}
return obj;
}
private void ResetWallTransforms()
{
SetDistanceTopAndBottomWall(1);
for (int i = 0; i < GameSettingsInstance.NumberWalls; i++)
{
GameObject wallBottom = _spawnedWallsBottom[GameSettingsInstance.NumberWalls - i - 1];
GameObject wallTop = _spawnedWallsTop[GameSettingsInstance.NumberWalls - i - 1];
PositionWall(wallBottom , RightBoundary.transform.localPosition.x - _distanceBetweenEachWall * i, false);
PositionWall(wallTop , RightBoundary.transform.localPosition.x - _distanceBetweenEachWall * i, true);
}
}
private void SetDistanceTopAndBottomWall(float heightPercentage)
{
_currentDistanceBetweenTopAndBottomWall = 0.5f + heightPercentage * (TopBoundary.localPosition - BottomBoundary.localPosition).y / 5f;
}
public override void OnDeserialization()
{
HandleOnDeserialization();
}
private void HandleOnDeserialization()
{
if (!_isPlayerInArea)
return;
CanvasScoreboard.SetActive(_gameState == GameState.START_SCREEN
|| _gameState == GameState.PAUSE
|| _gameState == GameState.FINISH);
if (_gameState == GameState.START_SCREEN)
{
ResetGame();
if (_gameStateSaved != _gameState)
{
PlaySelectSound();
}
}
else if (_gameState == GameState.EXPLANATIONS)
{
ShowCanvas(CanvasExplanation);
PlaySelectSound();
}
else if (_gameState == GameState.PLAY)
{
if (_gameStateSaved != _gameState)
{
PlaySelectSound();
PlayMusic(true);
ShowCanvas(CanvasTimer);
}
if (_seed != _seedSaved)
{
_currentSeed = _seed;
_seedSaved = _seed;
}
if (Networking.GetServerTimeInSeconds() < _startRoundTime && _gameStateSaved != GameState.PAUSE)
{
InitNextRoundValues();
}
}
else if (_gameState == GameState.PAUSE && _gameStateSaved != _gameState)
{
ShowCanvas(CanvasPauseScreen);
PlaySelectSound();
PlayMusic(false);
SoundEffectHelicopter.gameObject.SetActive(false);
_gameStarted = false;
}
else if (_gameState == GameState.FINISH)
{
PlayMusic(false);
ShowCanvas(CanvasFinalScore);
FinalScoreTxt.text = ((long) _currentScore).ToString();
InitNextRoundValues();
if (GameSettingsInstance.SharedScoreboardPrefab)
GameSettingsInstance.SharedScoreboardPrefab.Insert(Networking.LocalPlayer, (long) _currentScore);
}
_gameStateSaved = _gameState;
}
public void ResetIfOwner()
{
if (IsLocalPlayerPlaying())
{
PrepareResetGame();
}
}
private void ResetGame()
{
InitNextRoundValues();
ShowCanvas(CanvasPressStart);
_timePlayed = 0;
_currentScore = 0;
_startRoundTime = 0;
Music.gameObject.SetActive(false);
_inputBlocked = false;
}
/// <summary>
/// Reset values between each round, doesn't fully reset the game
/// </summary>
private void InitNextRoundValues()
{
_currentMiddleWallPosition = RightBoundary.transform.localPosition.y;
ResetWallTransforms();
_buttonPressed = false;
_currentTraveledDistanceByWall = _distanceBetweenEachWall / 2;
_indexLastWall = GameSettingsInstance.NumberWalls - 1;
_currentUpSpeed = 0;
_spawnedControllable.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
_spawnedControllable.transform.localPosition = PawnDefaultPosition.localPosition;
_gameStarted = false;
SoundEffectHelicopter.gameObject.SetActive(false);
}
public void PrepareResetGame()
{
_gameState = 0;
RequestSerialization();
HandleOnDeserialization();
}
public void PlayerDroppedJoystick()
{
if (_gameState == GameState.PLAY)
{
_gameState = GameState.PAUSE;
}
else
{
PrepareResetGame();
}
RequestSerialization();
HandleOnDeserialization();
}
private int GetNextSeed()
{
return Random.Range((int)0, (int)0xFFFFFF);
}
public void OnPress()
{
if (_inputBlocked)
{
return;
}
switch (_gameState)
{
case GameState.PLAY:
{
_buttonPressed = true;
break;
}
default:
{
if (_gameState == GameState.START_SCREEN)
{
_gameState = GameState.EXPLANATIONS;
}
else if (_gameState == GameState.EXPLANATIONS)
{
_gameState = GameState.PLAY;
}
if (_gameState == GameState.PLAY)
{
InitNewRound();
_startGameTime = _startRoundTime;
}
else if (_gameState == GameState.FINISH)
{
_gameState = GameState.START_SCREEN;
}
RequestSerialization();
HandleOnDeserialization();
break;
}
};
}
bool _isPlayerInArea;
public void OnPlayerEnteredArea()
{
_isPlayerInArea = true;
}
public void OnPlayerExitedArea()
{
_isPlayerInArea = false;
}
public void SyncPlayer()
{
if (_gameState == GameState.PLAY && _gameStarted)
{
_positionPlayer = _spawnedControllable.transform.localPosition;
RequestSerialization();
SendCustomEventDelayedSeconds(nameof(SyncPlayer), 0.2f);
}
}
private void InitNewRound()
{
SetNewRoundTimer();
while (_seed == _seedSaved)
{
_seed = GetNextSeed();
}
RequestSerialization();
HandleOnDeserialization();
}
private void SetNewRoundTimer()
{
_startRoundTime = Networking.GetServerTimeInSeconds() + 4.0f;
}
public void OnRelease()
{
_buttonPressed = false;
}
private int GetIndexFirstWall()
{
return _indexLastWall + 1 >= GameSettingsInstance.NumberWalls ? 0 : _indexLastWall + 1;
}
private void UpdateMiddleBonePosition()
{
if (_gameStarted)
{
//Random.State previousState = Random.state; //Uncomment once it's exposed to Udon
Random.InitState(_currentSeed);
float newDirection = Random.Range(-0.7f, 0.7f);
_currentMiddleWallPosition += newDirection;
if (_currentMiddleWallPosition + _currentDistanceBetweenTopAndBottomWall > TopBoundary.localPosition.y || _currentMiddleWallPosition - _currentDistanceBetweenTopAndBottomWall < BottomBoundary.localPosition.y)
{
_currentMiddleWallPosition -= 2 * newDirection;
}
_currentSeed = GetNextSeed();
//Random.state = previousState; //Uncomment once it's exposed to Udon
}
}
private bool IsLocalPlayerPlaying()
{
return Networking.IsOwner(gameObject);
}
private void UpdateIngameUI()
{
if (_gameState == GameState.PLAY)
{
if (!_gameStarted)
{
if (Networking.GetServerTimeInSeconds() > _startRoundTime)
{
TimerTxt.text = "";
}
else
{
long remainingTime = (long)(_startRoundTime - Networking.GetServerTimeInSeconds());
TimerTxt.text = remainingTime == 0 ? "GO!" : remainingTime.ToString();
}
}
if (GameSettingsInstance.GameDuration != 0)
{
ProgressTxt.text = $"Progress : {(long)(_timePlayed * 100.0f / GameSettingsInstance.GameDuration)}%";
}
ScoreTxt.text = ((long)_currentScore).ToString("D14");
}
}
private void Update()
{
if (_gameState != GameState.PLAY || !_isPlayerInArea)
{
return;
}
UpdateIngameUI();
if (!_gameStarted && Networking.GetServerTimeInSeconds() > _startRoundTime)
{
_gameStarted = true;
if (IsLocalPlayerPlaying())
{
SyncPlayer();
}
SoundEffectHelicopter.gameObject.SetActive(true);
}
if (!_gameStarted)
{
return;
}
//calculating score, progress and broadness of the cave
_timePlayed += Time.deltaTime;
SetDistanceTopAndBottomWall(1.0f - (float)(Networking.GetServerTimeInSeconds() - _startRoundTime) / GameSettingsInstance.GameDuration);
if (IsLocalPlayerPlaying())
{
_currentScore += (float)(Networking.GetServerTimeInMilliseconds() / 1000.0f - _startRoundTime);
//Check if the game is finished
if (_timePlayed > GameSettingsInstance.GameDuration)
{
_gameState = GameState.FINISH;
_inputBlocked = true;
SendCustomEventDelayedSeconds(nameof(UnlockControls), 2.0f);
RequestSerialization();
HandleOnDeserialization();
}
//Applying forces to the helicopter
_spawnedControllable.transform.localPosition += new Vector3(0, _currentUpSpeed, 0);
if (_buttonPressed)
{
_currentUpSpeed += Time.deltaTime / 16.0f;
}
else
{
_currentUpSpeed -= Time.deltaTime / 16.0f;
}
SoundEffectHelicopter.pitch = Mathf.Clamp((_currentUpSpeed + 1) + _currentUpSpeed * 20, 0.2f, 1.8f);
}
else
{
_spawnedControllable.transform.localPosition = _positionPlayer;
}
//Moving the walls
float direction = -Time.deltaTime;
int startPosition = GetIndexFirstWall();
for (int i = 0; i < GameSettingsInstance.NumberWalls; i++)
{
int indexToUse = i + startPosition >= GameSettingsInstance.NumberWalls ? (i + startPosition) - GameSettingsInstance.NumberWalls : i + startPosition;
GameObject objBottom = _spawnedWallsBottom[indexToUse];
GameObject objTop = _spawnedWallsTop[indexToUse];
MoveWall(objBottom, direction, false);
MoveWall(objTop, direction, true);
}
_currentTraveledDistanceByWall += -direction;
MoveFirstWallToLast();
}
private void MoveFirstWallToLast()
{
while (_currentTraveledDistanceByWall >= _distanceBetweenEachWall)
{
UpdateMiddleBonePosition();
int indexFirstWall = GetIndexFirstWall();
//First wall will be placed behing last wall
PositionWall(_spawnedWallsBottom[indexFirstWall], _spawnedWallsBottom[_indexLastWall].transform.localPosition.x + _distanceBetweenEachWall, false);
PositionWall(_spawnedWallsTop[indexFirstWall], _spawnedWallsTop[_indexLastWall].transform.localPosition.x + _distanceBetweenEachWall, true);
_currentTraveledDistanceByWall -= _distanceBetweenEachWall;
//start and end position has changed, so we move them
_indexLastWall++;
if (_indexLastWall >= GameSettingsInstance.NumberWalls)
{
_indexLastWall = 0;
}
}
}
public void Crashed()
{
if (IsLocalPlayerPlaying())
{
InitNewRound();
RequestSerialization();
HandleOnDeserialization();
SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(PlayExplosionSound));
}
}
public void PlayJumpSound()
{
if (!_isPlayerInArea)
return;
SoundEffectSource.clip = ClipJump;
SoundEffectSource.Play();
}
public void PlaySelectSound()
{
if (!_isPlayerInArea)
return;
SoundEffectSource.clip = ClipSelection;
SoundEffectSource.Play();
}
public void PlayMusic(bool shouldPlayMusic)
{
Music.gameObject.SetActive(shouldPlayMusic && _isPlayerInArea);
}
public void PlayExplosionSound()
{
if (!_isPlayerInArea)
return;
SoundEffectSource.clip = ClipExplosion;
SoundEffectSource.Play();
}
public void UnlockControls()
{
_inputBlocked = false;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d7830fd515a87f24780984489163fee3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,113 @@
%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: Wall
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: d7577ba49683d444ca791325ce422eac,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 1f50fe2c3ab52a24fab5868f14324376, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 3628400792726071172
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: 1
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: MainGameInstance
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: MainGameInstance
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: myro.arcade.MainGame, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|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: true
- Name: _fieldAttributes
Entry: 7
Data: 5|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:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dec8d7b8bd5aa9d4ea26739176cc20e6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+28
View File
@@ -0,0 +1,28 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace myro.arcade
{
public class Wall : UdonSharpBehaviour
{
public MainGame MainGameInstance;
void Start()
{
}
private void OnTriggerEnter(Collider obj)
{
Controllable controllable = obj.gameObject.GetComponent<Controllable>();
if (controllable != null)
{
MainGameInstance.Crashed();
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f50fe2c3ab52a24fab5868f14324376
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: