public void AjouterElement(ElementGeneric elt) { if (elements == null) { elements = new List <ElementGeneric>(); } elements.Add(elt); estOccupe = true; }
private void LireFichierCarte(string pth) { string[] lines; if (pth == null) { return; } path = pth; #if UNITY_ANDROID #else lines = File.ReadAllLines(path); #endif int nbLines = lines.Length; if (nbLines < 3) { return; } maxX = uint.Parse(lines[0]); maxY = uint.Parse(lines[1]); name = lines[2]; if (maxX < 0 || maxY < 0) { return; } carte = new Cellule[maxX, maxY]; //parseur for (int i = 3; i < nbLines; i++) { string[] str = lines[i].Split(':'); if (str.Length == 5) { uint xcel = uint.Parse(str[0]); uint ycel = uint.Parse(str[1]); int ht = int.Parse(str[2]); int typeElt = int.Parse(str[3]); uint id = uint.Parse(str[4]); ElementGeneric elt = new ElementGeneric((ElementGeneric.TYPE_ELEMENT)typeElt, id); carte[xcel, ycel] = new Cellule(); carte[xcel, ycel].AjouterElement(elt); carte[xcel, ycel].Hauteur = ht; } } }
public void SupprimerElement(ElementGeneric elt) { if (elements == null) { return; } elements.Remove(elt); if (elements.Count <= 0) { estOccupe = false; } }