//Forme : // <PLAYER> // Name='???' Race='???' VictoryPoint='???' // <ENTITY_LIST> // ... // </ENTITY_LIST> // </PLAYER> public string[] Save(int isEnd) { int size = 3 * EntityList.Count + 5; string[] result = new string[size]; result[0] = "<PLAYER>"; result[1] = (isEnd == -1) ? "Name='" + Name + "' Race='" + RaceString + "' VictoryPoint='" + VictoryPoint.ToString() + "'" : "Name='" + Name + "' Race='" + RaceString + "' VictoryPoint='0'"; result[2] = "<ENTITY_LIST>"; for (int i = 0; i < EntityList.Count; i++) { string[] save = EntityList[i].Save(isEnd); result[3 + i * 3] = save[0]; result[4 + i * 3] = save[1]; result[5 + i * 3] = save[2]; } result[size - 2] = "</ENTITY_LIST>"; result[size - 1] = "</PLAYER>"; return(result); }
// Use this for initialization void Start() { point1 = transform.GetChild(0).GetComponent <VictoryPoint>(); point2 = transform.GetChild(1).GetComponent <VictoryPoint>(); }