示例#1
0
    /// <summary>
    /// Removes the bu ji bao. playerSt == 0 -> hit TerrainLayer,
    /// playerSt == 1 -> PlayerOne, playerSt == 2 -> PlayerTwo.
    /// playerSt == 3 -> PlayerThree, playerSt == 4 -> PlayerFour.
    /// </summary>
    /// <param name="key">Key.</param>
    public void RemoveBuJiBao(PlayerEnum playerSt, int keyHit = 0)
    {
        if (IsDeath)
        {
            return;
        }
        IsDeath = true;
        CancelInvoke("DelayDestroyBuJiBao");
        if (playerSt != PlayerEnum.Null || keyHit == 1)
        {
            //XKGlobalData.GetInstance().PlayAudioHitBuJiBao();
            if (ExplodeObj != null)
            {
                GameObject obj = (GameObject)Instantiate(ExplodeObj, transform.position, transform.rotation);
                XkGameCtrl.CheckObjDestroyThisTimed(obj);
            }

            if (Network.peerType != NetworkPeerType.Server)
            {
                bool isMoveDaoJu = true;
                switch (BuJiBao)
                {
                case BuJiBaoType.FenShuDJ:
                    isMoveDaoJu = false;
                    XKPlayerFenShuCtrl.GetInstance().ShowPlayerFenShu(playerSt, FenShuVal);
                    break;

                case BuJiBaoType.JiSuDJ:
                    //isMoveDaoJu = false;
                    XKPlayerMoveCtrl.SetPlayerJiSuMoveSpeed(playerSt);
                    XKPlayerMoveCtrl.SetPlayerJiSuState(playerSt);
                    XKPlayerJiSuCtrl.GetInstance().ShowPlayerJiSu(playerSt);
                    break;

                case BuJiBaoType.YiLiaoBaoDJ:
                    isMoveDaoJu = false;
                    XkGameCtrl.AddPlayerHealth(playerSt, XKDaoJuGlobalDt.GetInstance().YiLiaoBaoXueLiangVal);
                    XKPlayerJiJiuBaoCtrl.GetInstance().ShowPlayerJiJiuBao(playerSt);
                    break;

                case BuJiBaoType.ShuangBeiFenShuDJ:
                    //isMoveDaoJu = false;
                    //XKDaoJuGlobalDt.SetTimeFenShuBeiLv(playerSt, FenShuBeiLv);
                    XKDaoJuGlobalDt.SetTimeFenShuBeiLv(playerSt, 2);
                    XKFenShuBeiLvCtrl.GetInstance().ShowPlayerFenShuBeiLv(playerSt);
                    break;

                case BuJiBaoType.QianHouFireDJ:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerQianHouFire(playerSt);
                    break;

                case BuJiBaoType.ChangChengJiQiang:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerChangChengFire(playerSt);
                    break;

                case BuJiBaoType.SanDanJiQiang:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerJiQiangSanDanFire(playerSt);
                    break;

                case BuJiBaoType.QiangJiJiQiang:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerQiangJiFire(playerSt);
                    break;

                case BuJiBaoType.PaiJiPaoDJ:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerIsPaiJiPaoFire(playerSt);
                    break;

                case BuJiBaoType.ZhuPaoSanDanDJ:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerIsSanDanZPFire(playerSt);
                    break;

                case BuJiBaoType.HuoLiAllOpenDJ:
                    //isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerIsHuoLiAllOpen(playerSt);
                    XKPlayerHuoLiAllOpenCtrl.GetInstance().ShowPlayerHuoLiOpen(playerSt);
                    break;

                case BuJiBaoType.ChuanTouDan:
                    isMoveDaoJu = false;
                    XKPlayerAutoFire.GetInstanceAutoFire(playerSt).SetAmmoStateZhuPao(PlayerAmmoType.ChuanTouAmmo);
                    break;

                case BuJiBaoType.DaoDan:
                case BuJiBaoType.GaoBaoDan:
                case BuJiBaoType.SanDan:
                case BuJiBaoType.GenZongDan:
                case BuJiBaoType.JianSuDan:
                case BuJiBaoType.NLHuDun:
                    isMoveDaoJu = false;
                    break;
                }

                if (isMoveDaoJu)
                {
                    DaoJuCtrl.GetInstance().MoveDaoJuObjToPlayer(playerSt, transform);
                }
            }
        }
        DestroyNetObj(gameObject);
    }
    /// <summary>
    /// Removes the bu ji bao. playerSt == 0 -> hit TerrainLayer,
    /// playerSt == 1 -> PlayerOne, playerSt == 2 -> PlayerTwo.
    /// playerSt == 3 -> PlayerThree, playerSt == 4 -> PlayerFour.
    /// </summary>
    /// <param name="key">Key.</param>
    public void RemoveBuJiBao(PlayerEnum playerSt, int keyHit = 0)
    {
        if (IsDeath)
        {
            return;
        }
        IsDeath = true;
        CancelInvoke("DelayDestroyBuJiBao");
        if (playerSt != PlayerEnum.Null || keyHit == 1)
        {
            //XKGlobalData.GetInstance().PlayAudioHitBuJiBao();
            if (ExplodeObj != null)
            {
                GameObject obj = (GameObject)Instantiate(ExplodeObj, transform.position, transform.rotation);
                if (obj != null)
                {
                    obj.transform.SetParent(XkGameCtrl.PlayerAmmoArray);
                }

                XkGameCtrl.CheckObjDestroyThisTimed(obj);
                if (obj != null && IsCaiPiaoDaoJu)
                {
                    if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null)
                    {
                        int value = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetPrintCaiPiaoValueByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.SuiJiDaoJu, DaoJuType);
                        SSCaiPiaoLiZiManage caiPiaoLiZi = obj.GetComponent <SSCaiPiaoLiZiManage>();
                        if (caiPiaoLiZi != null)
                        {
                            caiPiaoLiZi.ShowNumUI(value, playerSt);
                        }
                        else
                        {
                            Debug.LogWarning("CreatLiZi -> caiPiaoLiZi was null.................");
                        }
                    }

                    if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null)
                    {
                        //初始化飞出的彩票逻辑.
                        XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitCaiPiaoFly(obj.transform.position, playerSt, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.SuiJiDaoJu);
                    }
                    else
                    {
                        Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............");
                    }
                }
            }

            if (Network.peerType != NetworkPeerType.Server)
            {
                bool isMoveDaoJu = true;
                switch (BuJiBao)
                {
                case BuJiBaoType.FenShuDJ:
                    isMoveDaoJu = false;
                    XKPlayerFenShuCtrl.GetInstance().ShowPlayerFenShu(playerSt, FenShuVal);
                    break;

                case BuJiBaoType.JiSuDJ:
                    //isMoveDaoJu = false;
                    XKPlayerMoveCtrl.SetPlayerJiSuMoveSpeed(playerSt);
                    XKPlayerMoveCtrl.SetPlayerJiSuState(playerSt);
                    XKPlayerJiSuCtrl.GetInstance().ShowPlayerJiSu(playerSt);
                    break;

                case BuJiBaoType.YiLiaoBaoDJ:
                    isMoveDaoJu = false;
                    XkGameCtrl.AddPlayerHealth(playerSt, XKDaoJuGlobalDt.GetInstance().YiLiaoBaoXueLiangVal);
                    XKPlayerJiJiuBaoCtrl.GetInstance().ShowPlayerJiJiuBao(playerSt);
                    break;

                case BuJiBaoType.ShuangBeiFenShuDJ:
                    isMoveDaoJu = false;
                    //XKDaoJuGlobalDt.SetTimeFenShuBeiLv(playerSt, FenShuBeiLv);
                    //XKDaoJuGlobalDt.SetTimeFenShuBeiLv(playerSt, 2);
                    //XKFenShuBeiLvCtrl.GetInstance().ShowPlayerFenShuBeiLv(playerSt);
                    break;

                case BuJiBaoType.QianHouFireDJ:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerQianHouFire(playerSt);
                    break;

                case BuJiBaoType.ChangChengJiQiang:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerChangChengFire(playerSt);
                    break;

                case BuJiBaoType.SanDanJiQiang:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerJiQiangSanDanFire(playerSt);
                    break;

                case BuJiBaoType.QiangJiJiQiang:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerQiangJiFire(playerSt);
                    break;

                case BuJiBaoType.PaiJiPaoDJ:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerIsPaiJiPaoFire(playerSt);
                    break;

                case BuJiBaoType.ZhuPaoSanDanDJ:
                    isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerIsSanDanZPFire(playerSt);
                    break;

                case BuJiBaoType.HuoLiAllOpenDJ:
                    //isMoveDaoJu = false;
                    XKDaoJuGlobalDt.SetPlayerIsHuoLiAllOpen(playerSt);
                    XKPlayerHuoLiAllOpenCtrl.GetInstance().ShowPlayerHuoLiOpen(playerSt);
                    break;

                case BuJiBaoType.ChuanTouDan:
                    isMoveDaoJu = false;
                    XKPlayerAutoFire.GetInstanceAutoFire(playerSt).SetAmmoStateZhuPao(PlayerAmmoType.ChuanTouAmmo);
                    break;

                case BuJiBaoType.DaoDan:
                case BuJiBaoType.GaoBaoDan:
                case BuJiBaoType.SanDan:
                case BuJiBaoType.GenZongDan:
                case BuJiBaoType.JianSuDan:
                case BuJiBaoType.NLHuDun:
                    isMoveDaoJu = false;
                    break;
                }

                if (isMoveDaoJu)
                {
                    DaoJuCtrl.GetInstance().MoveDaoJuObjToPlayer(playerSt, transform);
                }
            }
        }
        DestroyNetObj(gameObject);
    }