Exemplo n.º 1
0
    public void OnTriggerEnter(Collider other)
    {
        debug.Log("和其他玩家 发生 碰撞 " + other.name);
        //if (!m_otherRole.canbehurt)
        //    return;

        HitData hd = other.gameObject.GetComponent <HitData>();

        if (hd == null)
        {
            return;
        }
        if (hd.m_haveHittedList.Contains(m_otherRole.m_unIID))
        {
            return;
        }
        else
        {
            hd.m_haveHittedList.Add(m_otherRole.m_unIID);
        }

        if (OtherPlayerMgr._inst.m_mapOtherPlayer[m_otherRole.m_unIID].zhuan >= 1)
        {
            if (CanHited(m_otherRole, hd))
            {
                //临时处理只碰一次
                other.enabled = false;

                if (hd.m_unSkillID == 3003)
                {//冰雨技能攻击到时播放dead2的特效
                    hd.HitAndStop(EnumAni.ANI_T_FXDEAD1);
                }
                else if (hd.m_unSkillID == 3006)
                {//陨石可穿过模型
                }
                else
                {
                    //停止动画
                    hd.HitAndStop();
                }

                //if (hd.m_bNeedKill)
                //{
                //    GameObject.Destroy(other.gameObject);
                //}

                //播放死亡
                //GameObject.Destroy(other.gameObject);
                if (hd.m_CastRole == SelfRole._inst)
                {
                    hd.AddHittedRole(m_otherRole.m_unIID, true);
                }
                else
                {
                    m_otherRole.onHurt(hd);
                }

                m_otherRole.ShowHurtFX(hd.m_nHurtFX);
            }
        }
    }
Exemplo n.º 2
0
    public void OnTriggerEnter(Collider other)
    {
        HitData hd = other.gameObject.GetComponent <HitData>();

        if (hd == null)
        {
            return;
        }
        if (hd.m_haveHittedList.Contains(m_selfRole.m_unIID))
        {
            return;
        }
        else
        {
            hd.m_haveHittedList.Add(m_selfRole.m_unIID);
        }

        if (PlayerModel.getInstance().up_lvl >= 1)
        {
            if (CanHited(m_selfRole, hd))
            {
                //临时处理只碰一次
                if (hd.m_bOnlyHit)
                {
                    other.enabled = false;
                }

                if (hd.m_unSkillID == 3003)
                {//冰雨技能攻击到时播放dead2的特效
                    hd.HitAndStop(EnumAni.ANI_T_FXDEAD1);
                }
                else if (hd.m_unSkillID == 3006)
                {//陨石可穿过模型
                }
                else
                {
                    //停止动画
                    hd.HitAndStop();
                }

                if (hd.m_CastRole != null && hd.m_CastRole.isfake)
                {
                    m_selfRole.onHurt(hd);
                }

                //主角自己受到的伤害让服务器下发好了,自己不用去关心
                //m_selfRole.onHurt(hd);
                m_selfRole.ShowHurtFX(hd.m_nHurtFX);


                //if (hd.m_bNeedKill)
                //{
                //    GameObject.Destroy(other.gameObject);
                //}
                //播放死亡
                //GameObject.Destroy(other.gameObject);

                //显示迎战的ui
                if (!hd.m_CastRole.m_isMain && hd.m_CastRole is ProfessionRole && PlayerModel.getInstance().now_pkState == 0)//PlayerModel.getInstance().now_pkState == 0 && hd.m_CastRole is ProfessionRole && PlayerModel.getInstance().now_nameState==0
                {
                    if (!hd.m_CastRole.isDead || hd.m_CastRole != null || !m_selfRole.isDead)
                    {
                        a3_expbar.instance.ShowAgainst(hd.m_CastRole);
                    }
                }

                //我非全体模式时,打我的人是我的团员或者对友,飘字提示
                if (PlayerModel.getInstance().now_pkState != 1 && !hd.m_CastRole.m_isMain && hd.m_CastRole is ProfessionRole)
                {
                    if ((TeamProxy.getInstance().MyTeamData != null && TeamProxy.getInstance().MyTeamData.IsInMyTeam(hd.m_CastRole.roleName)) ||
                        (PlayerModel.getInstance().clanid != 0 && PlayerModel.getInstance().clanid == hd.m_CastRole.m_unLegionID))
                    {
                        flytxt.instance.fly(ContMgr.getCont("a3_pkmodel"));
                    }
                }
            }
        }
    }