public static void SetChildrenTag(this GameObject self, TagName tag, bool containSelf = true) { if (containSelf) { self.tag = tag.ToString(); } foreach (Transform item in self.transform) { item.gameObject.tag = tag.ToString(); } }
void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == tagName.ToString()) { ReverseTranslate(); } }
public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendFormat("{0},{1},{2}", timing.ToString(), tagA.ToString(), tagB.ToString()); return(builder.ToString()); }
/// <summary> /// ターゲット設定 /// </summary> void SetTarget() { if (chaseTarget == null) { var objs = GameObject.FindGameObjectsWithTag(tagName.ToString()); if (objs == null || objs.Length <= 0) { return; } target = objs[0]; return; } target = chaseTarget; }
void Start() { mainCamera = Camera.main; Vector2 position = new Vector2(); position.x = mainCamera.aspect * mainCamera.orthographicSize; position.y = mainCamera.orthographicSize; transform.position = new Vector2(position.x * xOffset, -position.y + renderer.bounds.size.y * xOffset); transform.parent.CreateTrigger( string.Format("{0} Safe Buoy Trigger Left", MovementSide.LEFTorDOWN), new Vector2(position.x / 2, transform.position.y), tagName.ToString(), layerName.ToString()); transform.parent.CreateTrigger( string.Format("{0} Safe Buoy Trigger Right", MovementSide.RIGHTorUP), transform.position + new Vector3(xOffset * 5, 0, 0), tagName.ToString(), layerName.ToString()); Invoke("Restart", respawnTime); startPosition = transform.position; }
public static string ToTagString(this TagName tag) { if (Enum.IsDefined(typeof(TagName), tag)) { return(tag.ToString()); } else { var u = (uint)tag; var chars = new char[4]; for (var i = 0; i < 4; i++) { chars[3 - i] = (char)((u >> (i * 8)) & 0x000000FF); } return(new string(chars)); } }
public StringBuilder Render(int levelCount = 0) { StringBuilder text = new StringBuilder(""); for (int i = 0; i < levelCount; ++i) { text.Append("\t"); } text.Append("<"); text.Append(internalTagName.ToString()); foreach (var item in attributes) { text.Append(" " + item.Key.ToString() + "='" + item.Value.ToString() + "'"); } if (this.isSelfClosing == true) { text.Append("/"); } text.Append(">"); //if (attributes.Count() != 0 || innerText != null) //{ // text.Append("\n"); //} text.Append('\n'); if (innerText != "") { for (int i = 0; i < levelCount + 1; i++) { text.Append("\t"); } text.Append(innerText + "\n"); } foreach (var item in children) { if (item is Tag) { text.Append(((Tag)item).Render(levelCount + 1)); } else { for (int i = 0; i < levelCount + 1; i++) { text.Append("\t"); } text.Append(item.innerText.ToString() + '\n'); } } if (this.isSelfClosing == false) { for (int i = 0; i < levelCount; i++) { text.Append("\t"); } text.Append("</" + internalTagName.ToString() + ">\n"); } return(text); }
public override string ToString() { return(Index + ":" + TagName.ToString()); }