Exemple #1
0
 public void SetVirus(Virus virus)
 {
     Debug.Assert(virus != null, "(villager SetVirus) virus is null !!!");
     if ((_health.Current & Healths.SICK) != 0)
         throw new InvalidOperationException("This villager is already sick");
     _virus = virus;
     virus.Epidemic.SickVillagerList.Add(this);
     _health.Current = _health.Current | Healths.SICK;
 }
Exemple #2
0
        internal override void OnDestroy()
        {
            Debug.Assert(IsDead(), "the villager is still alive!");
            if ((Gender == Genders.MALE) && (StatusInFamily == Status.SINGLE))
            {
                Debug.Assert(_fiance == null);
                Debug.Assert(Game.SingleMen.Contains(this));
                Game.SingleManDestroyed(this);
            }
            if (_virus != null)
            {
                if (_virus.Epidemic != null)
                    _virus.Epidemic.SickVillagerList.Remove(this);
                _virus = null;
            }

            if (_fiance != null)
            {
                _fiance.FianceDestroyed();
                Debug.Assert(_fiance == null);
            }
            if (_job != null)
                _job.WorkerDestroyed(this);
            Debug.Assert(_fiance == null, "he still has a fiance Oo !");
            _parentFamily.OwnerVillage.VillagerRemoved(this);
            _parentFamily.FamilyMemberDestroyed(this);
            Debug.Assert(_parentFamily == null, "he still has a parentfamily Oo !");
            Game.VillagerRemoved(this);
        }
Exemple #3
0
 public void SetHealed( int amount=0)
 {
     Debug.Assert(amount >= 0, "SetHealed, amount was negative");
     if (_virus != null)
     {
         _virus.Epidemic.SickVillagerList.Remove(this);
         _virus = null;
     }
     _health.Current = _health.Current & ~Healths.SICK;
     _lifeExpectancy += amount;
 }