MachineObj.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MachineObj : MonoBehaviour
  5. {
  6. public Transform door;
  7. public Transform navigatorPoint;
  8. public MachineParameters deviceParameters;
  9. public DataItem dataItem;
  10. public Transform xTag;
  11. public bool isSingle;
  12. private MeshRenderer mesh;
  13. public void Setting(bool isSingle) // 是否是单行
  14. {
  15. this.isSingle = isSingle;
  16. //根据单行 设置门和寻路点的 位置
  17. door.transform.localPosition = isSingle ? new Vector3(0, 0, 0.6f) : new Vector3(0, 0, -0.6f);
  18. navigatorPoint.transform.localPosition = isSingle ? new Vector3(0, 0, 1f) : new Vector3(0, 0, -1f);
  19. door.gameObject.SetActive(false);
  20. navigatorPoint.gameObject.SetActive(false);
  21. xTag.transform.localPosition = isSingle ? new Vector3(0, 0, 0.6f) : new Vector3(0, 0, -0.6f);
  22. xTag.gameObject.SetActive(false);
  23. mesh = gameObject.GetComponent<MeshRenderer>();
  24. mesh.enabled = false;
  25. }
  26. public void MeshState(bool state)
  27. {
  28. mesh.enabled = state;
  29. }
  30. }