public override void Init(bool isEdge) { base.Init(isEdge); if (isEdge) { if (transform.parent.position.x < 0) { faceRight = true; } else { faceRight = false; } } else { if (Random.Range(0, 2) == 0) { faceRight = true; } else { faceRight = false; } } if (faceRight) { transform.eulerAngles = new Vector3(0f, 90f, 0f); } else { transform.eulerAngles = new Vector3(0f, 180f, 0f); } color = ItemColor.RandomColor(); Material[] matArray = GetComponent <MeshRenderer>().materials; matArray[1] = materials[(int)color]; GetComponent <MeshRenderer>().materials = matArray; }