TestP6Car.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TestP6Car : MonoBehaviour
  5. {
  6. /// <summary>
  7. /// 擎天柱
  8. /// </summary>
  9. public GameObject TestObj;
  10. public GameObject p6Obj;
  11. public Transform p6Man;
  12. public GameObject p6Point;
  13. [HideInInspector]
  14. public bool state;
  15. public float interval;
  16. float times;
  17. private void Update()
  18. {
  19. if(state)
  20. {
  21. times += Time.deltaTime;
  22. if(times>interval)
  23. {
  24. times = 0;
  25. state = false;
  26. if (p6Point.activeSelf)
  27. return;
  28. p6Obj.SetActive(false);
  29. TestObj.SetActive(true);
  30. TestObj.transform.position = p6Obj.transform.position;
  31. TestObj.transform.eulerAngles = p6Man.transform.eulerAngles;
  32. }
  33. }
  34. }
  35. public void CloseTestObj()
  36. {
  37. TestObj.SetActive(false);
  38. }
  39. }