void StartPlacing(int unitIndex) { isPlacing = true; currentUnit = unitIndex; placeholder = Instantiate(units[currentUnit]); placeholder.enabled = true; placeholder.GetComponent<TurretNode>().enabled = false; }
/// <summary> /// 获取树的长度 /// </summary> /// <returns></returns> public float GetTreeHeight() { return(m_RootTreeNode != null?m_RootTreeNode.GetItemCount() * NodeTemplate.GetComponent <RectTransform>().sizeDelta.y : 0); }
private void Awake() { NodeTemplate = transform.Find("NodeTemplate").gameObject; NodeTemplate.GetComponent <RectTransform>().anchoredPosition = new Vector2(10000, 10000); }