Пример #1
0
        /*已经通过接口实现*/
        // 更新为加载事件统一处理
        public static void addBuff(ref List <BuffAdder> list_adder, CBuffContain container, Chess ch, ChessContainer chc, string dancer_key)
        {
//             {
//                 Buff new_buff = new Buff();
//                 //new_buff.my_buff_info.id = buff_id;
//                 new_buff.my_buff_info = Data.Inst.buff_data[buff_id];
//                 c.my_buffs.Add(new_buff);
//             }
            BuffAdder[] adds = new BuffAdder[list_adder.Count];
            list_adder.CopyTo(adds);
            list_adder.Clear();

            List <Buff> my_buffs = container.getBuffList();

            //异步添加BUFF
            foreach (BuffAdder buff_id in adds)
            {
                //做法修改后不再需要判断重复
                //             if (my_buffs.ContainsKey(buff_id))
                //             {
                //                 Debug.Log("加buff失败,找不到buff,ID:" + buff_id);
                //                 return;
                //             } else if (!my_buffs.ContainsKey(buff_id))
                {
                    Buff new_buff = new Buff();
                    new_buff.stand_side   = buff_id.from;
                    new_buff.my_buff_info = Data.Inst.buff_data[buff_id.id];
                    new_buff.my_Duration  = new_buff.my_buff_info.duration;
                    my_buffs.Add(new_buff);
                    new_buff.owner_ch  = ch;
                    new_buff.owner_chc = chc;
                    new_buff.owner     = container;

                    BuffContrllor.analyseBuff_Effect(new_buff, eBuffEvent.Buff_Add);
                    BK_AnimEvts av = BKTools.addVFX_Dancer(new_buff.my_buff_info.start_vfx);
                    if (av)
                    {
                        av.transform.position = container.getContainer().transform.position;
                    }
                    // 持续特效
                    if (new_buff.my_buff_info.effect == eBuff_Effect.Halo)
                    {
                        GameObject obj = BKTools.addVFX(PrefabPath.VFX_Buff_Prefix + new_buff.my_buff_info.duration_vfx + ".prefab");
                        if (obj)
                        {
                            obj.transform.SetParent(container.transform, true);
                            new_buff.vfx_duration.Add(obj);                                //暂时仅对halo有效
                            obj.transform.localPosition = Vector3.forward * 0.2f;
                        }
                    }
                    else
                    {
                        container.playNextVFX();
                    }
                }
                Main.Inst.redDancer(dancer_key);
            }
        }
Пример #2
0
 virtual public void AddBuff(BuffAdder adder)
 {
     //异步添加
     list_buffs_add.Add(adder);
     Main.Inst.addDancer("cc_buff_adder");
 }