/// <summary> /// Remove the Villager from the Job /// </summary> /// <param name="person"></param> internal void RemovePerson(Villager person) { if (person == null) throw new ArgumentNullException(); if (_workers.Contains(person)) { person.setJob(null); _workerListChanged = true; _workers.Remove(person); //_gold = ModifyGoldGeneration();//not usefull here really } else throw new InvalidOperationException(); }
public bool RemovePerson2(Villager person) { if (person == null) return false; if (_workers.Contains(person)) { if ((person.Health & Healths.HERETIC) != 0) { removeHereticWorker(); } person.setJob(null); _workerListChanged = true; _workers.Remove(person); //_gold = ModifyGoldGeneration();//not usefull here really return true; } else return false; }
/// <summary> /// Add a Villager to the Job /// </summary> /// <param name="person"></param> internal void AddPerson(Villager person) { if (!AddPersonPrerequisites()) return; if (person == null) throw new ArgumentNullException(); if (!_workers.Contains(person)) { person.setJob(this); _workerListChanged = true; _workers.Add(person); if ((person.Health & Healths.HERETIC) != 0) { addHereticWorker(); } Debug.Assert(_workers.Contains(person), "(AddPerson) the person was not added Oo"); //_gold = ModifyGoldGeneration();//not usefull here really... } else throw new InvalidOperationException(); }
public bool AddPerson2(Villager person) { if (!AddPersonPrerequisites()) return false; if (person == null) return false; if (!_workers.Contains(person)) { person.setJob(this); _workerListChanged = true; _workers.Add(person); if ((person.Health & Healths.HERETIC) != 0) { addHereticWorker(); } Debug.Assert(_workers.Contains(person), "(AddPerson) the person was not added Oo"); //_gold = ModifyGoldGeneration();//not usefull here really... return true; } else return false; }