public void OnTriggerEnter(Collider collider)
        {
            PersonIdentifier identifier = collider.GetComponentInChildren <PersonIdentifier>();

            if (identifier != null)
            {
                person.Trigger(TriggerType.PersonCollision);
                int rand = PRNG.GetNumber(0, 100);
                if (rand < 15 && identifier.person.GetType() == typeof(Walker) && person.GetType() == typeof(Walker))
                {
                    Talker t1 = new Talker(person);
                    Talker t2 = new Talker(identifier.person);
                    t1.TalksTo = t2;
                    t2.TalksTo = t1;
                    PersonManager.INSTANCE.UpdatePerson(person, t1);
                    PersonManager.INSTANCE.UpdatePerson(identifier.person, t2);
                    SetEditorValues();
                    identifier.SetEditorValues();
                    t1.Trigger(TriggerType.PersonStartTalking);
                }
            }
            else
            {
                person.Trigger(TriggerType.Collision);
            }
        }
Exemplo n.º 2
0
        public void UpdatePerson(Person original, Person newPerson)
        {
            int index = people.FindIndex(x => x == original);

            if (index != -1)
            {
                people[index] = newPerson;
                PersonIdentifier pi = people[index].GameObject.GetComponent <PersonIdentifier>();
                pi.Person = newPerson;
                pi.SetEditorValues();
            }
        }