Round 3 is now fully implemented. The game can be theoretically finished.
This commit is contained in:
@@ -20,7 +20,7 @@ public class FloorMap : UdonSharpBehaviour
|
||||
private const int MAX_SELECTED_COUNTRIES = 13;
|
||||
|
||||
|
||||
void Start()
|
||||
public void RandomiseCountries()
|
||||
{
|
||||
_CurrentCountry = 0;
|
||||
|
||||
@@ -46,8 +46,22 @@ public class FloorMap : UdonSharpBehaviour
|
||||
_ChosenCountries[i] = Location.Country;
|
||||
_ChosenCities[i] = Location.City;
|
||||
}
|
||||
|
||||
Debug.LogError("Current location: " + _ChosenCities[_CurrentCountry] + ", " + _ChosenCountries[_CurrentCountry]);
|
||||
}
|
||||
|
||||
public int NextCountry()
|
||||
{
|
||||
_CurrentCountry++;
|
||||
Debug.LogError("Current location: " + _ChosenCities[_CurrentCountry] + ", " + _ChosenCountries[_CurrentCountry]);
|
||||
return _CurrentCountry;
|
||||
}
|
||||
|
||||
|
||||
public int GetCurrentCountryIndex()
|
||||
{
|
||||
return _CurrentCountry;
|
||||
}
|
||||
|
||||
public string GetCurrentCountry()
|
||||
{
|
||||
|
||||
@@ -44,19 +44,19 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 7
|
||||
Data: 5
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _Enabled
|
||||
Data: _LocationFindingEnabled
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _Enabled
|
||||
Data: _LocationFindingEnabled
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 3|System.RuntimeType, mscorlib
|
||||
@@ -248,76 +248,16 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _AudioManager
|
||||
Data: _CollidingLocations
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _AudioManager
|
||||
Data: _CollidingLocations
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 18|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: AudioManager, Assembly-CSharp
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 14
|
||||
- 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.SerializeField, UnityEngine.CoreModule
|
||||
- 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: _CollidingLocations
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollidingLocations
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 22|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Data.DataList, VRCSDK3
|
||||
@@ -326,7 +266,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 22
|
||||
Data: 18
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -341,7 +281,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 23|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
|
||||
@@ -365,13 +305,13 @@ MonoBehaviour:
|
||||
Data: _CollisionCheckCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 20|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: 21|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.Int32, mscorlib
|
||||
@@ -380,7 +320,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 25
|
||||
Data: 21
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -395,55 +335,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 26|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: _FailureCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _FailureCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 25
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 25
|
||||
- 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: 28|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
|
||||
|
||||
@@ -9,19 +9,16 @@ using static UnityEditor.FilePathAttribute;
|
||||
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
||||
public class FloorMapMarker : UdonSharpBehaviour
|
||||
{
|
||||
[UdonSynced, SerializeField, FieldChangeCallback(nameof(Enabled))] private bool _Enabled = false;
|
||||
[UdonSynced, SerializeField, FieldChangeCallback(nameof(LocationFindingEnabled))] public bool _LocationFindingEnabled = false;
|
||||
[UdonSynced, FieldChangeCallback(nameof(IsGrabbed))] private bool _IsGrabbed = false;
|
||||
|
||||
[SerializeField] private GameManagerRound3 _GameManager;
|
||||
[SerializeField] private AudioManager _AudioManager;
|
||||
|
||||
private DataList _CollidingLocations = new DataList();
|
||||
private int _CollisionCheckCounter = 0;
|
||||
private int _FailureCounter = 0;
|
||||
|
||||
private const int MAX_REPEAT_COLLISION_CHECKS = 3;
|
||||
private const float TIME_BETWEEN_REPEAT_COLLISION_CHECKS = 0.15f;
|
||||
private const int MAX_FAILURE_COUNT = 2;
|
||||
|
||||
|
||||
public void OnTriggerEnter(Collider OtherCollider)
|
||||
@@ -53,7 +50,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
Body.constraints = RigidbodyConstraints.None;
|
||||
}
|
||||
|
||||
Enabled = true;
|
||||
LocationFindingEnabled = true;
|
||||
IsGrabbed = true;
|
||||
_CollidingLocations.Clear();
|
||||
|
||||
@@ -71,7 +68,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
|
||||
public void CheckCollisions()
|
||||
{
|
||||
if (!Enabled) return;
|
||||
if (!LocationFindingEnabled) return;
|
||||
|
||||
if (_CollidingLocations.Count > 0 && IsUpright() && !IsGrabbed)
|
||||
{
|
||||
@@ -83,19 +80,8 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
bool FoundCorrectResponse = ConfirmChoice(Location.Country, Location.City);
|
||||
if (FoundCorrectResponse)
|
||||
{
|
||||
_AudioManager.PlaySFX(SFXEventType.MapCorrect);
|
||||
|
||||
Rigidbody Body;
|
||||
if (Body = GetComponent<Rigidbody>())
|
||||
{
|
||||
Body.constraints = RigidbodyConstraints.FreezeAll;
|
||||
}
|
||||
transform.position = Location.transform.position;
|
||||
StandUpright();
|
||||
|
||||
Enabled = false;
|
||||
EnablePickup(false);
|
||||
|
||||
DisableMovementCompletely(Location);
|
||||
_GameManager.CorrectResponse();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -109,26 +95,12 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
_AudioManager.PlaySFX(SFXEventType.MapIncorrect);
|
||||
DisableMovementCompletely();
|
||||
|
||||
Rigidbody Body;
|
||||
if (Body = GetComponent<Rigidbody>())
|
||||
{
|
||||
Body.constraints = RigidbodyConstraints.FreezeAll;
|
||||
}
|
||||
StandUpright();
|
||||
_GameManager.IncorrectResponse();
|
||||
|
||||
_CollisionCheckCounter = 0;
|
||||
_CollidingLocations.Clear();
|
||||
|
||||
// Stop checking for new collisions here, and if this results
|
||||
// in too many fails, don't allow new pickups.
|
||||
Enabled = false;
|
||||
_FailureCounter++;
|
||||
if (_FailureCounter >= MAX_FAILURE_COUNT)
|
||||
{
|
||||
EnablePickup(false);
|
||||
}
|
||||
}
|
||||
_CollisionCheckCounter++;
|
||||
}
|
||||
@@ -152,7 +124,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
private void EnablePickup(bool Enable)
|
||||
public void EnablePickup(bool Enable)
|
||||
{
|
||||
VRCPickup Pickup;
|
||||
if (Pickup = GetComponent<VRCPickup>())
|
||||
@@ -162,9 +134,21 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
|
||||
private void StandUpright()
|
||||
public void DisableMovementCompletely(FloorMapLocation CorrectLocation = null)
|
||||
{
|
||||
Rigidbody Body;
|
||||
if (Body = GetComponent<Rigidbody>())
|
||||
{
|
||||
Body.constraints = RigidbodyConstraints.FreezeAll;
|
||||
}
|
||||
transform.eulerAngles = new Vector3(0.0f, transform.eulerAngles.y, 0.0f);
|
||||
|
||||
LocationFindingEnabled = false;
|
||||
|
||||
if (CorrectLocation != null)
|
||||
{
|
||||
transform.position = CorrectLocation.transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsUpright()
|
||||
@@ -173,13 +157,13 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
|
||||
public bool Enabled
|
||||
public bool LocationFindingEnabled
|
||||
{
|
||||
set
|
||||
{
|
||||
_Enabled = value;
|
||||
_LocationFindingEnabled = value;
|
||||
}
|
||||
get => _Enabled;
|
||||
get => _LocationFindingEnabled;
|
||||
}
|
||||
|
||||
public bool IsGrabbed
|
||||
|
||||
Reference in New Issue
Block a user