Fixed a few more sync issues, particularly involving resets.
This commit is contained in:
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 5
|
||||
Data: 6
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -170,19 +170,19 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _RandomisedCountriesAndCities
|
||||
Data: _Activate
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _RandomisedCountriesAndCities
|
||||
Data: _Activate
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 11|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32[], mscorlib
|
||||
Data: System.Boolean, mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -236,16 +236,82 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _ChosenCountries
|
||||
Data: _RandomisedCountriesAndCities
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ChosenCountries
|
||||
Data: _RandomisedCountriesAndCities
|
||||
- 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: 3
|
||||
Data: 1
|
||||
- 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: 2
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 18|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 19|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: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ChosenCountries
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 21|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.String[], mscorlib
|
||||
@@ -254,7 +320,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 16
|
||||
Data: 21
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -269,7 +335,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 17|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
|
||||
@@ -293,16 +359,16 @@ MonoBehaviour:
|
||||
Data: _ChosenCities
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ChosenCities
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 16
|
||||
Data: 21
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 16
|
||||
Data: 21
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -317,7 +383,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UdonSharp;
|
||||
using VRC.SDK3.UdonNetworkCalling;
|
||||
using VRC.SDKBase;
|
||||
using VRC.SDK3.UdonNetworkCalling;
|
||||
using VRC.Udon.Common.Interfaces;
|
||||
|
||||
|
||||
@@ -12,22 +12,32 @@ public class FloorMap : UdonSharpBehaviour
|
||||
public FloorMapCountry[] Countries;
|
||||
|
||||
[UdonSynced] private int _CurrentCountry = 0;
|
||||
[UdonSynced, FieldChangeCallback(nameof(Activate))] private bool _Activate;
|
||||
[UdonSynced, FieldChangeCallback(nameof(RandomisedCountriesAndCities))] private int[] _RandomisedCountriesAndCities;
|
||||
|
||||
private string[] _ChosenCountries = new string[MAX_SELECTED_COUNTRIES];
|
||||
private string[] _ChosenCities = new string[MAX_SELECTED_COUNTRIES];
|
||||
|
||||
private const int MAX_SELECTED_COUNTRIES = 13;
|
||||
private const float DEACTIVATE_HEIGHT = -1000.0f;
|
||||
|
||||
|
||||
private void ActivateMap()
|
||||
{
|
||||
transform.localPosition = Activate ? Vector3.zero : new Vector3(0.0f, DEACTIVATE_HEIGHT, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
public void RandomiseCountries()
|
||||
{
|
||||
Debug.Log("[FloorMap] Randomising countries...");
|
||||
|
||||
for (int i = 0; i < Countries.Length; i++)
|
||||
{
|
||||
Countries[i].gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
UnityEngine.Random.InitState(Networking.GetServerTimeInMilliseconds());
|
||||
Random.InitState(Networking.GetServerTimeInMilliseconds());
|
||||
|
||||
int[] NewRandomCountries = new int[MAX_SELECTED_COUNTRIES];
|
||||
int[] NewRandomCities = new int[MAX_SELECTED_COUNTRIES];
|
||||
@@ -44,10 +54,10 @@ public class FloorMap : UdonSharpBehaviour
|
||||
int NewPulledIndex = NumberOfCountries;
|
||||
while (CountryIsAlreadyInArray(NewRandomCountries, NewPulledIndex) || Countries[NewPulledIndex].HardModeSelection)
|
||||
{
|
||||
NewPulledIndex = UnityEngine.Random.Range(0, NumberOfCountries);
|
||||
NewPulledIndex = Random.Range(0, NumberOfCountries);
|
||||
}
|
||||
NewRandomCountries[i] = NewPulledIndex;
|
||||
NewRandomCities[i] = UnityEngine.Random.Range(0, Countries[NewPulledIndex].Locations.Length);
|
||||
NewRandomCities[i] = Random.Range(0, Countries[NewPulledIndex].Locations.Length);
|
||||
}
|
||||
|
||||
// We're syncing the countries and cities as one array to keep
|
||||
@@ -57,7 +67,8 @@ public class FloorMap : UdonSharpBehaviour
|
||||
NewRandomCountries.CopyTo(RandomCountriesAndCities, 0);
|
||||
NewRandomCities.CopyTo(RandomCountriesAndCities, MAX_SELECTED_COUNTRIES);
|
||||
|
||||
RandomisedCountriesAndCities = RandomCountriesAndCities;
|
||||
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(AssignRandomCountriesAndCities), RandomCountriesAndCities);
|
||||
|
||||
RequestSerialization();
|
||||
}
|
||||
private bool CountryIsAlreadyInArray(int[] Countries, int IndexToCheck)
|
||||
@@ -72,7 +83,8 @@ public class FloorMap : UdonSharpBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
public void AssignRandomCountriesAndCities(int[] RandomisedCountriesAndCities)
|
||||
[NetworkCallable]
|
||||
public void AssignRandomCountriesAndCities(int[] NewCountrySelections)
|
||||
{
|
||||
DisableAllLocations();
|
||||
|
||||
@@ -80,15 +92,17 @@ public class FloorMap : UdonSharpBehaviour
|
||||
|
||||
for (int i = 0; i < MAX_SELECTED_COUNTRIES; i++)
|
||||
{
|
||||
FloorMapCountry Country = Countries[RandomisedCountriesAndCities[i]];
|
||||
FloorMapCountry Country = Countries[NewCountrySelections[i]];
|
||||
Country.gameObject.SetActive(true);
|
||||
|
||||
FloorMapLocation Location = Country.Locations[RandomisedCountriesAndCities[MAX_SELECTED_COUNTRIES + i]];
|
||||
FloorMapLocation Location = Country.Locations[NewCountrySelections[MAX_SELECTED_COUNTRIES + i]];
|
||||
Location.gameObject.SetActive(true);
|
||||
|
||||
_ChosenCountries[i] = Location.Country;
|
||||
_ChosenCities[i] = Location.City;
|
||||
}
|
||||
|
||||
_RandomisedCountriesAndCities = NewCountrySelections;
|
||||
}
|
||||
|
||||
public int NextCountry()
|
||||
@@ -136,12 +150,22 @@ public class FloorMap : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
|
||||
public bool Activate
|
||||
{
|
||||
set
|
||||
{
|
||||
_Activate = value;
|
||||
ActivateMap();
|
||||
}
|
||||
get => _Activate;
|
||||
}
|
||||
|
||||
public int[] RandomisedCountriesAndCities
|
||||
{
|
||||
set
|
||||
{
|
||||
_RandomisedCountriesAndCities = value;
|
||||
AssignRandomCountriesAndCities(_RandomisedCountriesAndCities);
|
||||
AssignRandomCountriesAndCities(value);
|
||||
}
|
||||
get => _RandomisedCountriesAndCities;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 12
|
||||
Data: 14
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -362,13 +362,13 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _LocationFindingEnabled
|
||||
Data: _IsLit
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _LocationFindingEnabled
|
||||
Data: _IsLit
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 15
|
||||
@@ -392,13 +392,19 @@ MonoBehaviour:
|
||||
Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
Data: 2
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 26|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 27|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 13
|
||||
Data:
|
||||
@@ -416,31 +422,25 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _CollisionCheckCounter
|
||||
Data: _LocationFindingEnabled
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollisionCheckCounter
|
||||
Data: _LocationFindingEnabled
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 28|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32, mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
Entry: 9
|
||||
Data: 15
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 28
|
||||
Data: 15
|
||||
- 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:
|
||||
@@ -450,6 +450,66 @@ MonoBehaviour:
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 29|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 30|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: _CollisionCheckCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollisionCheckCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 32|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32, mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 32
|
||||
- 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -473,16 +533,16 @@ MonoBehaviour:
|
||||
Data: _NoCollisionCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _NoCollisionCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 28
|
||||
Data: 32
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 28
|
||||
Data: 32
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -497,7 +557,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 35|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -521,13 +581,13 @@ MonoBehaviour:
|
||||
Data: _CollidingLocations
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 36|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollidingLocations
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 33|System.RuntimeType, mscorlib
|
||||
Data: 37|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Data.DataList, VRCSDK3
|
||||
@@ -536,7 +596,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 33
|
||||
Data: 37
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -551,7 +611,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -575,13 +635,13 @@ MonoBehaviour:
|
||||
Data: _RigidBodyComponent
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _RigidBodyComponent
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 36|System.RuntimeType, mscorlib
|
||||
Data: 40|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule
|
||||
@@ -590,7 +650,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 36
|
||||
Data: 40
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -605,7 +665,61 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 41|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: _ObjectSync
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ObjectSync
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 43|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: MMMaellon.LightSync.LightSync, com.mmmaellon.lightsync
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 4
|
||||
- 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: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -629,13 +743,13 @@ MonoBehaviour:
|
||||
Data: _PickupComponent
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _PickupComponent
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 39|System.RuntimeType, mscorlib
|
||||
Data: 46|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Components.VRCPickup, VRCSDK3
|
||||
@@ -644,7 +758,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 39
|
||||
Data: 46
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -659,7 +773,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -683,13 +797,13 @@ MonoBehaviour:
|
||||
Data: _MarkerMesh
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _MarkerMesh
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 42|System.RuntimeType, mscorlib
|
||||
Data: 49|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule
|
||||
@@ -698,7 +812,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 42
|
||||
Data: 49
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -713,7 +827,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
using MMMaellon.LightSync;
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Components;
|
||||
@@ -18,6 +19,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
|
||||
[UdonSynced, SerializeField, FieldChangeCallback(nameof(Active))] private bool _Active = false;
|
||||
[UdonSynced, FieldChangeCallback(nameof(IsGrabbed))] private bool _IsGrabbed = false;
|
||||
[UdonSynced, FieldChangeCallback(nameof(IsLit))] private bool _IsLit = false;
|
||||
[UdonSynced] private bool _LocationFindingEnabled = false;
|
||||
|
||||
private int _CollisionCheckCounter = 0;
|
||||
@@ -25,6 +27,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
private DataList _CollidingLocations = new DataList();
|
||||
|
||||
private Rigidbody _RigidBodyComponent;
|
||||
private LightSync _ObjectSync;
|
||||
private VRCPickup _PickupComponent;
|
||||
private MeshRenderer _MarkerMesh;
|
||||
|
||||
@@ -36,10 +39,34 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
void Start()
|
||||
{
|
||||
_RigidBodyComponent = GetComponent<Rigidbody>();
|
||||
_ObjectSync = GetComponent<LightSync>();
|
||||
_PickupComponent = GetComponent<VRCPickup>();
|
||||
_MarkerMesh = GetComponent<MeshRenderer>();
|
||||
}
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
_ObjectSync.TeleportToLocalSpace(Vector3.zero, Quaternion.identity, true);
|
||||
SetPickupable(false);
|
||||
|
||||
Active = false;
|
||||
IsGrabbed = false;
|
||||
IsLit = false;
|
||||
_LocationFindingEnabled = false;
|
||||
|
||||
_CollisionCheckCounter = 0;
|
||||
_NoCollisionCounter = 0;
|
||||
_CollidingLocations.Clear();
|
||||
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
public void SetPickupable(bool Pickupable)
|
||||
{
|
||||
_PickupComponent.pickupable = Pickupable;
|
||||
}
|
||||
|
||||
|
||||
public void OnTriggerEnter(Collider OtherCollider)
|
||||
{
|
||||
FloorMapLocation Location = OtherCollider.GetComponent<FloorMapLocation>();
|
||||
@@ -83,6 +110,13 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
base.OnDrop();
|
||||
}
|
||||
|
||||
private void SwapLampMaterial()
|
||||
{
|
||||
Material[] Materials = _MarkerMesh.materials;
|
||||
Materials[2] = IsLit ? _LitLampMaterial : _UnlitLampMaterial;
|
||||
_MarkerMesh.materials = Materials;
|
||||
}
|
||||
|
||||
private void ReactToGrab()
|
||||
{
|
||||
if (IsGrabbed)
|
||||
@@ -178,10 +212,9 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
{
|
||||
DisableMovementCompletely(CorrectLocation);
|
||||
|
||||
Material[] Materials = _MarkerMesh.materials;
|
||||
Materials[2] = _LitLampMaterial;
|
||||
_MarkerMesh.materials = Materials;
|
||||
IsLit = true;
|
||||
|
||||
RequestSerialization();
|
||||
_GameManager.CorrectResponse();
|
||||
}
|
||||
|
||||
@@ -194,6 +227,8 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
|
||||
_CollisionCheckCounter = 0;
|
||||
_CollidingLocations.Clear();
|
||||
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
@@ -247,4 +282,14 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
get => _IsGrabbed;
|
||||
}
|
||||
|
||||
private bool IsLit
|
||||
{
|
||||
set
|
||||
{
|
||||
_IsLit = value;
|
||||
SwapLampMaterial();
|
||||
}
|
||||
get => _IsLit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user