PickupDetector.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using UdonSharp;
  2. using UnityEngine;
  3. using VRC.SDKBase;
  4. using VRC.Udon;
  5. using System;
  6. [Obsolete("Replaced with Linked Object System")]
  7. [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
  8. [DisallowMultipleComponent]
  9. [AddComponentMenu("Artyom Scripting System/_DEPRECATED_/Pickup Detector")]
  10. public class PickupDetector : UdonSharpBehaviour
  11. {
  12. // You can specify the pickup object here if you want to check for a specific object
  13. public Animator targetAnimator; // The Animator component to control
  14. public string parameterName; // The name of the boolean parameter to change
  15. private void OnTriggerEnter(Collider other)
  16. {
  17. VRC_Pickup pickup = other.GetComponent<VRC_Pickup>();
  18. if (pickup != null)
  19. {
  20. targetAnimator.SetBool(parameterName, true);
  21. }
  22. }
  23. private void OnTriggerExit(Collider other)
  24. {
  25. VRC_Pickup pickup = other.GetComponent<VRC_Pickup>();
  26. if (pickup != null)
  27. {
  28. targetAnimator.SetBool(parameterName, false);
  29. }
  30. }
  31. }