public void StructInfo(PhysicalStructure pStruc) { if(GM.builderHelper.isPlacing) return; if(toolTip) Destroy(toolTip); lastTooltip = "StructInfo"; toolSwitch = 4; Transform templates = canvasObj.transform.Find ("Templates"); GameObject sInfoTemp = templates.Find ("StructInfo").gameObject; toolTip = GameObject.Instantiate (sInfoTemp); toolTip.transform.SetParent (templates); toolTip.name = "StructInfoTooltip"; toolTip.SetActive (true); toolTip.transform.localScale = Vector3.one; toolTip.transform.localPosition = Vector3.zero; Sprite strucIcon = Resources.Load<Sprite> ("BuildingIcons/" + pStruc.structure.name); toolTip.transform.Find ("StructIcon").GetComponent<Image> ().sprite = strucIcon; StructureManager.Structure struc = GM.structureManager.GetStructure(pStruc.structure.name); toolTip.transform.Find ("NameText").GetComponent<Text>().text = struc.displayName; Transform roster = toolTip.transform.Find ("Roster"); GameObject rosterElement = toolTip.transform.Find ("Roster/RosterElement").gameObject; foreach(Villager vill in pStruc.employeeList){ GameObject rosterInst = GameObject.Instantiate(rosterElement); rosterInst.transform.SetParent(roster); rosterInst.transform.localScale = Vector3.one; Image rosterImage = rosterInst.transform.Find("Image").GetComponent<Image>(); Text rosterText = rosterInst.transform.Find("Text").GetComponent<Text>(); rosterImage.sprite = Resources.Load<Sprite> ("VillagerIcons/Heads/VH" + vill.headIconIndex.ToString()); rosterText.text = vill.name; } }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns>A hash code for the current <see cref="SeriesInstance"/>.</returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() => PhysicalStructure.GetHashCode();
/// <summary> /// Determines whether an element identified by the /// given tag exists in this object's physical structure. /// </summary> /// <param name="tag">The tag of the element to search for.</param> /// <returns>True if the element exists; false otherwise.</returns> public bool HasElement(Guid tag) => PhysicalStructure.GetElementsByTag(tag).Any();