using UdonSharp; using UnityEngine; using VRC.SDK3.Data; using VRC.SDKBase; using VRC.Udon; [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] public class FloorMapMarker : UdonSharpBehaviour { //[UdonSynced, FieldChangeCallback(nameof(Enabled))] public bool _Enabled = false; //[UdonSynced, FieldChangeCallback(nameof(IsGrabbed))] public bool _IsGrabbed = false; [SerializeField] private GameManagerRound3 _GameManager; //private DataList _OtherColliders = new DataList(); //private int _CollisionCheckCounter = 0; //private const int MAX_COLLISION_CHECKS = 4; //public void OnTriggerEnter(Collider OtherCollider) //{ // _OtherColliders.Add(OtherCollider); // _CollisionCheckCounter = 0; // if (!IsGrabbed) CheckCollisions(); //} //public override void OnPickup() //{ // IsGrabbed = true; // base.OnPickup(); //} //public override void OnDrop() //{ // IsGrabbed = false; // CheckCollisions(); // base.OnDrop(); //} //public void CheckCollisions() //{ // if (IsUpright()) // { // bool FoundCorrectResponse = false; // for (int i = 0; i < _OtherColliders.Count; i++) // { // Collider OtherCollider = (Collider)_OtherColliders[i].Reference; // if (OtherCollider != null) // { // FloorMapLocation Location = OtherCollider.GetComponent(); // FoundCorrectResponse = _GameManager.ConfirmChoice(Location.Country, Location.City); // if (FoundCorrectResponse) break; // } // } // if (FoundCorrectResponse) // { // Debug.LogError("No error. We found the right place."); // } // else // { // _CollisionCheckCounter++; // if (_CollisionCheckCounter < MAX_COLLISION_CHECKS) // { // SendCustomEventDelayedSeconds(nameof(CheckCollisions), 0.2f); // } // else // { // _OtherColliders.Clear(); // } // } // } // else if (!IsGrabbed) // { // // If the marker isn't sitting mostly upright, or is grabbed, // // don't check collisions until later, if it becomes upright. // SendCustomEventDelayedSeconds(nameof(CheckCollisions), 0.2f); // } //} //private bool IsUpright() //{ // return (Vector3.Dot(transform.forward, Vector3.up) >= 0.85f); //} //public bool Enabled //{ // set // { // _Enabled = value; // } // get => _Enabled; //} //public bool IsGrabbed //{ // set // { // _IsGrabbed = value; // } // get => _IsGrabbed; //} }