コード例 #1
0
 public bool RemovePerk(StandardPerk effect)
 {
     if (perks.ContainsKey(effect.GetType()) && ReferenceEquals(perks[effect.GetType()], effect))
     {
         effect.Deactivate();
         return(perks.Remove(effect.GetType()));
     }
     return(false);
 }
コード例 #2
0
        //adds a new perk to the collection. returns false if the character already has an instance of this perk type.
        public bool AddPerk(StandardPerk perkBase)
        {
            Type type = perkBase.GetType();

            if (perks.ContainsKey(type))
            {
                return(false);
            }
            else
            {
                perks.Add(type, perkBase);
                perkBase.Activate(source);
                return(true);
            }
        }