using System.Collections; using System.Collections.Generic; using UnityEngine; public class MachineObj : MonoBehaviour { public Transform door; public Transform navigatorPoint; public MachineParameters deviceParameters; public DataItem dataItem; public Transform xTag; public bool isSingle; private MeshRenderer mesh; public void Setting(bool isSingle) // 是否是单行 { this.isSingle = isSingle; //根据单行 设置门和寻路点的 位置 door.transform.localPosition = isSingle ? new Vector3(0, 0, 0.6f) : new Vector3(0, 0, -0.6f); navigatorPoint.transform.localPosition = isSingle ? new Vector3(0, 0, 1f) : new Vector3(0, 0, -1f); door.gameObject.SetActive(false); navigatorPoint.gameObject.SetActive(false); xTag.transform.localPosition = isSingle ? new Vector3(0, 0, 0.6f) : new Vector3(0, 0, -0.6f); xTag.gameObject.SetActive(false); mesh = gameObject.GetComponent(); mesh.enabled = false; } public void MeshState(bool state) { mesh.enabled = state; } }