public void setgraphicObj(Vector3 _Initpos,graphicStyle _style) { _transName=_style.ToString()+ GameControl.findCount (_style).ToString(); _transParent = new GameObject(_transName); _transStyle = _style; _transParent.transform.position =_Initpos; _transParent.transform.parent = GameControl.graphicsParent.transform; _transParent.AddComponent<graphicMes>().setMes(_transName,_transStyle); GameControl.ControlObj = _transParent; }
public void setMes(string name,graphicStyle style) { graphicName = name; _style = style; }
/// <summary> /// get the diffrent graphic count. /// </summary> /// <returns>The count.</returns> /// <param name="_style">graphicStyle</param> public static int findCount(graphicStyle _style) { int graphicCount = 0; for(int i=0;i<graphicsParent.transform.childCount;i++) { if(graphicsParent.transform.GetChild(i).GetComponent<graphicMes>().getStyle().Equals(_style)) { graphicsParent.transform.GetChild(i).name=_style+graphicCount.ToString(); int k=0; for(int j=0;j<graphicsParent.transform.GetChild(i).childCount;j++) { if(graphicsParent.transform.GetChild(i).GetChild(j).tag=="point") { graphicsParent.transform.GetChild(i).GetChild(j).name=_style+graphicCount.ToString()+"point"+k.ToString(); k++; } } graphicCount++; } } return graphicCount; }