Пример #1
0
 /// <summary>
 /// Method for giving player buff
 /// </summary>
 /// <param name="name">name of buff</param>
 public void GetBuff(string name)
 {
     if (!buffs.ContainsKey(name))
     {
         BasePlayerBuff newBuff = MVUtility.CreatePlayerBuff(name, this);
         buffs.Add(newBuff.name, newBuff);
     }
 }
Пример #2
0
        /// <summary>
        /// Create new buff for player
        /// </summary>
        /// <param name="name">name of buff class</param>
        /// <param name="host">the host</param>
        /// <returns>created buff</returns>
        public static BasePlayerBuff CreatePlayerBuff(string name, Player host)
        {
            Type t = Type.GetType(name, false);

            if (t == null)
            {
                return(null);
            }
            BasePlayerBuff newPlayerBuff = (BasePlayerBuff)Activator.CreateInstance(t);

            newPlayerBuff.host = host;
            newPlayerBuff.SetDefault();
            return(newPlayerBuff);
        }