PlayerTrigger.cs 1021 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /****************************
  2. summary:
  3. ****************************/
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. public class PlayerTrigger : MonoBehaviour
  8. {
  9. public GameObject SZG;
  10. public GameObject SJD;
  11. private Transform head = null;
  12. void LateUpdate()
  13. {
  14. if(head ==null)
  15. {
  16. if (API_GSXR_Slam.GSXR_Is_SlamRunning() && API_GSXR_Slam.GSXR_Get_Head() != null)
  17. head = API_GSXR_Slam.GSXR_Get_Head();
  18. }
  19. if(head!=null)
  20. {
  21. transform.position = new Vector3(head.position.x, 0, head.position.z);
  22. }
  23. }
  24. private void OnTriggerEnter(Collider other)
  25. {
  26. if(other.name == "SZGBox")
  27. {
  28. SZG.SetActive(true);
  29. SJD.SetActive(false);
  30. }
  31. }
  32. private void OnTriggerExit(Collider other)
  33. {
  34. if(other.name == "SZGBox")
  35. {
  36. SZG.SetActive(false);
  37. SJD.SetActive(true);
  38. }
  39. }
  40. }