Ejemplo n.º 1
0
 internal static void ApplyDamage(IDamageable first, IDamageable second)
 {
     KeyValuePair<Type, Type> pair = new KeyValuePair<Type, Type>(first.GetType(), second.GetType());
     if (damages.ContainsKey(pair))
     {
         KeyValuePair<int, int> damage = damages[pair];
         bool firstKilled = first.ApplyDamage(damage.Key);
         bool secondKilled = second.ApplyDamage(damage.Value);
         if (firstKilled)
             MessageDispatcher.Post(new Kill(first));
         if (secondKilled)
             MessageDispatcher.Post(new Kill(second));
     }
 }