Inheritance: IDisposable
示例#1
0
 /// <summary>
 /// Adds a personality effect to the batch.
 /// Personality effects will change the first impression that new relationships get seeded with.
 /// </summary>
 /// <param name="target">The person whose personality should change.</param>
 /// <param name="t">The trait of the personality that should change.</param>
 /// <param name="amount">How much the specified trait should change.</param>
 public void AddPersonalityEffect(Person target, Trait t, double amount)
 {
     Applied += delegate(object sender, RelationshipChangeEventArgs r)
     {
         Dictionary<Trait, double> qual = r.Relationship.Other.Qualities;
         if (!qual.ContainsKey(t))
             qual.Add(t, 0);
         qual[t] += amount;
     };
 }
示例#2
0
        internal Relationship(Person owner, Person other)
        {
            this.Owner = owner;
            this.Other = other;

            Random rnd = new Random();

            foreach (Trait t in Trait.All)
                Trait_NewTrait(t, new EventArgs());

            foreach (KeyValuePair<Trait, double> kvp in other.Qualities)
                Affect(kvp.Key, kvp.Value);

            Trait.NewTrait += new EventHandler<EventArgs>(Trait_NewTrait);
        }
示例#3
0
 /// <summary>
 /// "Introduces" the person to someone else, creating a new relationship
 /// and populating it with the other person's qualities.
 /// </summary>
 /// <param name="p">The person to introduce</param>
 /// <returns>A new relationship</returns>
 public Relationship Introduce(Person p)
 {
     Relationship r = new Relationship(this, p);
     relationships.Add(r);
     return r;
 }