- Implemented basic choice card selection for PC and VR.

- Added a noise normal texture to add some detail to flat-coloured objects.
This commit is contained in:
Jamie Greunbaum
2025-05-29 04:17:20 -04:00
parent a60684dd6e
commit 9114e6d99b
38 changed files with 1284 additions and 501 deletions
+68 -2
View File
@@ -20,7 +20,7 @@ MonoBehaviour:
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 4
hasInteractEvent: 1
hasInteractEvent: 0
scriptID: -4699376671505787403
serializationData:
SerializedFormat: 2
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 1
Data: 2
- Name:
Entry: 7
Data:
@@ -105,6 +105,72 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: CardGroup
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: CardGroup
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: ChoiceCardGroup, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 8|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: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 10|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: 13
Data:
+15 -7
View File
@@ -1,21 +1,29 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class ChoiceCard : UdonSharpBehaviour
{
[UdonSynced] public int ChoiceNumber = 0;
[SerializeField] private ChoiceCardGroup CardGroup = null;
public override void Interact()
{
base.Interact();
}
public override void OnPickup()
{
base.OnPickup();
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)CardGroup, NetworkEventTarget.All, "ChoiceCardInteract", ChoiceNumber);
}
public void SetParent(ChoiceCardGroup ParentCardGroup)
{
CardGroup = ParentCardGroup;
}
public void ResetPosition()
{
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
}
}
+241 -1
View File
@@ -19,7 +19,7 @@ MonoBehaviour:
sourceCsScript: {fileID: 11500000, guid: 53ded36b5511644438dd179343f93e5a, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
behaviourSyncMode: 4
hasInteractEvent: 0
scriptID: 3686401941242233976
serializationData:
@@ -42,6 +42,54 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 4
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: ChoiceCards
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: ChoiceCards
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: ChoiceCard[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule
- 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
@@ -51,3 +99,195 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: Podium
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: Podium
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: PlayerPodium, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 8|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: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 10|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: _PCCardHeldPosition
- Name: $v
Entry: 7
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PCCardHeldPosition
- Name: <UserType>k__BackingField
Entry: 7
Data: 12|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Transform, UnityEngine.CoreModule
- 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: true
- Name: _fieldAttributes
Entry: 7
Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 14|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: _SelectedChoice
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SelectedChoice
- 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: false
- 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: 13
Data:
- Name:
Entry: 8
Data:
+70 -5
View File
@@ -1,13 +1,78 @@
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Components;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class ChoiceCardGroup : UdonSharpBehaviour
{
void Start()
{
}
public ChoiceCard[] ChoiceCards;
[SerializeField] private PlayerPodium Podium = null;
[SerializeField] private Transform _PCCardHeldPosition;
private int _SelectedChoice = -1;
void Start()
{
for (int i = 0; i < ChoiceCards.Length; i++)
{
ChoiceCards[i].SetParent(this);
ChoiceCards[i].ResetPosition();
}
}
[NetworkCallable]
public void ChoiceCardInteract(int ChoiceNumber)
{
_SelectedChoice = ChoiceNumber;
for (int i = 0; i < ChoiceCards.Length; i++)
{
ChoiceCard Card = ChoiceCards[i];
if (Card.ChoiceNumber == _SelectedChoice)
{
VRCPlayerApi Player = Networking.GetOwner(Podium.gameObject);
if (Player != null && !Player.IsUserInVR())
{
VRCPickup Pickup = Card.GetComponent<VRCPickup>();
if (Pickup != null)
{
Pickup.Drop();
}
Card.transform.localPosition = _PCCardHeldPosition.localPosition;
Card.transform.localEulerAngles = _PCCardHeldPosition.localEulerAngles;
}
}
else
{
Card.ResetPosition();
}
}
}
private void RevealChoice(int ChoiceNumber)
{
if (ChoiceNumber == _SelectedChoice)
{
VRCPlayerApi Player = Networking.GetOwner(Podium.gameObject);
if (Player != null && !Player.IsUserInVR())
{
// Play the PC turn-around animation here.
}
}
}
public int GetSelectedChoice()
{
return _SelectedChoice;
}
}