예제 #1
0
    void Update()
    {
        if (m_unListRoleHitted != null)
        {
            print("攻击到的人的个数:" + m_unListRoleHitted.Count);
            PkmodelAdmin.RefreshList(m_unListRoleHitted, HittedisProfession);/*, HittedisProfessionByRedname*/
            if (m_unListRoleHitted != null)
            {
                int lockId = -1;
                if (SelfRole._inst.m_LockRole != null && m_unListRoleHitted.Contains(SelfRole._inst.m_LockRole.m_unIID))
                {
                    lockId = (int)SelfRole._inst.m_LockRole.m_unIID;
                }
                //if(m_unListRoleHitted.Count<=0)
                //{
                //    print("空的");
                //}
                //else
                //{
                //    for (int i = 0; i < m_unListRoleHitted.Count; i++)
                //    {
                //        print("发送的iid是多少:" + m_unListRoleHitted[i]);
                //    }
                //}

                BattleProxy.getInstance().sendcast_target_skill(m_unSkillID, m_unListRoleHitted, m_nLastHit, lockId);
                m_unListRoleHitted = null;
                HittedisProfession = null;
                //HittedisProfessionByRedname = null;
            }
        }
    }
    static public void FrameMove(float fdt)
    {
        List <uint> need_del = new List <uint>();

        foreach (OneFollowBlt p in m_mapFollowBullet.Values)
        {
            try
            {
                float t = p.costtime / p.maxtime;
                p.costtime += fdt;
                if (t > 1f)
                {
                    if (p.aniTrack != null)
                    {
                        p.aniTrack.speed = 0;
                    }
                    if (p.aniFx != null)
                    {
                        p.aniFx.SetTrigger(EnumAni.ANI_T_FXDEAD);
                    }

                    GameObject.Destroy(p.blt_hd.m_hdRootObj, 1f);

                    need_del.Add(p.id);
                    if (p.locker is MonsterRole)
                    {
                        MonsterRole mr = p.locker as MonsterRole;
                        if (mr.isfake)
                        {
                            mr.onHurt(p.blt_hd);
                        }
                        else
                        {
                            //如果是主角,请求服务器
                            if (p.blt_hd.m_CastRole == SelfRole._inst)
                            {
                                List <uint> list_hitted = new List <uint>();
                                list_hitted.Add(mr.m_unIID);

                                int lockid = -1;
                                if (SelfRole._inst.m_LockRole != null && SelfRole._inst.m_LockRole.m_unIID == mr.m_unIID)
                                {
                                    lockid = (int)SelfRole._inst.m_LockRole.m_unIID;
                                }

                                BattleProxy.getInstance().sendcast_target_skill(p.blt_hd.m_unSkillID, list_hitted, 0, lockid);
                                list_hitted = null;
                            }
                        }
                    }
                }
                else
                {
                    Vector3 t_pos = p.locker.m_curModel.position;
                    t_pos.y += 1.5f;
                    Vector3 pos = p.beginpos + (t_pos - p.beginpos) * t;
                    p.blt_hd.m_hdRootObj.transform.position = pos;
                }
            }
            catch (System.Exception ex)
            {
                need_del.Add(p.id);
                break;
            }
        }

        for (int i = 0; i < need_del.Count; i++)
        {
            m_mapFollowBullet.Remove(need_del[i]);
        }
    }