Пример #1
0
        internal Family(Game game, Villager mother, Villager father, string name)
            : base(game)
        {
            // Initialized historized value for gold
            _goldStash = new HistorizedValue<int, Family>(this, @"_goldstash", 20);
            _hungry = new HistorizedValue<bool, Family>(this, @"_hungry", 5);

            if (mother.ParentFamily != null && father.ParentFamily != null)
            {
                _goldStash.Current = mother.ParentFamily.TakeFromGoldStash(mother.ParentFamily.GoldStash / 10); //10%
                _goldStash.Current += father.ParentFamily.TakeFromGoldStash(father.ParentFamily.GoldStash / 10); //10%
                RemoveFromFamily(mother, mother.ParentFamily);
                RemoveFromFamily(father, father.ParentFamily);
            }
            else
                _goldStash.Current = 20;

            game.GoldAdded(_goldStash.Current);

            if (mother.StatusInFamily == Status.SINGLE && father.StatusInFamily == Status.SINGLE)
                mother.Engage(father);

            var firstNamesPath = File.ReadAllLines(@"Extra\nameList.txt");
            _firstNameGenerator = new NameGenerator(firstNamesPath, 1, 1);

            _name = name;
            _mother = mother;
            _father = father;
            _mother.StatusInFamily = Status.MARRIED;
            _father.StatusInFamily = Status.MARRIED;

            _familyMembersList = new FamilyMemberList(this);
            _familyMembersList.Add(_mother);
            _familyMembersList.Add(_father);
            _mother.ParentFamily = this;
            _father.ParentFamily = this;

            //=> marriage pendant convocation ? ils s'enfuyent.
            _mother.ActivityStatus = _mother.ActivityStatus & ~ActivityStatus.CONVOCATED;
            _father.ActivityStatus = _father.ActivityStatus & ~ActivityStatus.CONVOCATED;
        }