Beispiel #1
0
    /// <summary>
    /// Will set them into the family
    /// will set new transform.parent
    /// will remove from old family
    /// </summary>
    /// <param name="curFamily"></param>
    /// <param name="fam"></param>
    private void TransferFromCurrToNewFam(Family curFamily, Family newFam, Person newPerson, Building newHome)
    {
        if (!string.IsNullOrEmpty(newPerson.Spouse))
        {
            var spouse = Family.FindPerson(newPerson.Spouse);
            if (spouse != null)
            {
                newFam.CanGetAnotherAdult(spouse);
                curFamily.RemovePersonFromFamily(spouse);
            }
        }

        for (int i = 0; i < curFamily.Kids.Count; i++)
        {
            var kid = Family.FindPerson(curFamily.Kids[i]);
            kid.transform.SetParent(newHome.transform);

            var temp = kid.MyId;
            newFam.AddKids(temp);

            curFamily.RemovePersonFromFamily(kid);
            i--;
        }
    }