Ejemplo n.º 1
0
        /// <summary>
        /// buff结束后移除战斗状态
        /// </summary>
        public static void BattleStateChangeEnd(Buff buff, Buff.BuffInfo buff_info)
        {
            if (buff == null || buff_info == null)
            {
                return;
            }

            Actor actor = buff.Target_P;

            if (actor != null)
            {
                actor.GetBehavior <BattleStateBehavior>().RemoveBattleState(buff_info.battle_effect_type);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// buff开始时进行变身
        /// </summary>
        /// <param name="buff"></param>
        /// <param name="type_id"></param>
        public static void ShapeShiftBegin(Buff buff, Buff.BuffInfo buff_info)
        {
            if (buff == null || buff_info == null)
            {
                return;
            }

            if (buff.ShiftExcept)
            {
                return;
            }

            Actor actor = buff.Target_P;

            if (actor != null)
            {
                actor.mAvatarCtrl.ShapeShift(true, buff_info.shape_shift, buff_info.shift_state);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加buff, kCasterID为技能释放者的id
        /// lifeTime 为服务端的剩余时间
        /// </summary>
        public Buff AddBuff(uint buff_id, float life_time, uint layer = 1)
        {
            Buff.BuffInfo buff_info = DBManager.GetInstance().GetDB <DBBuffSev>().GetBuffInfo(buff_id) as Buff.BuffInfo;
            if (buff_info == null)
            {
                GameDebug.LogError(string.Format("使用了不存在的Buff: {0}", buff_id));
                return(null);
            }

            bool shiftExcept = false;

            // 同时只能存在一个变身buff
            if (buff_info.shape_shift != 0)
            {
                using (var iter = mBuffMap.GetEnumerator())
                {
                    while (iter.MoveNext())
                    {
                        var cur  = iter.Current;
                        var buff = cur.Value;

                        if (buff.OwnBuffInfo.buff_id != buff_id && buff.OwnBuffInfo.shape_shift != 0 && !buff.ShiftExcept)
                        {
                            shiftExcept = true;
                            break;
                        }
                    }
                }
            }

            Buff cur_buff;

            if (mBuffMap.TryGetValue(buff_info.buff_id, out cur_buff))
            {
                cur_buff.ShiftExcept = shiftExcept;

                if (cur_buff.NeedDel)// 如果原有buff将要销毁, 则用新buff参数进行重设
                {
                    cur_buff.Reset(buff_info, life_time, layer);
                }
                else
                {
                    cur_buff.ResetTime(life_time, layer);// 需要重设所有相同buff的时间
                }
            }
            else
            {
                cur_buff = Buff.Construct(this, buff_info, life_time, layer, shiftExcept);
                if (cur_buff != null)
                {
                    mBuffMap.Add(cur_buff.m_BuffId, cur_buff);
                }
            }

            if (mOwner.IsLocalPlayer)
            {
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_BUFF_UPDATE, null);
            }

            return(cur_buff);
        }