public void Init(ButtonObject parent, Allign allign, int index) { m_parent=parent; GetComponent<GUITexture>().texture=parent.GetObjectTexture(); int allignNumeric=Utility.AllignToIntHorizontal(allign); transform.position = new Vector3(allignNumeric, 1 - (float)((index + 2)) / GUIButtonControls.numColumnTextures, 0); Rect pixelInsert = new Rect(-allignNumeric * Screen.height / (numColumnTextures + 0.2f), 0, Screen.height / (numColumnTextures + 0.2f), Screen.height / (numColumnTextures + 0.2f)); GetComponent<GUITexture>().pixelInset=pixelInsert; }
public static int AllignToIntHorizontal(Allign allign) { return allign == Allign.Right ? 1 : 0; }