private Match makeMatchObject(XMLHandler.XMLMatch xmlMatch, GameObject parent, int colorindex, XMLHandler.XMLLevel xmlLevel) { int pos = xmlMatch.pos; int value = xmlMatch.value; XMLHandler.XMLMATCHTYPE type = xmlMatch.type; Vector2 v; if (type == XMLHandler.XMLMATCHTYPE.R) { v = new Vector2(xoffset + gap + xmlLevel.sides * (scale + gap) - .2f, yoffset + pos * (scale + gap) + .2f); } else { v = new Vector2(xoffset + pos * (scale + gap) - 0.2f, yoffset - scale - 2 * gap + .3f); } GameObject go = Instantiate(matchPrefab, v, Quaternion.identity) as GameObject; go.transform.localScale = new Vector3(scale, scale, scale); go.name = type + " " + value; go.GetComponent <TextMesh>().text = value.ToString(); go.transform.parent = parent.transform; Match match = go.transform.GetChild(0).GetComponent <Match>(); match.initMatch(pos, value, type); return(match); }
public void initMatch(int position, int value, XMLHandler.XMLMATCHTYPE type) { this.value = value; this.position = position; this.type = type; this.spriteRenderer.color = unmatchColor; }