using HighlightPlus; using QFramework; using QFramework.Example; using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeviceItem : MonoBehaviour { public XMLTool.Device device; public void Init(XMLTool.Device device) { this.device = device; if (string.IsNullOrEmpty(device.HighColor) == false) { var effect = gameObject.GetOrAddComponent(); gameObject.GetOrAddComponent(); effect.outlineColor = Color.green; } if (device.MeshCollider) { gameObject.GetOrAddComponent(); } else if (string.IsNullOrEmpty(device.BoxColliderSize)==false) { BoxCollider box = gameObject.GetOrAddComponent(); box.size = Utility.GetVector3FromStrArray(device.BoxColliderSize); if (string.IsNullOrEmpty(device.BoxColliderCenter) == false) { box.center = Utility.GetVector3FromStrArray(device.BoxColliderCenter); } } if (string.IsNullOrEmpty(device.Tip) == false) { gameObject.AddComponent().Set(device.Tip); } else { gameObject.AddComponent().Set(device.Name); } } }