Ejemplo n.º 1
0
    public Person CreatePerson(Person parentA, Person parentB, string name = null, Sprite avatar = null, Person.Sexe sexe = Person.Sexe.MALE)
    {
        GameObject g = Instantiate(personGameObject, Vector3.zero, Quaternion.identity) as GameObject;

        Person person = g.GetComponent <Person>();

        person.parentA = parentA;
        person.parentB = parentB;

        person.family = RandomFamily();

        person.sexe = sexe;
        if (name == null)
        {
            person.personName = RandomNames.PickName(person.sexe);
        }
        else
        {
            person.personName = name;
        }
        if (avatar == null)
        {
            person.avatar = avatars.RandomAvatar(person.sexe);
        }
        else
        {
            person.avatar = avatar;
        }
        person.naissance = GameController.instance.annee;

        return(person);
    }
Ejemplo n.º 2
0
    public Person RandomPerson(Person parentA, Person parentB)
    {
        /*GameObject g = Instantiate(personGameObject, Vector3.zero, Quaternion.identity) as GameObject;
         *
         * Person person = g.GetComponent<Person>();
         * person.parentA = parentA;
         * person.parentB = parentB;
         *
         * person.sexe = RandomSexe();
         * person.personName = RandomNames.PickName(person.sexe);
         * person.avatar = avatars.RandomAvatar(person.sexe);
         *
         * if (parentA != null)
         * {
         *  person.naissance = parentA.naissance + Random.Range(18, 40);
         * }
         */
        Person.Sexe sexe = RandomSexe();

        Person person = CreatePerson(parentA, parentB, RandomNames.PickName(sexe), avatars.RandomAvatar(sexe), sexe);

        return(person);
    }