public bool removeEntity(EntityAbstract tmpRemoveEntity) { bool removed = false; for (int i = 0; i < this._listOfEntities.Count; i++) { if (this._listOfEntities[i].id == tmpRemoveEntity.id) { this._usedIDs.Remove(tmpRemoveEntity.id); this._listOfEntities.RemoveAt(i); removed = true; } } return removed; }
public bool AddEntity(EntityAbstract tmpNewEntity) { bool added = false; //Loops through all pre-exsisting Entities and adds if a matchis found for (int i = 0; i < this._listOfEntities.Count; i++) { if (this._listOfEntities[i].id == tmpNewEntity.id) { this._listOfEntities[i] = tmpNewEntity; added = true; } } //If no match is found then add new entry if (!added) { this._listOfEntities.Add(tmpNewEntity); if (!this._usedIDs.Contains(tmpNewEntity.id)) { this._usedIDs.Add(tmpNewEntity.id); } added = true; } return added; }