- Location board orientation corrected to properly match Unity axes.
- Markers are no longer thrown when dropped while walking. - Markers stay much more stable and are far less prone to falling over. - Rounds 2 and 3 properly sync to other clients.
This commit is contained in:
@@ -19,7 +19,7 @@ MonoBehaviour:
|
||||
sourceCsScript: {fileID: 11500000, guid: 949eb8690c7931145836b58adb7eafcf, type: 3}
|
||||
scriptVersion: 2
|
||||
compiledVersion: 2
|
||||
behaviourSyncMode: 1
|
||||
behaviourSyncMode: 4
|
||||
hasInteractEvent: 0
|
||||
scriptID: 5372152653533207248
|
||||
serializationData:
|
||||
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 4
|
||||
Data: 5
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -110,19 +110,19 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _ChosenCountries
|
||||
Data: _CurrentCountry
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ChosenCountries
|
||||
Data: _CurrentCountry
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 7|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.String[], mscorlib
|
||||
Data: System.Int32, mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -133,8 +133,8 @@ MonoBehaviour:
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
- Name:
|
||||
Entry: 6
|
||||
Data:
|
||||
Entry: 3
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -144,6 +144,132 @@ MonoBehaviour:
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 9|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- 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: _RandomisedCountriesAndCities
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _RandomisedCountriesAndCities
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 11|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32[], mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 11
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
- Name:
|
||||
Entry: 3
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <IsSerialized>k__BackingField
|
||||
Entry: 5
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 2
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 13|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 14|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- 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: _ChosenCountries
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ChosenCountries
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 16|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.String[], 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: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -167,16 +293,16 @@ MonoBehaviour:
|
||||
Data: _ChosenCities
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ChosenCities
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 7
|
||||
Data: 16
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 7
|
||||
Data: 16
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -191,61 +317,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 10|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: _CurrentCountry
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CurrentCountry
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 12|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32, mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 12
|
||||
- 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: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Data;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
|
||||
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
|
||||
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
||||
public class FloorMap : UdonSharpBehaviour
|
||||
{
|
||||
public FloorMapCountry[] Countries;
|
||||
|
||||
[UdonSynced] private int _CurrentCountry = 0;
|
||||
[UdonSynced, FieldChangeCallback(nameof(RandomisedCountriesAndCities))] private int[] _RandomisedCountriesAndCities;
|
||||
|
||||
private string[] _ChosenCountries = new string[MAX_SELECTED_COUNTRIES];
|
||||
private string[] _ChosenCities = new string[MAX_SELECTED_COUNTRIES];
|
||||
private int _CurrentCountry = 0;
|
||||
|
||||
private const int MAX_SELECTED_COUNTRIES = 13;
|
||||
|
||||
@@ -26,21 +24,61 @@ public class FloorMap : UdonSharpBehaviour
|
||||
|
||||
UnityEngine.Random.InitState(Networking.GetServerTimeInMilliseconds());
|
||||
|
||||
FloorMapCountry[] SelectedCountries = new FloorMapCountry[MAX_SELECTED_COUNTRIES];
|
||||
int[] NewRandomCountries = new int[MAX_SELECTED_COUNTRIES];
|
||||
int[] NewRandomCities = new int[MAX_SELECTED_COUNTRIES];
|
||||
|
||||
// Fill the countries array with values too big to be considered valid.
|
||||
int NumberOfCountries = Countries.Length;
|
||||
for (int i = 0; i < MAX_SELECTED_COUNTRIES; i++)
|
||||
{
|
||||
NewRandomCountries[i] = NumberOfCountries;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_SELECTED_COUNTRIES; i++)
|
||||
{
|
||||
int NewPulledIndex = UnityEngine.Random.Range(0, Countries.Length);
|
||||
while (Countries[NewPulledIndex].gameObject.activeSelf)
|
||||
int NewPulledIndex = NumberOfCountries;
|
||||
while (CountryIsAlreadyInArray(NewRandomCountries, NewPulledIndex))
|
||||
{
|
||||
NewPulledIndex = UnityEngine.Random.Range(0, Countries.Length);
|
||||
NewPulledIndex = UnityEngine.Random.Range(0, NumberOfCountries);
|
||||
}
|
||||
NewRandomCountries[i] = NewPulledIndex;
|
||||
NewRandomCities[i] = UnityEngine.Random.Range(0, Countries[NewPulledIndex].Locations.Length);
|
||||
}
|
||||
|
||||
FloorMapCountry Country = Countries[NewPulledIndex];
|
||||
// We're syncing the countries and cities as one array to keep
|
||||
// things simple to sync all at once.
|
||||
// Array format is all countries first, then all cities.
|
||||
int[] NewRandomCountriesAndCities = new int[MAX_SELECTED_COUNTRIES * 2];
|
||||
NewRandomCountries.CopyTo(NewRandomCountriesAndCities, 0);
|
||||
NewRandomCities.CopyTo(NewRandomCountriesAndCities, MAX_SELECTED_COUNTRIES);
|
||||
|
||||
RandomisedCountriesAndCities = NewRandomCountriesAndCities;
|
||||
RequestSerialization();
|
||||
}
|
||||
private bool CountryIsAlreadyInArray(int[] Countries, int IndexToCheck)
|
||||
{
|
||||
for (int i = 0; i < MAX_SELECTED_COUNTRIES; i++)
|
||||
{
|
||||
if (Countries[i] == IndexToCheck)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void AssignRandomCountriesAndCities()
|
||||
{
|
||||
DisableAllLocations();
|
||||
|
||||
_CurrentCountry = 0;
|
||||
|
||||
for (int i = 0; i < MAX_SELECTED_COUNTRIES; i++)
|
||||
{
|
||||
FloorMapCountry Country = Countries[RandomisedCountriesAndCities[i]];
|
||||
Country.gameObject.SetActive(true);
|
||||
SelectedCountries[i] = Countries[NewPulledIndex];
|
||||
|
||||
FloorMapLocation Location = Country.Locations[UnityEngine.Random.Range(0, Country.Locations.Length)];
|
||||
FloorMapLocation Location = Country.Locations[RandomisedCountriesAndCities[MAX_SELECTED_COUNTRIES + i]];
|
||||
Location.gameObject.SetActive(true);
|
||||
|
||||
_ChosenCountries[i] = Location.Country;
|
||||
@@ -53,9 +91,10 @@ public class FloorMap : UdonSharpBehaviour
|
||||
_CurrentCountry++;
|
||||
if (_CurrentCountry >= MAX_SELECTED_COUNTRIES)
|
||||
{
|
||||
Debug.LogError("We ran out of countries. Just end the game here.");
|
||||
// We ran out of countries. Just end the game here.
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _CurrentCountry;
|
||||
}
|
||||
|
||||
@@ -74,4 +113,29 @@ public class FloorMap : UdonSharpBehaviour
|
||||
{
|
||||
return _ChosenCities[_CurrentCountry];
|
||||
}
|
||||
|
||||
|
||||
private void DisableAllLocations()
|
||||
{
|
||||
for (int i = 0; i < Countries.Length; i++)
|
||||
{
|
||||
FloorMapCountry Country = Countries[i];
|
||||
for (int j = 0; j < Country.Locations.Length; j++)
|
||||
{
|
||||
Country.Locations[j].gameObject.SetActive(false);
|
||||
}
|
||||
Country.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int[] RandomisedCountriesAndCities
|
||||
{
|
||||
set
|
||||
{
|
||||
_RandomisedCountriesAndCities = value;
|
||||
AssignRandomCountriesAndCities();
|
||||
}
|
||||
get => _RandomisedCountriesAndCities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ MonoBehaviour:
|
||||
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 3
|
||||
Data: 2
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 5|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
@@ -95,13 +95,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 7|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
|
||||
Data: 6|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -125,7 +119,7 @@ MonoBehaviour:
|
||||
Data: _IsGrabbed
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _IsGrabbed
|
||||
@@ -149,19 +143,19 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 2
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 10|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
Data: 9|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 11|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
|
||||
Data: 10|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -185,13 +179,13 @@ MonoBehaviour:
|
||||
Data: _GameManager
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _GameManager
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 13|System.RuntimeType, mscorlib
|
||||
Data: 12|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: GameManagerRound3, Assembly-CSharp
|
||||
@@ -200,7 +194,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 14|System.RuntimeType, mscorlib
|
||||
Data: 13|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.Udon.UdonBehaviour, VRC.Udon
|
||||
@@ -221,13 +215,13 @@ MonoBehaviour:
|
||||
Data: true
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 16|UnityEngine.SerializeField, UnityEngine.CoreModule
|
||||
Data: 15|UnityEngine.SerializeField, UnityEngine.CoreModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -251,13 +245,13 @@ MonoBehaviour:
|
||||
Data: _LitLampMaterial
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _LitLampMaterial
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 18|System.RuntimeType, mscorlib
|
||||
Data: 17|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.Material, UnityEngine.CoreModule
|
||||
@@ -266,7 +260,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 18
|
||||
Data: 17
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -281,13 +275,13 @@ MonoBehaviour:
|
||||
Data: true
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 20|UnityEngine.SerializeField, UnityEngine.CoreModule
|
||||
Data: 19|UnityEngine.SerializeField, UnityEngine.CoreModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -311,13 +305,13 @@ MonoBehaviour:
|
||||
Data: _CollidingLocations
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollidingLocations
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 22|System.RuntimeType, mscorlib
|
||||
Data: 21|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Data.DataList, VRCSDK3
|
||||
@@ -326,7 +320,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 22
|
||||
Data: 21
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -341,7 +335,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -365,13 +359,13 @@ MonoBehaviour:
|
||||
Data: _CollisionCheckCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollisionCheckCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 25|System.RuntimeType, mscorlib
|
||||
Data: 24|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32, mscorlib
|
||||
@@ -380,13 +374,13 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 25
|
||||
Data: 24
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
- Name:
|
||||
Entry: 6
|
||||
Data:
|
||||
Entry: 3
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -395,10 +389,16 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 26|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 26|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 13
|
||||
Data:
|
||||
@@ -425,16 +425,16 @@ MonoBehaviour:
|
||||
Data: _NoCollisionCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 25
|
||||
Data: 24
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 25
|
||||
Data: 24
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
- Name:
|
||||
Entry: 6
|
||||
Data:
|
||||
Entry: 3
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -446,7 +446,13 @@ MonoBehaviour:
|
||||
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 29|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 13
|
||||
Data:
|
||||
|
||||
@@ -3,13 +3,15 @@ using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Components;
|
||||
using VRC.SDK3.Data;
|
||||
using VRC.SDK3.UdonNetworkCalling;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon.Common.Interfaces;
|
||||
|
||||
|
||||
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
||||
public class FloorMapMarker : UdonSharpBehaviour
|
||||
{
|
||||
[UdonSynced, SerializeField, FieldChangeCallback(nameof(LocationFindingEnabled))] public bool _LocationFindingEnabled = false;
|
||||
[UdonSynced, FieldChangeCallback(nameof(LocationFindingEnabled))] public bool _LocationFindingEnabled = false;
|
||||
[UdonSynced, FieldChangeCallback(nameof(IsGrabbed))] private bool _IsGrabbed = false;
|
||||
|
||||
[SerializeField] private GameManagerRound3 _GameManager;
|
||||
@@ -17,8 +19,8 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
[SerializeField] private Material _LitLampMaterial;
|
||||
|
||||
private DataList _CollidingLocations = new DataList();
|
||||
private int _CollisionCheckCounter = 0;
|
||||
private int _NoCollisionCounter = 0;
|
||||
[UdonSynced] private int _CollisionCheckCounter = 0;
|
||||
[UdonSynced] private int _NoCollisionCounter = 0;
|
||||
|
||||
private const int MAX_REPEAT_COLLISION_CHECKS = 3;
|
||||
private const int MAX_TIME_WITH_NO_COLLISIONS = 8;
|
||||
@@ -56,7 +58,6 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
Body.constraints = RigidbodyConstraints.None;
|
||||
}
|
||||
|
||||
LocationFindingEnabled = true;
|
||||
IsGrabbed = true;
|
||||
_NoCollisionCounter = 0;
|
||||
_CollidingLocations.Clear();
|
||||
@@ -97,7 +98,10 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
bool FoundCorrectResponse = ConfirmChoice(Location.Country, Location.City);
|
||||
if (FoundCorrectResponse)
|
||||
{
|
||||
SendCorrectResponse(Location);
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this,
|
||||
NetworkEventTarget.All,
|
||||
nameof(SendCorrectResponse),
|
||||
Location.transform.position);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -111,17 +115,20 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
SendIncorrectResponse();
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this,
|
||||
NetworkEventTarget.All,
|
||||
nameof(SendIncorrectResponse));
|
||||
}
|
||||
_CollisionCheckCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_NoCollisionCounter++;
|
||||
Debug.Log("No collisions for " + _NoCollisionCounter + " ticks.");
|
||||
if (_NoCollisionCounter >= MAX_TIME_WITH_NO_COLLISIONS)
|
||||
{
|
||||
SendIncorrectResponse();
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this,
|
||||
NetworkEventTarget.All,
|
||||
nameof(SendIncorrectResponse));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,7 +151,8 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SendCorrectResponse(FloorMapLocation CorrectLocation)
|
||||
[NetworkCallable]
|
||||
public void SendCorrectResponse(Vector3 CorrectLocation)
|
||||
{
|
||||
DisableMovementCompletely(CorrectLocation);
|
||||
|
||||
@@ -159,7 +167,8 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
_GameManager.CorrectResponse();
|
||||
}
|
||||
|
||||
private void SendIncorrectResponse()
|
||||
[NetworkCallable]
|
||||
public void SendIncorrectResponse()
|
||||
{
|
||||
DisableMovementCompletely();
|
||||
|
||||
@@ -179,7 +188,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
|
||||
public void DisableMovementCompletely(FloorMapLocation CorrectLocation = null)
|
||||
public void DisableMovementCompletely(Vector3 CorrectLocation = new Vector3())
|
||||
{
|
||||
Rigidbody Body;
|
||||
if (Body = GetComponent<Rigidbody>())
|
||||
@@ -188,11 +197,9 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
transform.eulerAngles = new Vector3(0.0f, transform.eulerAngles.y, 0.0f);
|
||||
|
||||
LocationFindingEnabled = false;
|
||||
|
||||
if (CorrectLocation != null)
|
||||
if (CorrectLocation != Vector3.zero)
|
||||
{
|
||||
transform.position = CorrectLocation.transform.position;
|
||||
transform.position = CorrectLocation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user