private void SetFollowTarget(List <DevNode> devList) { //int devCout = devList.Count; int followUiCout = FollowObject.Count; for (int i = 0; i < devList.Count; i++) { if (!CurrentDevList.Contains(devList[i])) { CurrentDevList.Add(devList[i]); } if (i < followUiCout) { UGUIFollowTarget followTarget = FollowObject[i].GetComponent <UGUIFollowTarget>(); followTarget.Target = GetTitleObj(devList[i].gameObject); DevInfoFollowUI followItem = followTarget.GetComponent <DevInfoFollowUI>(); followItem.Show(devList[i]); followTarget.gameObject.SetActive(true); } else { GameObject dev = devList[i].gameObject; GameObject followTarget = InitFollowTarget(dev); FollowObject.Add(followTarget); DevInfoFollowUI followItem = followTarget.GetComponent <DevInfoFollowUI>(); followItem.Show(devList[i]); followTarget.gameObject.SetActive(true); } } }
/// <summary> /// 设置跟随UI /// </summary> /// <param name="dev"></param> private void SetFollowTarget(GameObject dev) { if (_followObject == null) { _followObject = InitFollowTarget(dev); } else { UGUIFollowTarget followTarget = _followObject.GetComponent <UGUIFollowTarget>(); GameObject targetTagObj = GetTitleObj(dev); if (followTarget != null) { followTarget.Target = targetTagObj; } } if (DevInfo == null) { DevInfo = _followObject.GetComponent <DevInfoFollowUI>(); } }