Ejemplo n.º 1
0
 public Buff(BuffData data, BuffManager manager, object caster, object ability)
 {
     mBehaviours = SequenceManager.CreateMultipleDynamic();
     mBuffData   = data;
     mCaster     = caster;
     mAbility    = ability;
     mManager    = manager;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 检查是否已经存在同一个Buff
 /// </summary>
 /// <param name="template"></param>
 /// <returns></returns>
 public Buff Find(BuffData template)
 {
     for (int i = mBuffs.Count - 1; i >= 0; i--)
     {
         var buff = mBuffs[i];
         if (buff.mBuffData == template)
         {
             return(buff);
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 此时还未添加到 mBuffs 容器
        /// </summary>
        /// <param name="bufferId"></param>
        /// <param name="caster"></param>
        /// <param name="ability"></param>
        /// <returns></returns>
        public bool CreateBuff(int bufferId, object caster, object ability)
        {
            // 获取Buff配置信息
            BuffData data = BuffData.Get(bufferId);

            DebugUtils.Assert(data != null, "bufferId " + bufferId);
            // 被免疫,不添加
            if (IsImmune(data.BuffTag))
            {
                return(false);
            }
            // Buff实例化
            Buff buff = new Buff(data, this, caster, ability);

            OnBuffAwake?.Invoke(buff);
            return(true);
        }