/// <summary> /// This function is used for spawning new Tags. /// They are instantiated from the appropiate prefab of their type, /// Named based on the type and number of that type's tags, /// and placed 2 meters in front of the camera. /// The new tag is given an anchor script, added to the list, and the list is saved. /// </summary> /// <param name="tagType">The type of tag that is to be spawned.</param> private void SpawnTag(EnumTagTypes tagType) { GameObject tag = null; switch (tagType) { case EnumTagTypes.Fault: tag = (GameObject)Instantiate(faultTag); tag.name = "FaultTag" + faultTagCount; faultTagCount++; break; case EnumTagTypes.History: tag = (GameObject)Instantiate(historyTag); tag.name = "HistoryTag" + historyTagCount; historyTagCount++; break; case EnumTagTypes.Label: tag = (GameObject)Instantiate(labelTag); tag.name = "LabelTag" + labelTagCount; labelTagCount++; break; } tag.transform.localPosition = Camera.main.transform.localPosition + Camera.main.transform.forward * 2; tag.transform.localRotation = menu.transform.localRotation; tag.AddComponent <AnchorScript>(); tagList.Add(tag); SaveTags(); }
public SerializableTag(string name, EnumTagTypes type, string text) { this.tagName = name; this.tagType = type; this.tagText = text; }
public void SetType(EnumTagTypes type) { tagType = type; }
public SerializableTag() { this.tagName = "NoName"; this.tagType = EnumTagTypes.Fault; this.tagText = "NoText"; }