public string ToString(BallStatus bs) { return(Col + ";" + Row + ";" + Top.ToString() + ";" + Right.ToString() + ";" + Buttom.ToString() + ";" + Left.ToString() + ";" + bs.ToString() + ";relocate"); }
private void SpawnButtons() { Quaternion Rot = transform.rotation; Vector3 distX = 0.5f * transform.forward; Vector3 distY = 0.5f * transform.right; for (int i = 0; i < 9; i++) { Vector3 Pos = transform.position; if (i == 0) { Pos += distX + distY; } else if (i == 1) { Pos += distY; } else if (i == 2) { Pos += -distX + distY; } else if (i == 3) { Pos += distX; } else if (i == 4) { Pos += Vector3.zero; } else if (i == 5) { Pos += -distX; } else if (i == 6) { Pos += distX - distY; } else if (i == 7) { Pos += -distY; } else if (i == 8) { Pos += -distX - distY; } GameObject newB = Instantiate(Button); newB.transform.localPosition = Pos; newB.transform.rotation = Rot; newB.transform.parent = transform; Buttom B = newB.GetComponent <Buttom>(); B.name = B.name + " " + i; B.isConstant = true; B.OnColor = OnColor; B.OffColor = OffColor; buttons.Add(B); } transform.localScale = ToScale; SetID(); }