PlayerTrigger.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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.NoVariableSync)]
  8. [DisallowMultipleComponent]
  9. [AddComponentMenu("Artyom Scripting System/_DEPRECATED_/Player Trigger")]
  10. public class PlayerTrigger : UdonSharpBehaviour
  11. {
  12. public Animator targetAnimator; // The Animator component to control
  13. public string parameterName; // The name of the boolean parameter to change
  14. public override void OnPlayerTriggerStay(VRCPlayerApi player)
  15. {
  16. if (targetAnimator != null && !string.IsNullOrEmpty(parameterName))
  17. {
  18. targetAnimator.SetBool(parameterName, true); // Set the boolean parameter to true
  19. }
  20. }
  21. public override void OnPlayerTriggerExit(VRCPlayerApi player)
  22. {
  23. if (targetAnimator != null && !string.IsNullOrEmpty(parameterName))
  24. {
  25. targetAnimator.SetBool(parameterName, false); // Set the boolean parameter to false
  26. }
  27. }
  28. }