Exemplo n.º 1
0
    public void OnTriggerEnter(Collider other)
    {
        Debug.Log("和其他玩家 发生 碰撞 " + other.name);
        HitData component = other.gameObject.GetComponent <HitData>();
        bool    flag      = component == null;

        if (!flag)
        {
            bool flag2 = component.m_haveHittedList.Contains(this.m_otherRole.m_unIID);
            if (!flag2)
            {
                component.m_haveHittedList.Add(this.m_otherRole.m_unIID);
                bool flag3 = OtherPlayerMgr._inst.m_mapOtherPlayer[this.m_otherRole.m_unIID].zhuan >= 1;
                if (flag3)
                {
                    bool flag4 = base.CanHited(this.m_otherRole, component);
                    if (flag4)
                    {
                        other.enabled = false;
                        bool flag5 = component.m_unSkillID == 3003u;
                        if (flag5)
                        {
                            component.HitAndStop(EnumAni.ANI_T_FXDEAD1, false);
                        }
                        else
                        {
                            bool flag6 = component.m_unSkillID == 3006u;
                            if (!flag6)
                            {
                                component.HitAndStop(-1, false);
                            }
                        }
                        bool flag7 = component.m_CastRole == SelfRole._inst;
                        if (flag7)
                        {
                            component.AddHittedRole(this.m_otherRole.m_unIID, true);
                        }
                        else
                        {
                            this.m_otherRole.onHurt(component);
                        }
                        this.m_otherRole.ShowHurtFX(component.m_nHurtFX);
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    private void MonsterHurtEffectWork(Collider other, HitData hd)
    {
        bool flag = !this.m_monRole.isfake;

        if (flag)
        {
            hd.m_nDamage = 0;
        }
        bool flag2 = hd.m_CastRole == SelfRole._inst && !this.m_monRole.isfake;

        if (flag2)
        {
            bool flag3 = hd.AddHittedRole(this.m_monRole.m_unIID, false);
            if (flag3)
            {
                this.m_monRole.setHitFlash(hd);
                bool flag4 = hd.m_nHurtFX > 0 && hd.m_nHurtFX < 10;
                if (flag4)
                {
                    bool flag5 = hd.m_nHurtFX == 6;
                    if (flag5)
                    {
                        Vector3 zero = Vector3.zero;
                        zero.y += this.m_monRole.headOffset.y;
                        GameObject gameObject = UnityEngine.Object.Instantiate(SceneTFX.m_HFX_Prefabs[hd.m_nHurtFX], zero, this.m_monRole.m_curModel.rotation) as GameObject;
                        gameObject.transform.SetParent(this.m_monRole.m_curModel, false);
                        UnityEngine.Object.Destroy(gameObject, 2f);
                    }
                    else
                    {
                        GameObject gameObject2 = UnityEngine.Object.Instantiate(SceneTFX.m_HFX_Prefabs[hd.m_nHurtFX], this.m_monRole.m_curModel.position, this.m_monRole.m_curModel.rotation) as GameObject;
                        gameObject2.transform.SetParent(U3DAPI.FX_POOL_TF, false);
                        UnityEngine.Object.Destroy(gameObject2, 2f);
                    }
                }
                this.m_monRole.PlayHurtFront();
            }
        }
        else
        {
            this.m_monRole.onHurt(hd);
        }
        bool bOnlyHit = hd.m_bOnlyHit;

        if (bOnlyHit)
        {
            other.enabled = false;
        }
        bool flag6 = hd.m_unSkillID == 3003u;

        if (flag6)
        {
            hd.HitAndStop(EnumAni.ANI_T_FXDEAD1, false);
        }
        else
        {
            bool flag7 = hd.m_unSkillID == 3006u;
            if (!flag7)
            {
                hd.HitAndStop(-1, false);
            }
        }
        bool flag8 = hd.m_nHurtSP_type > 0;

        if (flag8)
        {
            bool flag9 = hd.m_nHurtSP_pow > this.m_monRole.m_nSPWeight * 3;
            if (flag9)
            {
                this.m_monRole.m_nSPLevel = 3;
            }
            else
            {
                bool flag10 = hd.m_nHurtSP_pow > this.m_monRole.m_nSPWeight * 2;
                if (flag10)
                {
                    this.m_monRole.m_nSPLevel = 2;
                }
                else
                {
                    bool flag11 = hd.m_nHurtSP_pow > this.m_monRole.m_nSPWeight;
                    if (flag11)
                    {
                        this.m_monRole.m_nSPLevel = 1;
                    }
                    else
                    {
                        this.m_monRole.m_nSPLevel = 0;
                    }
                }
            }
            bool flag12 = this.m_monRole.m_nSPLevel > 0;
            if (flag12)
            {
                bool flag13 = !this.m_monRole.isBoos;
                if (flag13)
                {
                    bool flag14 = 1 == hd.m_nHurtSP_type || 13 == hd.m_nHurtSP_type;
                    if (flag14)
                    {
                        this.m_monRole.m_fSkillSPup_Value = 0.25f;
                        this.m_monRole.m_nSkillSP_up      = 1;
                    }
                    bool flag15 = 11 == hd.m_nHurtSP_type || 13 == hd.m_nHurtSP_type;
                    if (flag15)
                    {
                        this.m_monRole.m_fSkillSPfb_Value = 0.1f;
                        this.m_monRole.m_nSkillSP_fb      = 1;
                        this.m_monRole.m_vSkillSP_dir     = hd.m_CastRole.m_curModel.forward;
                    }
                    bool flag16 = 12 == hd.m_nHurtSP_type || 14 == hd.m_nHurtSP_type;
                    if (flag16)
                    {
                        this.m_monRole.m_fSkillSPfb_Value = 2.5f;
                        this.m_monRole.m_nSkillSP_fb      = -41;
                        this.m_monRole.m_vSkillSP_dir     = hd.m_nHurtSP_pos;
                    }
                    bool flag17 = 21 == hd.m_nHurtSP_type;
                    if (flag17)
                    {
                        this.m_monRole.m_fSkillSPfb_Value = 0.5f;
                        this.m_monRole.m_nSkillSP_fb      = -21;
                        this.m_monRole.m_vSkillSP_dir     = hd.m_CastRole.m_curModel.position;
                    }
                    bool flag18 = 31 == hd.m_nHurtSP_type;
                    if (flag18)
                    {
                        this.m_monRole.setHitFlash(hd);
                        this.m_monRole.m_fSkillSPfb_Value = 2.5f;
                        this.m_monRole.m_nSkillSP_fb      = -31;
                        this.m_monRole.m_vSkillSP_dir     = hd.m_CastRole.m_curModel.position;
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    private void MonsterHurtEffectWork(Collider other, HitData hd)
    {
        if (!m_monRole.isfake)
        {
            hd.m_nDamage = 0;
        }
        if (hd.m_CastRole == SelfRole._inst && !m_monRole.isfake)
        {
            if (hd.AddHittedRole(m_monRole.m_unIID, false))
            {
                m_monRole.setHitFlash(hd);
                //播放受击特效
                if (hd.m_nHurtFX > 0 && hd.m_nHurtFX < 10)
                {
                    if (hd.m_nHurtFX == 6)
                    {//受击为击退和眩晕时特效特殊处理
                        Vector3 pos = Vector3.zero;
                        pos.y = pos.y + m_monRole.headOffset.y;
                        GameObject fx_inst = GameObject.Instantiate(SceneTFX.m_HFX_Prefabs[hd.m_nHurtFX], pos, m_monRole.m_curModel.rotation) as GameObject;
                        fx_inst.transform.SetParent(m_monRole.m_curModel, false);
                        GameObject.Destroy(fx_inst, 2f);
                    }
                    else
                    {
                        GameObject fx_inst = GameObject.Instantiate(SceneTFX.m_HFX_Prefabs[hd.m_nHurtFX], m_monRole.m_curModel.position, m_monRole.m_curModel.rotation) as GameObject;
                        fx_inst.transform.SetParent(U3DAPI.FX_POOL_TF, false);
                        GameObject.Destroy(fx_inst, 2f);
                    }
                }
                m_monRole.PlayHurtFront();
            }
        }
        else
        {
            m_monRole.onHurt(hd);
        }
        #region 其它处理
        if (hd.m_bOnlyHit) //临时处理只碰一次
        {
            other.enabled = false;
        }
        if (hd.m_unSkillID == 3003) //冰雨技能攻击到怪物时播放dead2的特效
        {
            hd.HitAndStop(EnumAni.ANI_T_FXDEAD1);
        }
        #region 陨石处理
        else if (hd.m_unSkillID == 3006)
        {//陨石可穿过模型
        }
        #endregion
        else //停止动画
        {
            hd.HitAndStop();
        }
        #region
        //if (hd.m_nHurtSP_type == 11)
        //{
        //    m_monRole.m_curModel.position = hd.m_CastRole.m_curModel.position + hd.m_CastRole.m_curModel.forward * 2f;
        //}
        //else
        //{
        //    //m_monRole.m_fSkillSPTime = 0.25f;
        //}
        #endregion
        if (hd.m_nHurtSP_type > 0)
        {
            if (hd.m_nHurtSP_pow > m_monRole.m_nSPWeight * 3)
            {
                m_monRole.m_nSPLevel = 3;
            }
            else if (hd.m_nHurtSP_pow > m_monRole.m_nSPWeight * 2)
            {
                m_monRole.m_nSPLevel = 2;
            }
            else if (hd.m_nHurtSP_pow > m_monRole.m_nSPWeight)
            {
                m_monRole.m_nSPLevel = 1;
            }
            else
            {
                m_monRole.m_nSPLevel = 0;
            }

            if (m_monRole.m_nSPLevel > 0)
            {
                if (!m_monRole.isBoss_c)
                {
                    if (1 == hd.m_nHurtSP_type ||
                        13 == hd.m_nHurtSP_type)
                    {
                        m_monRole.m_fSkillSPup_Value = 0.25f; //时间
                                                              //m_monRole.m_fSkillSPup_Keep = 0.125f;
                        m_monRole.m_nSkillSP_up = 1;
                    }
                    if (11 == hd.m_nHurtSP_type || 13 == hd.m_nHurtSP_type) //击退
                    {
                        m_monRole.m_fSkillSPfb_Value = 0.1f;                //时间
                        m_monRole.m_nSkillSP_fb      = 1;
                        m_monRole.m_vSkillSP_dir     = hd.m_CastRole.m_curModel.forward;
                    }
                    if (12 == hd.m_nHurtSP_type || 14 == hd.m_nHurtSP_type) //拉近
                    {
                        m_monRole.m_fSkillSPfb_Value = 2.5f;                //时间
                        m_monRole.m_nSkillSP_fb      = -41;
                        m_monRole.m_vSkillSP_dir     = hd.m_nHurtSP_pos;
                        //m_monRole.m_vSkillSP_dir = hd.m_CastRole.m_curModel.position;
                    }
                    if (21 == hd.m_nHurtSP_type)             //拉动
                    {
                        m_monRole.m_fSkillSPfb_Value = 0.5f; //时间
                        m_monRole.m_nSkillSP_fb      = -21;
                        m_monRole.m_vSkillSP_dir     = hd.m_CastRole.m_curModel.position;
                    }
                    if (31 == hd.m_nHurtSP_type) //冰冻
                    {
                        m_monRole.setHitFlash(hd);
                        m_monRole.m_fSkillSPfb_Value = 2.5f; //时间
                        m_monRole.m_nSkillSP_fb      = -31;
                        m_monRole.m_vSkillSP_dir     = hd.m_CastRole.m_curModel.position;
                    }
                }
            }
        }
        #region 击倒处理
        //if (hurtFakeRole)
        //{
        //    Vector3 from = transform.forward;
        //    Vector3 to = hd.m_vBornerPos - transform.position;
        //    float fangle = Vector3.Angle(from, to);

        //    if (fangle > 90f)
        //    {
        //        if (hd.m_nHitType > 1000) //1000以上表示击倒
        //        {
        //            m_monRole.PlayFallBack();
        //        }
        //        else
        //        {
        //            m_monRole.PlayHurtBack();
        //        }
        //    }
        //    else
        //    {
        //        if (hd.m_nHitType > 1000) //1000以上表示击倒
        //        {
        //            m_monRole.PlayFallFront();
        //        }
        //        else
        //        {
        //            m_monRole.PlayHurtFront();
        //        }
        //    }

        //    m_monRole.onHurt(hd);



        //}
        #endregion
        #endregion
    }
Exemplo n.º 4
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);
            }
        }
    }