void Update()
    {
        if (m_GameNumUI != null && IsInitCaiPiaoAni)
        {
            if (Time.time - TimeLastCaiPiaoAni <= TimeCaiPiaoAni)
            {
                m_GameNumUI.ShowNumUI(UnityEngine.Random.Range(m_MinCaiPiaoNumAni, m_MaxCaiPiaoNumAni));
            }
            else
            {
                UnityLog("SSCaiPiaoInfo::CloseCaiPiaoAnimation -> indexPlayer == " + IndexPlayer
                         + ", time == " + Time.time);
                //结束彩票数字动画.
                IsInitCaiPiaoAni = false;
                if (SSUIRoot.GetInstance().m_GameUIManage != null)
                {
                    int indexVal = (int)IndexPlayer - 1;
                    if (SSUIRoot.GetInstance().m_GameUIManage)
                    {
                        //显示玩家当前彩票数据信息.
                        int caiPiao      = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoVal;
                        int caiPiaoCache = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoValCache;
                        //m_GameNumUI.ShowNumUI(caiPiao + caiPiaoCache);
                        if (SSUIRoot.GetInstance().m_GameUIManage != null)
                        {
                            //显示玩家彩票数量.
                            SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(IndexPlayer, caiPiao + caiPiaoCache, false, true);
                        }
                    }
                }

                if (m_AniAudio != null)
                {
                    m_AniAudio.Stop();
                    m_AniAudio.enabled = false;
                }
            }
        }
    }
Esempio n. 2
0
    void HiddenGameOverObj()
    {
        if (!GameOverObj.activeSelf)
        {
            return;
        }
        CancelInvoke("HiddenGameOverObj");
        GameOverObj.SetActive(false);
#if NOT_SHOW_DAOJISHI_UI //不显示倒计时UI.
        if (XkGameCtrl.PlayerActiveNum <= 0)
        {
            //没有激活一个玩家.
            XkGameCtrl.GetInstance().OpenAllAiPlayerTank();
        }
#else
        if (XkGameCtrl.PlayerActiveNum <= 0)
        {
            //没有激活一个玩家.
            bool isDisplay = GetIsHaveDaoJiShiDisplaying();
            if (isDisplay == false)
            {
                XkGameCtrl.GetInstance().OpenAllAiPlayerTank();
            }
        }
#endif

        //游戏倒计时结束后清空玩家所得彩票数(代金券)
        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
        {
            XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.ClearPlayerCaiPiaoData(PlayerIndex);
        }

        CoinPlayerCtrl playerCoinCom = CoinPlayerCtrl.GetInstance(PlayerIndex);
        if (playerCoinCom != null)
        {
            playerCoinCom.SetActiveMianFeiTiYanUI(false);
        }
    }
    void CheckDisGameCamera()
    {
        if (m_FanWeiHou == null)
        {
            m_FanWeiHou = XKPlayerMvFanWei.GetInstanceHou();
        }

        if (DeathExplodePoint == null)
        {
            DeathExplodePoint = transform;
        }

        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
        {
            GameCameraTr = XkPlayerCtrl.GetInstanceFeiJi().transform;
        }

        if (GameCameraTr == null)
        {
            Debug.LogWarning("Unity:" + "CheckDisGameCamera -> GameCameraTr is null");
            return;
        }

        Vector3 vecA = GameCameraTr.forward;
        Vector3 vecB = Vector3.zero;
        Vector3 posA = DeathExplodePoint.position;
        Vector3 posB = GameCameraTr.position;

        posA.y = posB.y = 0f;
        vecB   = posA - posB;
        vecA.y = vecB.y = 0f;
        if (Vector3.Dot(vecA, vecB) <= 0f)
        {
            return;
        }
        DisCamera = MinDisCamera;
        //Debug.Log("Unity:"+"DisCamera "+DisCamera);
    }
Esempio n. 4
0
    void ChangeStartTimeUI()
    {
        TimeCount++;
        if (TimeCount >= TimeTexture.Length)
        {
            Debug.Log("Unity:" + "ChangeStartTimeUI -> change over!");
            if (m_TiShiUI != null)
            {
                Destroy(m_TiShiUI);
            }
            gameObject.SetActive(false);
            ScreenDanHeiCtrl.GetInstance().ActiveGameUiCamera();
            XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
            GameTimeCtrl.GetInstance().ActiveIsCheckTimeSprite();
            //添加咪咕电视游戏包月检测事件.
            pcvr.GetInstance().DelayQueryMiGuTVGameBaoYueStata();
            return;
        }

        //Debug.Log("Unity:"+"ChangeStartTimeUI -> TimeCount "+TimeCount);
        StartTimeTexture.mainTexture = TimeTexture[TimeCount];
        PlayStartTimeUI();
    }
Esempio n. 5
0
    public void ActiveGameUiCamera()
    {
        if (!XkGameCtrl.GetInstance().IsCartoonShootTest &&
            !XkGameCtrl.GetInstance().IsServerCameraTest)
        {
            if (Network.peerType != NetworkPeerType.Server)
            {
                GameUiCamera.enabled = true;
            }
        }
        StartCameraObj.SetActive(false);
        ScreenDanHeiObj.SetActive(false);

        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
        {
            XkPlayerCtrl.GetInstanceFeiJi().OpenPlayerMoveAudio();
        }

        if (XkPlayerCtrl.GetInstanceTanKe() != null)
        {
            XkPlayerCtrl.GetInstanceTanKe().OpenPlayerMoveAudio();
        }
    }
Esempio n. 6
0
    /// <summary>
    /// 创建粒子.
    /// </summary>
    public void CreatLiZi(PlayerEnum indexPlayer)
    {
        if (m_LiZiPrefab == null)
        {
            UnityLogWarning("CreatLiZi -> m_LiZiPrefab was null......");
            return;
        }

        GameObject obj = (GameObject)Instantiate(m_LiZiPrefab, XkGameCtrl.NpcAmmoArray, transform);

        if (obj != null)
        {
            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, indexPlayer);
                }
                else
                {
                    UnityLogWarning("CreatLiZi -> caiPiaoLiZi was null.................");
                }
            }

            if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null)
            {
                //初始化飞出的彩票逻辑.
                XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitCaiPiaoFly(transform.position, indexPlayer, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.SuiJiDaoJu);
            }
            else
            {
                UnityLogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............");
            }
        }
    }
    void ChangeStartTimeUI()
    {
        TimeCount++;
        if (TimeCount >= TimeTexture.Length)
        {
            Debug.Log("Unity:" + "ChangeStartTimeUI -> change over!");
            //if (m_TiShiUI != null)
            //{
            //    Destroy(m_TiShiUI);
            //}
            gameObject.SetActive(false);
            ScreenDanHeiCtrl.GetInstance().ActiveGameUiCamera();
            XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
            if (GameTimeCtrl.GetInstance() != null)
            {
                GameTimeCtrl.GetInstance().ActiveIsCheckTimeSprite();
            }
            return;
        }

        //Debug.Log("Unity:"+"ChangeStartTimeUI -> TimeCount "+TimeCount);
        StartTimeTexture.mainTexture = TimeTexture[TimeCount];
        PlayStartTimeUI();
    }
    /// <summary>
    /// 缺票后重新开始打印彩票.
    /// </summary>
    internal void RestartPrintCaiPiao(PlayerEnum indexPlayer)
    {
        if (bIsHardWare && mPcvrTXManage != null)
        {
            int indexVal = (int)indexPlayer;
            if (indexVal < 1 || indexVal > 3)
            {
                Debug.LogWarning("StartPrintPlayerCaiPiao -> indexVal was wrong! indexVal ==== " + indexVal);
                return;
            }

            pcvrTXManage.CaiPiaoJi indexCaiPiaoJi = (pcvrTXManage.CaiPiaoJi)(indexVal - 1);
            if (mPcvrTXManage.GetIsCanPrintCaiPiao(indexCaiPiaoJi) == true)
            {
                pcvrTXManage.CaiPiaoPrintCmd cmd = pcvrTXManage.CaiPiaoPrintCmd.BanPiaoPrint;
                if (XKGlobalData.GetInstance().m_CaiPiaoPrintState == XKGlobalData.CaiPiaoPrintState.QuanPiao)
                {
                    cmd = pcvrTXManage.CaiPiaoPrintCmd.QuanPiaoPrint;
                }
                int caiPiao = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.GetPlayerCaiPiaoVal(indexPlayer);
                mPcvrTXManage.SetCaiPiaoPrintCmd(cmd, indexCaiPiaoJi, caiPiao);
            }
        }
    }
Esempio n. 9
0
    /// <summary>
    /// 播放玩家当前打印彩票的数字缩放动画.
    /// </summary>
    void PlayCaiPiaoNumAnimationSuoFang()
    {
        if (IsPlayCaiPiaoNumAniSuoFang == true)
        {
            return;
        }
        IsPlayCaiPiaoNumAniSuoFang = true;

        //播放玩家当前打印彩票的数字缩放动画.
        if (SSUIRoot.GetInstance().m_GameUIManage != null)
        {
            int indexVal = (int)IndexPlayer - 1;
            if (indexVal >= 0 && indexVal <= 2)
            {
                //添加剩余彩票数.
                XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.AddCaiPiaoToPlayer(IndexPlayer, m_CardNumVal, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhengChang, false);

                int caiPiao      = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoVal;
                int caiPiaoCache = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PcvrPrintCaiPiaoData[indexVal].CaiPiaoValCache;
                //显示玩家彩票数量.
                SSUIRoot.GetInstance().m_GameUIManage.ShowPlayerCaiPiaoInfo(IndexPlayer, caiPiao + caiPiaoCache, true, true);
            }
        }
    }
    void OnTriggerFireAnimation()
    {
        //return; //test
        //Debug.Log("Unity:"+"OnTriggerFireAnimation**NpcName "+AnimatorCom.name);
        if (!XkGameCtrl.IsMoveOnPlayerDeath)
        {
            if (!XkGameCtrl.IsActivePlayerOne && !XkGameCtrl.IsActivePlayerTwo)
            {
                return;
            }
        }

        if ((JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()) ||
            GameOverCtrl.IsShowGameOver)
        {
            return;
        }

        if (XkGameCtrl.GetInstance().IsCreatAmmoOnBoss == false)
        {
            if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.GetIsHaveCaiPiaoBoss() == true &&
                Random.Range(0, 100) % 2 == 0)
            {
                //有彩票boss产生,不再继续发射子弹.
                return;
            }
        }

        //Debug.Log("************************11111 time " + Time.time);
        int rv = AddCountFireAction();

        if (rv != -1)
        {
            StartSpawnNpcAmmo();
        }
    }
Esempio n. 11
0
    /**
     * key == 1 -> 隐藏主角.
     */
    public void OpenScreenDanHui(int key = 0)
    {
        if (ScreenDanHeiObj.activeSelf)
        {
            return;
        }
        ScreenDanHeiObj.SetActive(true);

        if (DanHeiTweenAlpha != null)
        {
            DestroyObject(DanHeiTweenAlpha);
        }
        DanHeiTweenAlpha         = ScreenDanHeiObj.AddComponent <TweenAlpha>();
        DanHeiTweenAlpha.enabled = false;
        DanHeiTweenAlpha.from    = 1f;
        DanHeiTweenAlpha.to      = 0f;
        EventDelegate.Add(DanHeiTweenAlpha.onFinished, delegate {
            Invoke("HiddeScreenDanHeiObj", 0.1f);
        });
        DanHeiTweenAlpha.enabled = true;
        DanHeiTweenAlpha.PlayForward();
        switch (key)
        {
        case 1:
            if (XkPlayerCtrl.GetInstanceFeiJi() != null)
            {
                XkPlayerCtrl.GetInstanceFeiJi().HandlePlayerHiddenArray();
            }

            if (XkPlayerCtrl.GetInstanceTanKe() != null)
            {
                XkPlayerCtrl.GetInstanceTanKe().HandlePlayerHiddenArray();
            }
            break;
        }
    }
        /// <summary>
        /// 增加正常得彩数量.
        /// </summary>
        public void AddPlayerZhengChangDeCai(bool isPlayerXuBi)
        {
            int   deCaiVal               = 0;
            float xuBiChuPiaoLvTmp       = 1f;
            float zhengChangChuPiaoLvTmp = 0f;
            int   coinStart              = XKGlobalData.GetInstance().m_CoinToCard *XKGlobalData.GameNeedCoin;

            if (isPlayerXuBi)
            {
                xuBiChuPiaoLvTmp = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.XuBiChuPiaoLv;
            }
            zhengChangChuPiaoLvTmp = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.ZhengChangChuPiaoLv;
            XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.FenPeiDeCaiVal(isPlayerXuBi);

            deCaiVal         = (int)(coinStart * xuBiChuPiaoLvTmp * zhengChangChuPiaoLvTmp);
            ZhengChangDeCai += deCaiVal;
            Debug.Log("Unity: AddPlayerZhengChangDeCai -> ZhengChangDeCai ==== " + ZhengChangDeCai + ", indexPlayer == " + IndexPlayer);

            if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null)
            {
                //添加基础得彩数据.
                XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.AddPlayerJiChuCaiPiao(IndexPlayer, deCaiVal);
            }
        }
        /// <summary>
        /// 更新所有服务器配置数据.
        /// </summary>
        internal void UpdataAllServerConfigData()
        {
            //SSDebug.Log("UpdataAllServerConfigData...");
            if (XKGlobalData.GetInstance() != null)
            {
                //更新游戏弹幕信息.
                if (GameDanMuInfo.Length > 10)
                {
                    GameDanMuInfo = GameDanMuInfo.Substring(0, 10);
                }
                XKGlobalData.GetInstance().UpdateDanMuInfo(GameDanMuInfo);
            }

            if (XkPlayerCtrl.GetInstanceFeiJi() != null &&
                XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage != null &&
                XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null &&
                XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData != null)
            {
                //更新代金券奖池相关数据信息.
                SSCaiPiaoDataManage.GameCaiPiaoData gmCaiPiaoData = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData;
                float chuCaiLv = SuiJiDaoJuChuPiaoLv + ZhanCheChuPiaoLv_01 + ZhanCheChuPiaoLv_02 + JPBossChuPiaoLv;
                if (chuCaiLv > 1f)
                {
                    //出票率(返奖率)之和必须为1f.
                    JPBossChuPiaoLv     = 1f;
                    ZhanCheChuPiaoLv_01 = 0f;
                    ZhanCheChuPiaoLv_01 = 0f;
                    SuiJiDaoJuChuPiaoLv = 0f;
                }
                gmCaiPiaoData.UpdateChuPiaoLvInfo(SuiJiDaoJuChuPiaoLv, ZhanCheChuPiaoLv_01, ZhanCheChuPiaoLv_02, JPBossChuPiaoLv);
                gmCaiPiaoData.UpdateDaiJinQuanInfo(SuiJiDaoJuDaiJinQuan, ZhanCheDaiJinQuan_01, ZhanCheDaiJinQuan_02, JPBossDaiJinQuan);
                gmCaiPiaoData.UpdateDaiJinQuanCaiChiInfo(SuiJiDaoJuDeCai, ZhanCheDeCai_01, ZhanCheDeCai_02, JPBossDeCai);
                gmCaiPiaoData.UpdateJPBossDaiJinQuanShangHuZhiFu(JPBossDaiJinQuanShangHuZhiFu);

                if (XKGlobalData.GetInstance() != null)
                {
                    XKGlobalData.GetInstance().SetIsWuXianJiangChi(IsWuQiongDaJiangChiJPBossDaiJinQuan, SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.JPBossDaiJinQuan);
                    XKGlobalData.GetInstance().SetIsWuXianJiangChi(IsWuQiongDaJiangChiZhanCheDaiJinQuan_01, SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.ZhanCheDaiJinQuan_01);
                    XKGlobalData.GetInstance().SetIsWuXianJiangChi(IsWuQiongDaJiangChiZhanCheDaiJinQuan_02, SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.ZhanCheDaiJinQuan_02);
                    XKGlobalData.GetInstance().SetIsWuXianJiangChi(IsWuQiongDaJiangChiSuiJiDaoJuDaiJinQuan, SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.SuiJiDaoJuDaiJinQuan);
                }
            }

            if (pcvr.GetInstance().m_HongDDGamePadInterface != null)
            {
                //更新游戏免费试玩信息.
                pcvr.GetInstance().m_HongDDGamePadInterface.UpdateMianFeiCountInfo(MianFeiShiWanCount);
                XKGlobalData.GetInstance().SetMianFeiShiWanCount(MianFeiShiWanCount);

                //更新游戏一币等于多少人民币的信息.
                pcvr.GetInstance().m_HongDDGamePadInterface.UpdateGameCoinToMoney(GameCoinToMoney);
            }

            //设置游戏彩池返奖率信息.
            XKGlobalData.GetInstance().SetCaiChiFanJiangLv(CaiChiFanJiangLv);

            //设置游戏彩池爆奖率信息.
            XKGlobalData.GetInstance().SetCaiChiBaoJiangLv(SuiJiDaoJuBaoJiangLv, ZhanCheBaoJiangLv_01, ZhanCheBaoJiangLv_02, JPBossBaoJiangLv);
            if (SSHaiDiLaoBaoJiang.GetInstance() != null)
            {
                SSHaiDiLaoBaoJiang.GetInstance().UpdateBaoJiangDt(SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.JPBossDaiJinQuan, (int)JPBossBaoJiangLv);
                SSHaiDiLaoBaoJiang.GetInstance().UpdateBaoJiangDt(SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.ZhanCheDaiJinQuan_01, (int)ZhanCheBaoJiangLv_01);
                SSHaiDiLaoBaoJiang.GetInstance().UpdateBaoJiangDt(SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.ZhanCheDaiJinQuan_02, (int)ZhanCheBaoJiangLv_02);
                SSHaiDiLaoBaoJiang.GetInstance().UpdateBaoJiangDt(SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.SuiJiDaoJuDaiJinQuan, (int)SuiJiDaoJuBaoJiangLv);
            }
        }
    IEnumerator PlayPaoGuanAnimation()
    {
        CountPaoGuanAni++;
        if (CountPaoGuanAni > 1)
        {
            //Debug.LogWarning("Unity:"+"PlayPaoGuanAnimation -> CountPaoGuanAni "+CountPaoGuanAni);
            yield break;
        }

        int   count         = 0;
        int   maxCount      = 1;
        float speed         = PaoGuanZhenFu / maxCount;
        bool  isBackPaoGuan = false;
        bool  isFireAmmo    = false;

        IsPlayPaoGuanAnimation = true;
        do
        {
            if (IsDeathNpc || GameOverCtrl.IsShowGameOver)
            {
                yield break;
            }

            if (IsStopAnimation ||
                !IsDoFireAnimation ||
                Time.realtimeSinceStartup - TimeStartSpawn < TimeFireDelay ||
                (JiFenJieMianCtrl.GetInstance() && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()))
            {
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            if (XkGameCtrl.GetInstance().IsCreatAmmoOnBoss == false)
            {
                if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.GetIsHaveCaiPiaoBoss() == true)
                {
                    if (NpcMoveScript != null && NpcMoveScript.IsCaiPiaoZhanChe == true)
                    {
                    }
                    else
                    {
                        //有彩票boss产生,不再继续发射子弹.
                        yield return(new WaitForSeconds(0.1f));

                        continue;
                    }
                }
            }

            if (!isBackPaoGuan)
            {
                PaoGuan.position -= PaoGuan.forward * speed;
                count++;
                if (count >= maxCount)
                {
                    isBackPaoGuan = true;
                }

                if (count == 1 && !isFireAmmo)
                {
                    isFireAmmo = true;
                    PlayAudioCannonFire();

                    PlayerAmmoCtrl ammoPlayerScript = DaPaoAmmo.GetComponent <PlayerAmmoCtrl>();
                    if (ammoPlayerScript != null && !XkGameCtrl.GetInstance().IsCartoonShootTest)
                    {
                        yield break;
                    }

                    GameObject obj = GetNpcAmmoFromList(SpawnAmmoPoint[0]);
                    if (obj == null)
                    {
                        yield break;
                    }

                    NpcAmmoCtrl AmmoScript = obj.GetComponent <NpcAmmoCtrl>();
                    Transform   tran       = obj.transform;
                    tran.parent = XkGameCtrl.NpcAmmoArray;
                    if (AmmoScript != null)
                    {
                        AmmoScript.SetIsAimFeiJiPlayer(false);
                    }
                    else
                    {
                        PlayerAmmoCtrl ammoScript = obj.GetComponent <PlayerAmmoCtrl>();
                        if (ammoScript != null)
                        {
                            Vector3 startPos    = tran.position;
                            Vector3 firePos     = tran.position;
                            Vector3 ammoForward = tran.forward;
                            firePos = Random.Range(300f, 400f) * ammoForward + startPos;
                            float      fireDisVal = Vector3.Distance(firePos, startPos);
                            RaycastHit hit;
                            LayerMask  FireLayer = XkGameCtrl.GetInstance().PlayerAmmoHitLayer;
                            if (Physics.Raycast(startPos, ammoForward, out hit, fireDisVal, FireLayer.value))
                            {
                                //Debug.Log("Unity:"+"npc fire PlayerAmmo, fire obj -> "+hit.collider.name);
                                firePos = hit.point;
                                XKNpcHealthCtrl healthScript = hit.collider.GetComponent <XKNpcHealthCtrl>();
                                if (healthScript != null)
                                {
                                    healthScript.OnDamageNpc(ammoScript.DamageNpc, PlayerEnum.Null);
                                }

                                BuJiBaoCtrl buJiBaoScript = hit.collider.GetComponent <BuJiBaoCtrl>();
                                if (buJiBaoScript != null)
                                {
                                    buJiBaoScript.RemoveBuJiBao(PlayerEnum.Null);                                     //buJiBaoScript
                                }
                            }
                            ammoScript.StartMoveAmmo(firePos, PlayerEnum.Null, null, AmmoMovePath);
                        }
                    }

                    obj  = (GameObject)Instantiate(DaPaoAmmoLiZi, SpawnAmmoPoint[0].position, SpawnAmmoPoint[0].rotation);
                    tran = obj.transform;
                    XkGameCtrl.CheckObjDestroyThisTimed(obj);
                    tran.parent = SpawnAmmoPoint[0];
                }
            }
            else
            {
                PaoGuan.position += PaoGuan.forward * speed;
                count--;
                if (count <= 0)
                {
                    IsPlayPaoGuanAnimation = false;
                    isBackPaoGuan          = false;
                    isFireAmmo             = false;
                    count = 0;

                    yield return(new WaitForSeconds(TimeDanGuanFire));

                    IsPlayPaoGuanAnimation = true;
                    continue;
                }
            }
            yield return(new WaitForSeconds(PaoGuanShenSuoSD));
        } while (true);
    }
Esempio n. 15
0
    void OnSreenAlphaToMax()
    {
        GameMode modeVal = XkGameCtrl.GameModeVal;

        Debug.Log("OnSreenAlphaToMax -> GameMode " + modeVal);

        bool isClearCartoonNpc = true;

        if (!XKTriggerOpenPlayerUI.IsActiveOpenPlayerUI)
        {
            XKPlayerCamera.GetInstanceCartoon().SetActiveCamera(false);
        }

        switch (modeVal)
        {
        case GameMode.DanJiFeiJi:
            XkPlayerCtrl.GetInstanceFeiJi().MakePlayerFlyToPathMark();
            break;

        case GameMode.DanJiTanKe:
            XkPlayerCtrl.GetInstanceTanKe().MakePlayerFlyToPathMark();
            break;

        case GameMode.LianJi:
            if (XkPlayerCtrl.GetInstanceFeiJi() != null)
            {
                XkPlayerCtrl.GetInstanceFeiJi().MakePlayerFlyToPathMark();
            }

            if (XkPlayerCtrl.GetInstanceTanKe() != null)
            {
                XkPlayerCtrl.GetInstanceTanKe().MakePlayerFlyToPathMark();
            }

            if (Network.peerType != NetworkPeerType.Disconnected)
            {
                isClearCartoonNpc = false;
            }

            if (Network.peerType == NetworkPeerType.Client)
            {
                NetCtrl.GetInstance().SendSetScreenDanHeiIsStartGame();
            }
            break;
        }
        DestroyObject(DanHeiTweenAlpha);
        DanHeiTweenAlpha         = ScreenDanHeiObj.AddComponent <TweenAlpha>();
        DanHeiTweenAlpha.enabled = false;
        DanHeiTweenAlpha.from    = 1f;
        DanHeiTweenAlpha.to      = 0f;
        EventDelegate.Add(DanHeiTweenAlpha.onFinished, delegate {
            Invoke("OnSreenAlphaToMin", 0.2f);
        });
        DanHeiTweenAlpha.enabled = true;
        DanHeiTweenAlpha.PlayForward();

        if (isClearCartoonNpc)
        {
            XkGameCtrl.ClearCartoonSpawnNpc();
        }

        if (Network.peerType != NetworkPeerType.Server)
        {
            IsStartGame = true;
        }
        Time.timeScale = 1.0f;
        switch (modeVal)
        {
        case GameMode.DanJiFeiJi:
            XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
            break;

        case GameMode.DanJiTanKe:
            XkPlayerCtrl.GetInstanceTanKe().RestartMovePlayer();
            break;

        case GameMode.LianJi:
            if (Network.peerType != NetworkPeerType.Server)
            {
                if (Network.peerType != NetworkPeerType.Client)
                {
                    if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                    {
                        XkPlayerCtrl.GetInstanceFeiJi().RestartMovePlayer();
                    }

                    if (XkPlayerCtrl.GetInstanceTanKe() != null)
                    {
                        XkPlayerCtrl.GetInstanceTanKe().RestartMovePlayer();
                    }
                    XKCameraMapCtrl.GetInstance().SetCameraMapState();                     //test
                }
                else
                {
                    //SendServerMovePlayer
                    NetCtrl.GetInstance().SetScreenDanHieStartMovePlayer();
                }
            }
            else
            {
                AddStartMovePlayerCount();
            }
            break;
        }
    }
    public void OnDamageNpc(int damageNpcVal         = 1,
                            PlayerEnum playerSt      = PlayerEnum.Null,
                            PlayerAmmoType pAmmoType = PlayerAmmoType.Null,
                            bool isAiFireAmmo        = false)
    {
        if (IsDeathNpc)
        {
            return;
        }

        if (pAmmoType == PlayerAmmoType.SanDanAmmo)
        {
            if (Time.time - TimeSanDanDamage < XKPlayerGlobalDt.GetInstance().TimeShouDongDaoDan)
            {
                //对于玩家的主炮散弹在同一次发射内只计算一次伤害.
                //SSDebug.LogWarning("************* pAmmoType ====== " + pAmmoType);
                return;
            }
            TimeSanDanDamage = Time.time;
        }

        if (pAmmoType == PlayerAmmoType.ChuanTouAmmo)
        {
            if (XKPlayerMvFanWei.GetInstanceQian() != null && XKPlayerCamera.GetInstanceFeiJi() != null)
            {
                Vector3 forwardVecCam = XKPlayerCamera.GetInstanceFeiJi().transform.forward;
                Vector3 posA          = transform.position;
                Vector3 posB          = XKPlayerMvFanWei.GetInstanceQian().transform.position;
                forwardVecCam.y = posA.y = posB.y = 0f;
                Vector3 vecBA = posA - posB;
                if (Vector3.Dot(forwardVecCam, vecBA) >= 0f)
                {
                    //npc在镜头前方范围之外,不受玩家子弹伤害.
                    return;
                }
            }
        }

        if (IsBackDaiJinQuanNpcBlood == true)
        {
            //代金券npc重置血值后,给一定时间的无敌状态.
            if (Time.time - m_TimeLastBackDaiJinQuanNpcBlood <= 0.5f)
            {
                return;
            }
            else
            {
                IsBackDaiJinQuanNpcBlood = false;
            }
        }

        //switch (NpcJiFen)
        //{
        //    case NpcJiFenEnum.Boss:
        //        if (!XKBossXueTiaoCtrl.GetInstance().GetIsCanSubXueTiaoAmount())
        //        {
        //            if (NpcDamageCom != null)
        //            {
        //                NpcDamageCom.PlayNpcDamageEvent();
        //            }
        //            return;
        //        }
        //        break;
        //}


        if (NpcDamageCom != null)
        {
            NpcDamageCom.PlayNpcDamageEvent();
        }

        if (NpcScript != null)
        {
            if (NpcScript.IsCaiPiaoZhanChe == true && NpcScript.IsEnterCameraBox == false)
            {
                //彩票战车和boss没有进入摄像机盒子,不计算伤害.
                return;
            }
        }

        if (CountActivePlayer != XkGameCtrl.PlayerActiveNum)
        {
            if (CountActivePlayer != 0)
            {
                //fix PuTongAmmoCount.
                int indexValTmp      = CountActivePlayer - 1;
                int puTongAmmoNumTmp = MaxPuTongAmmo[indexValTmp];
                indexValTmp = XkGameCtrl.PlayerActiveNum - 1;
                if (indexValTmp >= 0)
                {
                    float healthPer = (float)PuTongAmmoCount / puTongAmmoNumTmp;
                    //int oldPuTongAmmoCount = PuTongAmmoCount;
                    PuTongAmmoCount = (int)(healthPer * MaxPuTongAmmo[indexValTmp]);

                    /*Debug.Log("Unity:"+"fix npc health -> PuTongAmmoCount "+PuTongAmmoCount
                     +", oldPuTongAmmoCount "+oldPuTongAmmoCount);*/
                }
            }
            CountActivePlayer = XkGameCtrl.PlayerActiveNum;
        }

        if (NpcScript == null || (NpcScript != null && !NpcScript.GetIsWuDi()))
        {
            PuTongAmmoCount += damageNpcVal;
        }

        int indexVal = XkGameCtrl.PlayerActiveNum - 1;

        indexVal = indexVal < 0 ? 0 : indexVal;
        int puTongAmmoNum = MaxPuTongAmmo[indexVal];

        if (NpcScript != null)
        {
            if (NpcScript.IsZhanCheNpc || NpcScript.IsJPBossNpc)
            {
                if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                {
                    //当没有玩家激活游戏时,彩票战车和JPBoss采用原血量的一定比例来计算.
                    puTongAmmoNum = (int)(XkGameCtrl.GetInstance().m_ZhanCheBossBloodPer *puTongAmmoNum);
                }
            }
        }

        /*if (NpcJiFen == NpcJiFenEnum.Boss)
         * {
         *              float bossAmount = (float)(puTongAmmoNum - PuTongAmmoCount) / puTongAmmoNum;
         *              bossAmount = bossAmount < 0f ? 0f : bossAmount;
         *  if (XKBossXueTiaoCtrl.GetInstance() != null)
         *  {
         *      XKBossXueTiaoCtrl.GetInstance().SetBloodBossAmount(bossAmount, this);
         *  }
         *      }*/

        if (NpcScript != null)
        {
            if (NpcScript.IsCaiPiaoZhanChe == true)
            {
                if (XkGameCtrl.GetInstance() != null && XKPlayerFenShuCtrl.GetInstance() != null)
                {
                    if (pAmmoType == PlayerAmmoType.DaoDanAmmo ||
                        pAmmoType == PlayerAmmoType.PaiJiPaoAmmo ||
                        pAmmoType == PlayerAmmoType.ChuanTouAmmo ||
                        pAmmoType == PlayerAmmoType.SanDanAmmo ||
                        pAmmoType == PlayerAmmoType.ChongJiBoAmmo)
                    {
                        int jiFenVal = XkGameCtrl.GetInstance().m_DaoDanHitBossJiFen;
                        //XKPlayerFenShuCtrl.GetInstance().ShowPlayerFenShu(playerSt, GetJiFen(jiFenVal));
                        XKPlayerFenShuCtrl.GetInstance().ShowPlayerFenShu(playerSt, jiFenVal);
                    }
                }

                float bloodAmount = (float)(puTongAmmoNum - PuTongAmmoCount) / puTongAmmoNum;
                bloodAmount = bloodAmount < 0f ? 0f : bloodAmount;

                bool isCanJiBao = true;
                if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                {
                    //没有玩家激活游戏时,Ai都认为是可以击爆战车或Boss.
                }
                else
                {
                    //有玩家激活游戏.
                    if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null)
                    {
                        isCanJiBao = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_CurrentTotalHealthDt.IsCanJiBao;
                    }
                }

                if (isCanJiBao == false)
                {
                    //不允许被玩家击爆的代金券npc.
                    if (IsBloodToStage02 == false)
                    {
                        if (bloodAmount <= 0.24f)
                        {
                            //强制保留一定的血量.
                            m_BloodAmoutValue      = bloodAmount = 0.24f;
                            IsBloodToStage02       = true;
                            m_TimeLastBloodToStage = Time.time;
                            PuTongAmmoCount        = puTongAmmoNum - 1;
                        }
                    }
                    else if (IsBloodToStage01 == false)
                    {
                        float minBloodAmount = 0.12f; //最小极限血值.
                        if (m_BloodAmoutValue > minBloodAmount)
                        {
                            //血值已经降到最低阶段.
                            float dTimeVal = 0.4f;
                            if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null)
                            {
                                dTimeVal = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_TimeNoDead;
                            }

                            if (Time.time - m_TimeLastBloodToStage >= dTimeVal)
                            {
                                //每次间隔一定时间减少一定血值.
                                m_TimeLastBloodToStage = Time.time;
                                float subBloodAmount = 0.02f; //每次减少的血值.
                                if (m_BloodAmoutValue > minBloodAmount)
                                {
                                    m_BloodAmoutValue -= subBloodAmount;
                                    if (m_BloodAmoutValue < minBloodAmount)
                                    {
                                        //强制保护的血值信息.
                                        m_BloodAmoutValue = minBloodAmount;
                                        IsBloodToStage01  = true;
                                    }
                                }
                            }
                        }
                        bloodAmount     = m_BloodAmoutValue;
                        PuTongAmmoCount = puTongAmmoNum - 1; //强制保留一定的血值.
                    }
                    else
                    {
                        float minBloodAmount = 0.03f; //最小极限血值.
                        if (m_BloodAmoutValue > minBloodAmount)
                        {
                            //血值已经降到最低阶段.
                            float dTimeVal = 0.4f;
                            if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null)
                            {
                                dTimeVal = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.m_TimeNoDead;
                            }

                            if (Time.time - m_TimeLastBloodToStage >= dTimeVal)
                            {
                                //每次间隔一定时间减少一定血值.
                                m_TimeLastBloodToStage = Time.time;
                                float subBloodAmount = 0.01f; //每次减少的血值.
                                if (m_BloodAmoutValue > minBloodAmount)
                                {
                                    m_BloodAmoutValue -= subBloodAmount;
                                    if (m_BloodAmoutValue < minBloodAmount)
                                    {
                                        //强制保护的血值信息.
                                        m_BloodAmoutValue = minBloodAmount;
                                    }
                                }
                            }
                        }
                        bloodAmount     = m_BloodAmoutValue;
                        PuTongAmmoCount = puTongAmmoNum - 1; //强制保留一定的血值.
                    }
                }

                //彩票战车和boss的血条UI信息更新.
                SSUIRoot.GetInstance().m_GameUIManage.SetDaiJinQuanNpcXueTiaoAmount(bloodAmount);

                if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                {
                    //没有玩家激活游戏时,Ai都认为是不可以击爆JPBoss特殊武器的.
                }
                else
                {
                    //JPBoss受到玩家子弹伤害.
                    if (NpcScript.IsJPBossNpc == true)
                    {
                        NpcScript.OnDamageJPBossWeapon(bloodAmount);
                    }
                }
            }
        }

        /*Debug.Log("Unity:"+"OnDamageNpc -> "
         +", nameNpc "+NpcNameInfo
         +", puTongAmmoNum "+puTongAmmoNum);*/
        if (PuTongAmmoCount >= puTongAmmoNum)
        {
            if (NpcScript != null)
            {
                if (NpcScript.IsZhanCheNpc)
                {
                    //战车npc是否可以被击爆的判断.
                    if (XkGameCtrl.GetInstance().IsCaiPiaoHuLuePlayerIndex == false && NpcScript.m_IndexPlayerJiBao != playerSt)
                    {
                        //不是可以击爆战车npc的玩家.
                        return;
                    }

                    if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                    {
                        //没有激活任何玩家.
                    }
                    else
                    {
                        if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe, NpcScript.m_DaiJinQuanState))
                        {
                            //战车彩池的彩票积累的不够.
                            return;
                        }
                    }
                }

                if (NpcScript.IsJPBossNpc)
                {
                    //JPBoss是否可以被击爆的判断.
                    if (XkGameCtrl.GetInstance().IsCaiPiaoHuLuePlayerIndex == false && NpcScript.m_IndexPlayerJiBao != playerSt)
                    {
                        //不是可以击爆JPBoss的玩家.
                        return;
                    }

                    if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                    {
                        //没有激活任何玩家.
                    }
                    else
                    {
                        if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss))
                        {
                            //JPBoss彩池的彩票积累的不够.
                            return;
                        }
                    }
                }
            }

            if (IsDeathNpc)
            {
                return;
            }
            IsDeathNpc = true;

            if (IsOpenCameraShake)
            {
                XKPlayerCamera.GetInstanceFeiJi().HandlePlayerCameraShake();
            }

            if (NpcJiFen == NpcJiFenEnum.Boss && BossXieZiScript != null)
            {
                BossXieZiScript.ResetBossXieZiShouBiInfo();
            }

            if (BoxColCom != null)
            {
                BoxColCom.enabled = false;
            }
            CheckSpawnDaoJuCom(playerSt);
            CheckNpcDeathExplode(playerSt);
            CheckHiddenNpcObjArray();

//			bool isAddKillNpcNum = true;
//			if (NpcScript != null && CannonScript != null) {
//				if (NpcScript.GetIsDeathNPC()) {
//					isAddKillNpcNum = false;
//					Debug.Log("Unity:"+"name "+NpcScript.name+", isAddKillNpcNum "+isAddKillNpcNum);
//				}
//			}

            if (!IsYouTongNpc)
            {
                switch (NpcJiFen)
                {
                case NpcJiFenEnum.Boss:
                    if (GameTimeBossCtrl.GetInstance() != null &&
                        GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0)
                    {
                        XkGameCtrl.GetInstance().AddPlayerKillNpc(PlayerEnum.Null, NpcJiFen, GetJiFen());
                    }
                    break;

                default:
                    XkGameCtrl.GetInstance().AddPlayerKillNpc(playerSt, NpcJiFen, GetJiFen());
                    ShowPiaoFen(playerSt);
                    break;
                }
//				if (isAddKillNpcNum) {
//					switch (NpcJiFen) {
//					case NpcJiFenEnum.Boss:
//						if (GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0) {
//							XkGameCtrl.GetInstance().AddPlayerKillNpc(PlayerEnum.Null, NpcJiFen, JiFenVal);
//						}
//						break;
//					default:
//						XkGameCtrl.GetInstance().AddPlayerKillNpc(playerSt, NpcJiFen, JiFenVal);
//						break;
//					}
//				}
            }
            else
            {
                CheckYouTongDamageNpc();
            }

            if (NpcScript != null)
            {
                if (CannonScript != null)
                {
                    CannonScript.OnRemoveCannon(playerSt, 1);
                }

                if (NpcJiFen != NpcJiFenEnum.Boss && NpcScript.GetIsBossNpc())
                {
                    return;
                }
                NpcScript.TriggerRemovePointNpc(1, CannonScript, pAmmoType);

                if (NpcScript.IsCaiPiaoZhanChe)
                {
                    SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe;
                    //彩票boss或战车npc.
                    if (NpcScript.GetIsBossNpc())
                    {
                        deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss;
                    }
                    else
                    {
                        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                        {
                            XkPlayerCtrl.GetInstanceFeiJi().AddGetZhanCheDaiJinQuanPlayer(XKPlayerMoveCtrl.GetInstance(playerSt));
                        }
                    }

                    if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null)
                    {
                        if (isAiFireAmmo == false)
                        {
                            //只有被玩家击爆的代金券npc才允许出彩.
                            XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.SubGameDeCaiValByDeCaiState(playerSt, deCaiType,
                                                                                                                                               SSCaiPiaoDataManage.SuiJiDaoJuState.BaoXiang, NpcScript.m_DaiJinQuanState);
                        }
                        //else
                        //{
                        //被Ai坦克击爆的代金券npc不允许出彩.
                        //SSDebug.Log("The DaiJinQuan was killed by AiTank");
                        //}
                    }
                }
                else
                {
                    //普通npc被击杀.
                    //if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null && DeathExplodePoint != null)
                    //{
                    //    //随机送出正常得彩.
                    //    XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.CheckPlayerSongPiaoInfo(playerSt, DeathExplodePoint.position);
                    //}
                }
            }
            else if (CannonScript != null)
            {
                CannonScript.OnRemoveCannon(playerSt, 1);
                //炮台类npc被击杀.
                //if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null && DeathExplodePoint != null)
                //{
                //    //随机送出正常得彩.
                //    XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.CheckPlayerSongPiaoInfo(playerSt, DeathExplodePoint.position);
                //}
            }
        }
    }
    IEnumerator SpawnDuoPaoAmmo()
    {
        CountPaoGuanAni++;
        if (CountPaoGuanAni > 1)
        {
            //Debug.LogWarning("Unity:"+"PlayPaoGuanAnimation -> CountPaoGuanAni "+CountPaoGuanAni);
            yield break;
        }

        if (!IsDouGuanDaPao)
        {
            yield break;
        }

        int countMax = SpawnAmmoPoint.Length;
        int count    = countMax;

        do
        {
            if (IsDeathNpc || GameOverCtrl.IsShowGameOver)
            {
                //Debug.Log("Unity:"+this.name+" -> IsDeathNpc "+IsDeathNpc
                //          +", IsShowGameOver "+GameOverCtrl.IsShowGameOver);
                yield break;
            }

            if (!IsDoFireAnimation ||
                IsStopAnimation ||
                Time.realtimeSinceStartup - TimeStartSpawn < TimeFireDelay ||
                (JiFenJieMianCtrl.GetInstance() && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()))
            {
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            if (IsJPBossTeShuWeapon == true)
            {
                //JPBoss的特殊武器.
                if (IsActiveJPBossTeShuWeapon == false)
                {
                    //JPBoss的特殊武器没有激活.
                    yield return(new WaitForSeconds(0.1f));

                    continue;
                }
            }

            if (XkGameCtrl.GetInstance().IsCreatAmmoOnBoss == false)
            {
                if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.GetIsHaveCaiPiaoBoss() == true)
                {
                    if (NpcMoveScript != null && NpcMoveScript.IsCaiPiaoZhanChe == true)
                    {
                    }
                    else
                    {
                        //有彩票boss产生,不再继续发射子弹.
                        yield return(new WaitForSeconds(0.1f));

                        continue;
                    }
                }
            }

            count--;
            if (count < 0 || count >= SpawnAmmoPoint.Length)
            {
                yield break;
            }

            PlayAudioCannonFire();
            GameObject obj = GetNpcAmmoFromList(SpawnAmmoPoint[count]);
            if (obj == null)
            {
                Debug.Log("Unity:" + this.name + " is not find ammo!");
                yield break;
            }

            //if (IsJPBossTeShuWeapon == true)
            //{
            //    if (NpcMoveScript != null && NpcMoveScript.IsJPBossNpc)
            //    {
            //        SSDebug.LogWarning("SpawnDuoPaoAmmo........................................................ name == " + gameObject.name);
            //    }
            //}
            NpcAmmoCtrl AmmoScript = obj.GetComponent <NpcAmmoCtrl>();
            AmmoScript.SetIsAimFeiJiPlayer(false);
            obj.transform.parent = XkGameCtrl.NpcAmmoArray;

            obj = (GameObject)Instantiate(DaPaoAmmoLiZi, SpawnAmmoPoint[count].position, SpawnAmmoPoint[count].rotation);
            XkGameCtrl.CheckObjDestroyThisTimed(obj);
            obj.transform.parent = SpawnAmmoPoint[count];

            yield return(new WaitForSeconds(TimeAmmoUnit));

            if (count <= 0)
            {
                yield return(new WaitForSeconds(TimeAmmoWait));

                count = countMax;
                continue;
            }
        } while (true);
    }
    void CheckNpcDeathExplode(PlayerEnum indexPlayer = PlayerEnum.Null)
    {
        if (DeathExplode == null)
        {
            return;
        }


        if (NpcScript != null && NpcScript.IsCaiPiaoZhanChe)
        {
            SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe;
            //彩票boss或战车npc.
            if (NpcScript.GetIsBossNpc())
            {
                deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss;
                AudioBeiJingCtrl.StopGameBeiJingAudio();
            }

            if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null)
            {
                int value = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetPrintCaiPiaoValueByDeCaiState(deCaiType, SSCaiPiaoDataManage.SuiJiDaoJuState.BaoXiang,
                                                                                                                                                    NpcScript.m_DaiJinQuanState);
                if (DeathExplodePoint != null)
                {
                    //Vector3 pos = XkGameCtrl.GetInstance().GetWorldObjToScreenPos(objExplode.transform.position);
                    SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState daiJinQuanType = NpcScript.m_DaiJinQuanState;
                    SSUIRoot.GetInstance().m_GameUIManage.CreatZhanCheBossCaiPiaoZhuanPan(indexPlayer, value, DeathExplodePoint.position, deCaiType, DeathExplode, daiJinQuanType);
                    //SSCaiPiaoLiZiManage caiPiaoLiZi = objExplode.GetComponent<SSCaiPiaoLiZiManage>();
                    //if (caiPiaoLiZi != null)
                    //{
                    //    caiPiaoLiZi.ShowNumUI(value, indexPlayer);
                    //}
                    //else
                    //{
                    //    Debug.LogWarning("CheckNpcDeathExplode -> caiPiaoLiZi was null.................");
                    //}
                    if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss)
                    {
                        //只给boss产生爆炸粒子.
                        GameObject objExplode = (GameObject)Instantiate(DeathExplode, DeathExplodePoint.position, DeathExplodePoint.rotation);
                        objExplode.transform.parent = XkGameCtrl.NpcAmmoArray;
                        XkGameCtrl.CheckObjDestroyThisTimed(objExplode);

                        SSCaiPiaoLiZiManage caiPiaoLiZi = objExplode.GetComponent <SSCaiPiaoLiZiManage>();
                        if (caiPiaoLiZi != null)
                        {
                            caiPiaoLiZi.ShowNumUI(value, indexPlayer);
                        }
                        else
                        {
                            Debug.LogWarning("CheckNpcDeathExplode -> caiPiaoLiZi was null.................");
                        }
                    }
                }
            }

            //if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe)
            //{
            //    if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null)
            //    {
            //        //初始化飞出的彩票逻辑.
            //        XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitCaiPiaoFly(transform.position, indexPlayer, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe);
            //    }
            //    else
            //    {
            //        Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............");
            //    }
            //}
            //else if (deCaiType == SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss)
            //{
            //    if (SSUIRoot.GetInstance().m_GameUIManage != null)
            //    {
            //        SSUIRoot.GetInstance().m_GameUIManage.InitCaiPiaoAnimation(XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_JPBossCaiPiaoFlyDt.TimeLeiJiaVal, indexPlayer);
            //    }

            //    if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null)
            //    {
            //        //初始化烟花粒子的产生.
            //        XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitPlayCaiPiaoYanHua();
            //    }
            //    else
            //    {
            //        Debug.LogWarning("CreatLiZi -> m_CaiPiaoFlyData was null............");
            //    }
            //}
        }
        else
        {
            GameObject objExplode = (GameObject)Instantiate(DeathExplode, DeathExplodePoint.position, DeathExplodePoint.rotation);
            objExplode.transform.parent = XkGameCtrl.NpcAmmoArray;
            XkGameCtrl.CheckObjDestroyThisTimed(objExplode);
        }
    }
Esempio n. 19
0
//	public void SetNpcIsDoFire(NpcMark script)
//	{
//		//Debug.Log("Unity:"+"SetNpcIsDoFire -> IsFireFeiJiNpc "+script.IsFireFeiJiNpc);
//		if (!NpcScript.IsAniMove) {
//			return;
//		}
//
//		if (SpawnPointScript == null) {
//			return;
//		}
//
//		Transform npcPath = SpawnPointScript.NpcPath;
//		Transform markPar = script.transform.parent;
//		if (npcPath != markPar) {
//			return;
//		}
//		//Debug.Log("Unity:"+"***********SetNpcIsDoFire -> IsFireFeiJiNpc "+script.IsFireFeiJiNpc);
//		NpcScript.SetIsDoFireAnimation(script.IsFireFeiJiNpc);
//		NpcScript.SetFeiJiMarkInfo(script);
//	}

    void Update()
    {
        if (!XkGameCtrl.IsMoveOnPlayerDeath)
        {
            if (!XkGameCtrl.IsActivePlayerOne && !XkGameCtrl.IsActivePlayerTwo)
            {
                return;
            }
        }

        if (IsDeathNPC)
        {
            return;
        }

        if (!IsTeShuFireNpc)
        {
            return;
        }

        if (TimeTeShuFire.Length < 1)
        {
            return;
        }

        //if (Network.peerType == NetworkPeerType.Server) {
        //	return;
        //}

        if ((JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()) ||
            GameOverCtrl.IsShowGameOver)
        {
            return;
        }

        if (!NpcScript.GetIsDoFireAnimation())
        {
            return;
        }

        if (XkGameCtrl.CheckNpcIsMoveToCameraBack(transform))
        {
            return;
        }

        if (XkGameCtrl.GetInstance().IsCreatAmmoOnBoss == false)
        {
            if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.GetIsHaveCaiPiaoBoss() == true)
            {
                if (NpcScript != null && NpcScript.IsCaiPiaoZhanChe == true)
                {
                }
                else
                {
                    //有彩票boss产生,不再继续发射子弹.
                    return;
                }
            }
        }

        GameObject obj  = null;
        Transform  tran = null;

        for (int i = 0; i < TimeTeShuFire.Length; i++)
        {
            TimeTeShuFire[i] += Time.deltaTime;
            if (TimeTeShuFire[i] >= TimeFireAmmo[i])
            {
                TimeTeShuFire[i] = 0f;                 //fire ammo
//				Debug.Log("Unity:"+"teShuFireNpc -> i = "+i);

                if (i < AudioTeShuNpcFire.Length && AudioTeShuNpcFire[i] != null)
                {
                    if (AudioTeShuNpcFire[i].isPlaying)
                    {
                        AudioTeShuNpcFire[i].Stop();
                    }
                    AudioTeShuNpcFire[i].Play();
                }

                //if (AmmoLZPrefabTeShu != null && AmmoLZPrefabTeShu[i] != null && AmmoLZObjTeShu[i] == null) {
                if (AmmoLZPrefabTeShu != null && AmmoLZPrefabTeShu[i] != null)
                {
                    obj = (GameObject)Instantiate(AmmoLZPrefabTeShu[i],
                                                  AmmoSpawnTranTeShu[i].position, AmmoSpawnTranTeShu[i].rotation);

                    tran = obj.transform;
                    //AmmoLZObjTeShu[i] = obj;
                    XkGameCtrl.CheckObjDestroyThisTimed(obj);
                    tran.parent = AmmoSpawnTranTeShu[i];
                }

                PlayerAmmoCtrl ammoPlayerScript = AmmoPrefabTeShu[i].GetComponent <PlayerAmmoCtrl>();
                if (ammoPlayerScript != null && !XkGameCtrl.GetInstance().IsCartoonShootTest)
                {
                    continue;
                }

                obj = GetNpcAmmoFromList(AmmoSpawnTranTeShu[i], AmmoPrefabTeShu[i]);
                if (obj == null)
                {
                    return;
                }
                tran        = obj.transform;
                tran.parent = XkGameCtrl.NpcAmmoArray;

                NpcAmmoCtrl ammoNpcScript = obj.GetComponent <NpcAmmoCtrl>();
                if (ammoNpcScript != null)
                {
                    ammoNpcScript.SetNpcScriptInfo(NpcScript);
                    ammoNpcScript.SetIsAimFeiJiPlayer(IsAimFeiJiPlayer);
                }
                else
                {
                    PlayerAmmoCtrl ammoScript = obj.GetComponent <PlayerAmmoCtrl>();
                    if (ammoScript != null)
                    {
                        Vector3 startPos    = tran.position;
                        Vector3 firePos     = tran.position;
                        Vector3 ammoForward = tran.forward;
                        firePos = Random.Range(300f, 400f) * ammoForward + startPos;
                        float      fireDisVal = Vector3.Distance(firePos, startPos);
                        RaycastHit hit;
                        LayerMask  FireLayer = XkGameCtrl.GetInstance().PlayerAmmoHitLayer;
                        if (Physics.Raycast(startPos, ammoForward, out hit, fireDisVal, FireLayer.value))
                        {
                            //Debug.Log("Unity:"+"npc fire PlayerAmmo, fire obj -> "+hit.collider.name);
                            firePos = hit.point;
                            XKNpcHealthCtrl healthScript = hit.collider.GetComponent <XKNpcHealthCtrl>();
                            if (healthScript != null)
                            {
                                healthScript.OnDamageNpc(ammoScript.DamageNpc, PlayerEnum.Null);
                            }

                            BuJiBaoCtrl buJiBaoScript = hit.collider.GetComponent <BuJiBaoCtrl>();
                            if (buJiBaoScript != null)
                            {
                                buJiBaoScript.RemoveBuJiBao(PlayerEnum.Null);                                 //buJiBaoScript
                            }
                        }
                        ammoScript.StartMoveAmmo(firePos, PlayerEnum.Null, null, AmmoMovePath);
                    }
                }

//				if (AmmoLiZiPrefab != null) {
//					obj = (GameObject)Instantiate(AmmoLiZiPrefab, AmmoSpawnTran.position, AmmoSpawnTran.rotation);
//					tran = obj.transform;
//					tran.parent = XkGameCtrl.MissionCleanup;
//				}
            }
        }
    }
    /// <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);
    }
Esempio n. 21
0
    public void OnDamageNpc(int damageNpcVal         = 1, PlayerEnum playerSt = PlayerEnum.Null,
                            PlayerAmmoType pAmmoType = PlayerAmmoType.Null)
    {
        if (IsDeathNpc)
        {
            return;
        }

        //switch (NpcJiFen)
        //{
        //    case NpcJiFenEnum.Boss:
        //        if (!XKBossXueTiaoCtrl.GetInstance().GetIsCanSubXueTiaoAmount())
        //        {
        //            if (NpcDamageCom != null)
        //            {
        //                NpcDamageCom.PlayNpcDamageEvent();
        //            }
        //            return;
        //        }
        //        break;
        //}


        if (NpcDamageCom != null)
        {
            NpcDamageCom.PlayNpcDamageEvent();
        }

        if (NpcScript != null)
        {
            if (NpcScript.IsCaiPiaoZhanChe == true && NpcScript.IsEnterCameraBox == false)
            {
                //彩票战车和boss没有进入摄像机盒子,不计算伤害.
                return;
            }
        }

        if (CountActivePlayer != XkGameCtrl.PlayerActiveNum)
        {
            if (CountActivePlayer != 0)
            {
                //fix PuTongAmmoCount.
                int indexValTmp      = CountActivePlayer - 1;
                int puTongAmmoNumTmp = MaxPuTongAmmo[indexValTmp];
                indexValTmp = XkGameCtrl.PlayerActiveNum - 1;
                if (indexValTmp >= 0)
                {
                    float healthPer = (float)PuTongAmmoCount / puTongAmmoNumTmp;
                    //int oldPuTongAmmoCount = PuTongAmmoCount;
                    PuTongAmmoCount = (int)(healthPer * MaxPuTongAmmo[indexValTmp]);

                    /*Debug.Log("Unity:"+"fix npc health -> PuTongAmmoCount "+PuTongAmmoCount
                     +", oldPuTongAmmoCount "+oldPuTongAmmoCount);*/
                }
            }
            CountActivePlayer = XkGameCtrl.PlayerActiveNum;
        }

        if (NpcScript == null || (NpcScript != null && !NpcScript.GetIsWuDi()))
        {
            PuTongAmmoCount += damageNpcVal;
        }

        int indexVal = XkGameCtrl.PlayerActiveNum - 1;

        indexVal = indexVal < 0 ? 0 : indexVal;
        int puTongAmmoNum = MaxPuTongAmmo[indexVal];

        if (NpcJiFen == NpcJiFenEnum.Boss)
        {
            float bossAmount = (float)(puTongAmmoNum - PuTongAmmoCount) / puTongAmmoNum;
            bossAmount = bossAmount < 0f ? 0f : bossAmount;
            XKBossXueTiaoCtrl.GetInstance().SetBloodBossAmount(bossAmount, this);
        }

        /*Debug.Log("Unity:"+"OnDamageNpc -> "
         +", nameNpc "+NpcNameInfo
         +", puTongAmmoNum "+puTongAmmoNum);*/
        if (PuTongAmmoCount >= puTongAmmoNum)
        {
            if (NpcScript != null)
            {
                if (NpcScript.IsZhanCheNpc)
                {
                    //战车npc是否可以被击爆的判断.
                    if (XkGameCtrl.GetInstance().IsCaiPiaoHuLuePlayerIndex == false && NpcScript.m_IndexPlayerJiBao != playerSt)
                    {
                        //不是可以击爆战车npc的玩家.
                        return;
                    }

                    if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                    {
                        //没有激活任何玩家.
                    }
                    else
                    {
                        if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe))
                        {
                            //战车彩池的彩票积累的不够.
                            return;
                        }
                    }
                }

                if (NpcScript.IsJPBossNpc)
                {
                    //JPBoss是否可以被击爆的判断.
                    if (XkGameCtrl.GetInstance().IsCaiPiaoHuLuePlayerIndex == false && NpcScript.m_IndexPlayerJiBao != playerSt)
                    {
                        //不是可以击爆JPBoss的玩家.
                        return;
                    }

                    if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
                    {
                        //没有激活任何玩家.
                    }
                    else
                    {
                        if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss))
                        {
                            //JPBoss彩池的彩票积累的不够.
                            return;
                        }
                    }
                }
            }

            if (IsDeathNpc)
            {
                return;
            }
            IsDeathNpc = true;

            if (IsOpenCameraShake)
            {
                XKPlayerCamera.GetInstanceFeiJi().HandlePlayerCameraShake();
            }

            if (NpcJiFen == NpcJiFenEnum.Boss && BossXieZiScript != null)
            {
                BossXieZiScript.ResetBossXieZiShouBiInfo();
            }

            if (BoxColCom != null)
            {
                BoxColCom.enabled = false;
            }
            CheckSpawnDaoJuCom(playerSt);
            CheckNpcDeathExplode(playerSt);
            CheckHiddenNpcObjArray();

//			bool isAddKillNpcNum = true;
//			if (NpcScript != null && CannonScript != null) {
//				if (NpcScript.GetIsDeathNPC()) {
//					isAddKillNpcNum = false;
//					Debug.Log("Unity:"+"name "+NpcScript.name+", isAddKillNpcNum "+isAddKillNpcNum);
//				}
//			}

            if (!IsYouTongNpc)
            {
                switch (NpcJiFen)
                {
                case NpcJiFenEnum.Boss:
                    if (GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0)
                    {
                        XkGameCtrl.GetInstance().AddPlayerKillNpc(PlayerEnum.Null, NpcJiFen, JiFenVal);
                    }
                    break;

                default:
                    XkGameCtrl.GetInstance().AddPlayerKillNpc(playerSt, NpcJiFen, JiFenVal);
                    ShowPiaoFen(playerSt);
                    break;
                }
//				if (isAddKillNpcNum) {
//					switch (NpcJiFen) {
//					case NpcJiFenEnum.Boss:
//						if (GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0) {
//							XkGameCtrl.GetInstance().AddPlayerKillNpc(PlayerEnum.Null, NpcJiFen, JiFenVal);
//						}
//						break;
//					default:
//						XkGameCtrl.GetInstance().AddPlayerKillNpc(playerSt, NpcJiFen, JiFenVal);
//						break;
//					}
//				}
            }
            else
            {
                CheckYouTongDamageNpc();
            }

            if (NpcScript != null)
            {
                if (CannonScript != null)
                {
                    CannonScript.OnRemoveCannon(playerSt, 1);
                }

                if (NpcJiFen != NpcJiFenEnum.Boss && NpcScript.GetIsBossNpc())
                {
                    return;
                }
                NpcScript.TriggerRemovePointNpc(1, CannonScript, pAmmoType);

                if (NpcScript.IsCaiPiaoZhanChe)
                {
                    SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe;
                    //彩票boss或战车npc.
                    if (NpcScript.GetIsBossNpc())
                    {
                        deCaiType = SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss;
                    }

                    if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage != null)
                    {
                        XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.SubGameDeCaiValByDeCaiState(playerSt, deCaiType);
                    }
                }
                else
                {
                    //普通npc被击杀.
                    if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null && DeathExplodePoint != null)
                    {
                        //随机送出正常得彩.
                        XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.CheckPlayerSongPiaoInfo(playerSt, DeathExplodePoint.position);
                    }
                }
            }
            else if (CannonScript != null)
            {
                CannonScript.OnRemoveCannon(playerSt, 1);
                //炮台类npc被击杀.
                if (XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData != null && DeathExplodePoint != null)
                {
                    //随机送出正常得彩.
                    XkGameCtrl.GetInstance().m_PlayerJiChuCaiPiaoData.CheckPlayerSongPiaoInfo(playerSt, DeathExplodePoint.position);
                }
            }
        }
    }
    /// <summary>
    /// 检测玩家送票信息.
    /// </summary>
    public void CheckPlayerSongPiaoInfo(PlayerEnum indexPlayer, Vector3 pos)
    {
        if (XKTriggerYuLeCtrl.IsActiveYuLeTrigger == true)
        {
            //娱乐触发器激活后不去送基础彩票.
            return;
        }

        int indexVal = (int)indexPlayer - 1;

        if (indexVal < 0 || indexVal > 2)
        {
            UnityLogWarning("CheckPlayerSongPiaoInfo -> indexVal was wrong! indexVal ======= " + indexVal);
            return;
        }

        if (m_JiChuCaiPiaoData[indexVal].IsCanSongPiao == false)
        {
            return;
        }

        if (m_JiChuCaiPiaoData[indexVal].JiChuCaiPiaoVal <= 0)
        {
            return;
        }

        int randVal = Random.Range(0, 100) % 2;

        if (m_JiChuCaiPiaoData[indexVal].SongPiaoCount == m_BiDingSongPiaoCountFirst ||
            m_JiChuCaiPiaoData[indexVal].SongPiaoCount == m_BiDingSongPiaoCountLast)
        {
            //必定送票.
            randVal = 0;
        }

        if (m_JiChuCaiPiaoData[indexVal].SongPiaoCount < m_BiDingSongPiaoCountLast)
        {
            if (m_JiChuCaiPiaoData[indexVal].JiChuCaiPiaoVal <= 1)
            {
                //基础彩票留下1张到最后一次送出.
                return;
            }
        }

        if (randVal != 0)
        {
            return;
        }

        //送出彩票数量.
        int   chuPiaoVal = 1;
        float randGaiLv  = Random.Range(0f, 100f) / 100f;

        if (randGaiLv > m_SongPiaoGaiLv01)
        {
            chuPiaoVal = 2;
        }

        if (m_JiChuCaiPiaoData[indexVal].JiChuCaiPiaoVal < chuPiaoVal)
        {
            if (m_JiChuCaiPiaoData[indexVal].SongPiaoCount < m_BiDingSongPiaoCountLast)
            {
                //给最后一次留1张票.
                chuPiaoVal = m_JiChuCaiPiaoData[indexVal].JiChuCaiPiaoVal - 1;
            }
            else
            {
                //最后一次送出剩余基础彩票.
                chuPiaoVal = m_JiChuCaiPiaoData[indexVal].JiChuCaiPiaoVal;
            }
        }

        if (chuPiaoVal <= 0)
        {
            UnityLogWarning("CheckPlayerSongPiaoInfo -> jiChuCaiPiao was out over..........");
            return;
        }
        UnityLog("CheckPlayerSongPiaoInfo -> chuPiaoVal ====== " + chuPiaoVal
                 + ", count == " + m_JiChuCaiPiaoData[indexVal].SongPiaoCount
                 + ", time == " + Time.time);

        //进入下一周期计时.
        m_JiChuCaiPiaoData[indexVal].IsCanSongPiao    = false;
        m_JiChuCaiPiaoData[indexVal].LastSongPiaoTime = Time.time;
        m_JiChuCaiPiaoData[indexVal].JiChuCaiPiaoVal -= chuPiaoVal;

        if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
        {
            //没有激活任何玩家.
        }
        else
        {
            if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage != null)
            {
                //减少玩家正常得彩.
                XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.SubPlayerZhengChangDeCai(indexPlayer, chuPiaoVal);
            }
        }

        //可以送出基础彩票.
        if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null &&
            XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_JiChuCaiPiaoLiZiPrefab != null)
        {
            GameObject obj = (GameObject)Instantiate(XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_JiChuCaiPiaoLiZiPrefab, XkGameCtrl.PlayerAmmoArray);
            obj.transform.position = pos + (Vector3.up * 2f);

            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(chuPiaoVal, indexPlayer);
                }
                else
                {
                    Debug.LogWarning("CheckPlayerSongPiaoInfo -> caiPiaoLiZi was null.................");
                }
            }

            if (XkGameCtrl.GetInstance().m_CaiPiaoFlyData != null)
            {
                //初始化飞出的彩票逻辑.
                XkGameCtrl.GetInstance().m_CaiPiaoFlyData.InitCaiPiaoFly(obj.transform.position, indexPlayer, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhengChang);
            }
            else
            {
                Debug.LogWarning("CheckPlayerSongPiaoInfo -> m_CaiPiaoFlyData was null............");
            }
        }
    }
Esempio n. 23
0
    /// <summary>
    /// 获取JPBoss和战车Npc的血值数据.
    /// </summary>
    internal void GetTotalHealthData(SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState type)
    {
        m_CurrentDaiJinQuanState = type;
        float caiChiVal             = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetCaiChiData(type);
        float caiChiChuPiaoTiaoJian = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetChuPiaoTiaoJian(type);
        //彩池是否足够.
        bool isCaiChiZuGou = caiChiVal - caiChiChuPiaoTiaoJian >= 0f ? true : false;
        //if (type == SSCaiPiaoDataManage.GameCaiPiaoData.DaiJinQuanState.JPBossDaiJinQuan)
        //{
        //    SSDebug.LogWarning("caiChiVal =========== " + caiChiVal + ", caiChiChuPiaoTiaoJian ============= " + caiChiChuPiaoTiaoJian);
        //}

        float baoJiangLv = XKGlobalData.GetInstance().GetDaiJinQuanBaoJiangLv(type);
        float randVal    = Random.Range(0f, 100f) / 100f;
        //是否爆奖.
        bool isDaiJinQuanBaoJiang = randVal < baoJiangLv ? true : false;

        if (SSGameLogoData.m_GameDaiJinQuanMode == SSGameLogoData.GameDaiJinQuanMode.HDL_CaiPinQuan)
        {
            //海底捞菜品券游戏.
            if (SSHaiDiLaoBaoJiang.GetInstance() != null)
            {
                isDaiJinQuanBaoJiang = SSHaiDiLaoBaoJiang.GetInstance().GetIsCanJiBaoNpc(type);
            }
        }

        //isCaiChiZuGou = false; //test
        //SSDebug.LogWarning("isDaiJinQuanBaoJiang == " + isDaiJinQuanBaoJiang + ", randVal == " + randVal + ", baoJiangLv == " + baoJiangLv);
        if (isCaiChiZuGou == true && isDaiJinQuanBaoJiang == true)
        {
            //可以爆奖.
            int indexVal = Random.Range(0, 100) % m_BaoJiangHealthDt.Length;
            if (m_TestBaoJiangData != null)
            {
                if (m_TestBaoJiangData.IsOpenTest == true)
                {
                    if (m_TestBaoJiangData.IndexHealth >= 0 && m_TestBaoJiangData.IndexHealth <= 2)
                    {
                        //测试数据信息.
                        indexVal = m_TestBaoJiangData.IndexHealth;
                    }
                }
            }
            m_CurrentTotalHealthDt = m_BaoJiangHealthDt[indexVal];
        }
        else
        {
            //不可以爆奖.
            int indexVal = Random.Range(0, 100) % m_NoBaoJiangHealthDt.Length;
            if (m_TestBaoJiangData != null)
            {
                if (m_TestBaoJiangData.IsOpenTest == true)
                {
                    if (m_TestBaoJiangData.IndexHealth >= 0 && m_TestBaoJiangData.IndexHealth <= 2)
                    {
                        //测试数据信息.
                        indexVal = m_TestBaoJiangData.IndexHealth;
                    }
                }
            }
            m_CurrentTotalHealthDt = m_NoBaoJiangHealthDt[indexVal];
        }
        //SSDebug.Log("GetTotalHealData -> m_CurentTotalHealthDt == " + m_CurrentTotalHealthDt.ToString());
    }
Esempio n. 24
0
    void OnTriggerExit(Collider other)
    {
        XKNpcMoveCtrl npcMoveCom = other.gameObject.GetComponent <XKNpcMoveCtrl>();

        if (npcMoveCom != null && npcMoveCom.IsCaiPiaoZhanChe)
        {
            //Debug.Log("Unity: OnTriggerExit******************name === " + npcMoveCom.name);
            bool isExit = false;
            switch (m_TriggerState)
            {
            case TriggerState.JPBoss:
            {
                if (npcMoveCom.IsEnterCameraBox == true && npcMoveCom.GetIsBossNpc() == true)
                {
                    isExit = true;
                }

                if (npcMoveCom.IsCaiPiaoZhanChe == false)
                {
                    //普通npc走出JPBoss的镜头范围盒子.
                    if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                    {
                        if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage != null)
                        {
                            XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.RemovePuTongNpcToBuJiDt(npcMoveCom.gameObject);
                        }
                    }
                }
                break;
            }

            case TriggerState.ZhanCheBoss:
            {
                if (npcMoveCom.IsEnterCameraBox == true && npcMoveCom.GetIsBossNpc() == false)
                {
                    isExit = true;
                }
                break;
            }
            }

            if (isExit == false)
            {
                return;
            }

            if (npcMoveCom.GetIsBossNpc() == true)
            {
                //Boss走出镜头范围.
                if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_AiPathGroup != null &&
                    XkGameCtrl.GetInstance().m_AiPathGroup.m_CameraMoveType != AiPathGroupCtrl.MoveState.YuLe)
                {
                    XkGameCtrl.GetInstance().m_AiPathGroup.SetCameraMoveType(AiPathGroupCtrl.MoveState.Default);
                }
                npcMoveCom.TriggerRemovePointNpc(0);
                //boss删除后切换背景音效.
                AudioBeiJingCtrl.StopGameBeiJingAudio();
                //镜头继续移动.
                XkGameCtrl.GetInstance().SetGameCameraIsMoveing(true, NpcJiFenEnum.Boss);
            }
            else
            {
                //彩票战车npc走出镜头范围.
                npcMoveCom.TriggerRemovePointNpc(0);
                //镜头继续移动.
                XkGameCtrl.GetInstance().SetGameCameraIsMoveing(true, NpcJiFenEnum.CheLiang);
                //SSDebug.LogWarning("SSTriggerCamerBox::OnTriggerExit -> time ==================== " + Time.time);
            }
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (XKTriggerKaQiuShaFire.IsCloseKaQiuShaTest)
        {
            return;             //test;
        }

        if (Network.peerType != NetworkPeerType.Disconnected)
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                if (FeiJiMarkCom != null && TanKeMarkCom != null)
                {
                    IsActiveHeTiCloseUI = true;
                    ServerPortCameraCtrl.CloseAllServerPortCamera();
                }
                return;
            }
        }

        if (DaoJiShiCtrl.GetInstance().GetIsPlayDaoJishi() || GameOverCtrl.IsShowGameOver)
        {
            return;
        }

        XkPlayerCtrl playerScript = other.GetComponent <XkPlayerCtrl>();

        if (playerScript == null)
        {
            return;
        }

        if (playerScript.PlayerSt == PlayerTypeEnum.FeiJi && XkGameCtrl.GameJiTaiSt != GameJiTaiType.FeiJiJiTai)
        {
            return;
        }

        if (playerScript.PlayerSt == PlayerTypeEnum.TanKe && XkGameCtrl.GameJiTaiSt != GameJiTaiType.TanKeJiTai)
        {
            return;
        }

        if (FeiJiMarkCom != null && TanKeMarkCom != null && IsActiveHeTiCloseUI)
        {
            return;
        }
        IsClosePlayerUI = true;
        CheckIsPlayDaoJiShi();

        ScreenDanHeiCtrl.GetInstance().ClosePlayerUI();
        if (FeiJiMarkCom != null && TanKeMarkCom != null)
        {
            IsActiveHeTiCloseUI = true;
            if (Network.peerType == NetworkPeerType.Client && NetCtrl.GetInstance() != null)
            {
                NetCtrl.GetInstance().TryActiveHeTiPlayerEvent();
            }
            ScreenDanHeiCtrl.GetInstance().OpenStartCamera();
            ScreenDanHeiCtrl.GetInstance().OpenScreenDanHui(1);
            GameMode modeVal = XkGameCtrl.GameModeVal;
            switch (modeVal)
            {
            case GameMode.DanJiFeiJi:
                playerScript.MakePlayerMoveToAiMark(FeiJiMarkCom);
                break;

            case GameMode.DanJiTanKe:
                playerScript.MakePlayerMoveToAiMark(TanKeMarkCom);
                break;

            case GameMode.LianJi:
                if (Network.peerType != NetworkPeerType.Disconnected)
                {
                    if (XkPlayerCtrl.GetInstanceFeiJi() != null)
                    {
                        XkPlayerCtrl.GetInstanceFeiJi().MakePlayerMoveToAiMark(FeiJiMarkCom);
                    }

                    if (XkPlayerCtrl.GetInstanceTanKe() != null)
                    {
                        XkPlayerCtrl.GetInstanceTanKe().MakePlayerMoveToAiMark(TanKeMarkCom);
                    }
                }
                else
                {
                    XkPlayerCtrl.GetInstanceFeiJi().MakePlayerMoveToAiMark(FeiJiMarkCom);
                    XkPlayerCtrl.GetInstanceTanKe().MakePlayerMoveToAiMark(TanKeMarkCom);
                }

//				if (XkGameCtrl.GetInstance().IsServerCameraTest) {
//					ServerPortCameraCtrl.CloseAllServerPortCamera();
//				}
                break;
            }
        }
        gameObject.SetActive(false);
    }
Esempio n. 26
0
    /// <summary>
    /// 创建随机道具.
    /// </summary>
    public void CreatSuiJiDaoJu(PlayerEnum indexPlayer)
    {
        if (!IsCreatSuiJiDaoJu)
        {
            return;
        }

        int indexVal = (int)indexPlayer - 1;

        if (indexVal < 0 || indexVal > 2)
        {
            return;
        }

        if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_PlayerCoinData[indexVal].XuBiVal <= 0)
        {
            //不是续币玩家.
            return;
        }

        if (!XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetIsChuCaiPiaoByDeCaiState(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.SuiJiDaoJu))
        {
            //随机道具彩池的彩票积累的不够.
            return;
        }

        if (Random.Range(0f, 100f) / 100f > 0.4f)
        {
            //没有随机上产生随机道具.
            return;
        }

        if (XkGameCtrl.GetInstance().GetIsCreateSuiJiDaoJu() == false)
        {
            //产生随机道具的间隔时间未到.
            return;
        }
        UnityLog("CreatSuiJiDaoJu....................");

        GameObject suiJiDaoJuPrefab = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.GetSuiJiDaoJuPrefab(indexPlayer);

        if (suiJiDaoJuPrefab != null)
        {
            GameObject obj = (GameObject)Instantiate(suiJiDaoJuPrefab, XkGameCtrl.GetInstance().DaoJuArray, transform);
            if (obj != null)
            {
                BuJiBaoCtrl buJiBao = obj.GetComponent <BuJiBaoCtrl>();
                if (buJiBao != null)
                {
                    buJiBao.IsCaiPiaoDaoJu = true;
                    buJiBao.SetIsSpawnDaoJu();
                    buJiBao.DelayRemoveSelf(indexPlayer);
                }

                //SSCaiPiaoSuiJiDaoJu suiJiDaoJu = obj.GetComponent<SSCaiPiaoSuiJiDaoJu>();
                //if (suiJiDaoJu != null)
                //{
                //    suiJiDaoJu.CreatLiZi(indexPlayer);
                //}
                //else
                //{
                //    UnityLogWarning("CreatSuiJiDaoJu -> SSCaiPiaoSuiJiDaoJu was null..........");
                //}
            }
        }
        else
        {
            UnityLogWarning("CreatSuiJiDaoJu -> suiJiDaoJuPrefab was null!");
        }
    }
Esempio n. 27
0
    public void ActiveServerPortCamera()
    {
        if (XkPlayerCtrl.GetInstanceFeiJi() == null && XkPlayerCtrl.GetInstanceTanKe() == null)
        {
            return;
        }

        switch (CameraType)
        {
        case PlayerTypeEnum.FeiJi:
            if (XkPlayerCtrl.GetInstanceFeiJi() == null)
            {
                _InstanceTK.ActiveServerPortCamera();
                return;
            }
            break;

        case PlayerTypeEnum.TanKe:
            if (XkPlayerCtrl.GetInstanceTanKe() == null)
            {
                _InstanceFJ.ActiveServerPortCamera();
                return;
            }
            break;
        }

        GetCameraFollowTran();
        if (FollowTran != null)
        {
            if (IsFollowTest)
            {
                CameraTran.position = FollowTran.position;
                CameraTran.rotation = FollowTran.rotation;
            }
            else
            {
                CameraTran.parent           = FollowTran;
                CameraTran.localPosition    = Vector3.zero;
                CameraTran.localEulerAngles = Vector3.zero;
            }
            CameraObj.SetActive(true);

            switch (CameraType)
            {
            case PlayerTypeEnum.FeiJi:
                if (LookCamera.GetInstanceFJ() != null)
                {
                    LookCamera.GetInstanceFJ().SetLookCameraActive(false);
                }

                if (LookCamera.GetInstanceTK() != null)
                {
                    LookCamera.GetInstanceTK().SetLookCameraActive(true);
                }
                break;

            case PlayerTypeEnum.TanKe:
                if (LookCamera.GetInstanceFJ() != null)
                {
                    LookCamera.GetInstanceFJ().SetLookCameraActive(true);
                }

                if (LookCamera.GetInstanceTK() != null)
                {
                    LookCamera.GetInstanceTK().SetLookCameraActive(false);
                }
                break;
            }
        }

        float randTime = Random.Range(MinRandTime, MaxRandTime);

        Invoke("DelayRandOpenServerPortCamera", randTime);
    }
Esempio n. 28
0
    void OnGUI()
    {
        float width = 0.8f * Screen.width;
        float hight = 25f;

        string info = "gameCaiPiaoInfo: ";

        //一币兑换彩票数.
        info += "GamePrice == " + XKGlobalData.GetInstance().GameCoinToMoney + " Fen";
        //战车彩池数据.
        float zhanCheJiangChi_20 = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.ZhanCheDeCai_01;

        info += ", zhanCheJiangChi_01 == " + zhanCheJiangChi_20.ToString("f2");
        float zhanCheJiangChi_50 = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.ZhanCheDeCai_02;

        info += ", zhanCheJiangChi_02 == " + zhanCheJiangChi_50.ToString("f2");
        //JPBoss彩池数据.
        float jpBossJiangChi = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.JPBossDeCai;

        info += ", jpBossJiangChi == " + jpBossJiangChi.ToString("f2");
        //jPBoss代金券商户支付数据.
        float jPBossDaiJinQuanShangHuZhiFu = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.JPBossDaiJinQuanShangHuZhiFu;

        info += ", jPBossDaiJinQuanShangHuZhiFu == " + jPBossDaiJinQuanShangHuZhiFu.ToString("f1");
        //随机道具彩池数据.
        float daoJuJiangChi = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.SuiJiDaoJuDeCai;

        info += ", daoJuJiangChi == " + daoJuJiangChi.ToString("f2");
        //JPBoss代金券爆奖率.
        float jpBossBaoJiangLv = XKGlobalData.GetInstance().JPBossBaoJiangLv;

        info += ", jpBossBaoJiangLv == " + jpBossBaoJiangLv.ToString("f2");
        //战车01代金券爆奖率.
        float zhanCheBaoJiangLv_01 = XKGlobalData.GetInstance().ZhanCheBaoJiangLv_01;

        info += ", zhanCheBaoJiangLv_01 == " + zhanCheBaoJiangLv_01.ToString("f2");
        //战车02代金券爆奖率.
        float zhanCheBaoJiangLv_02 = XKGlobalData.GetInstance().ZhanCheBaoJiangLv_02;

        info += ", zhanCheBaoJiangLv_02 == " + zhanCheBaoJiangLv_02.ToString("f2");
        //随机道具爆奖率.
        float daoJuBaoJiangLv = XKGlobalData.GetInstance().SuiJiDaoJuBaoJiangLv;

        info += ", daoJuBaoJiangLv == " + daoJuBaoJiangLv.ToString("f2");
        //预制彩池数据.
        //float yuZhiJiangChi = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameYuZhiCaiPiaoData.YuZhiCaiPiaoVal;
        //info += ", yuZhiJiangChi == " + yuZhiJiangChi.ToString("f2");
        //总投币数据.
        //int value = XKGlobalData.GetInstance().m_TotalInsertCoins;
        //info += ", TotalInsertCoins == " + value;
        //总出票数据.
        //value = XKGlobalData.GetInstance().m_TotalOutPrintCards;
        //info += ", TotalOutPrintCards == " + value;
        //info = "bufLen == " + info.Length + ", " + info;

        if (width < info.Length * 8f)
        {
            //动态修改高度.
            hight = ((info.Length * 8f) / width) * hight;
        }
        Rect rect = new Rect(10f, 40f, width, hight);

        GUI.Box(rect, "");
        GUI.Label(rect, info);
    }
Esempio n. 29
0
    /// <summary>
    /// 获取可以被哪个玩家击爆,通过击爆规则的产生.
    /// </summary>
    public PlayerEnum GetPlayerIndexByJiBaoGaiLv(NpcState npcType)
    {
        PlayerEnum index = PlayerEnum.Null;

        SSCaiPiaoDataManage.PlayerCoinData[] coinDt = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.GetSortPlayerCoinData();
        ZhanCheRulerData.ZhanCheJiBaoState   type   = ZhanCheRulerData.ZhanCheJiBaoState.State1;
        if (coinDt[0].XuBiVal == coinDt[1].XuBiVal && coinDt[1].XuBiVal == coinDt[2].XuBiVal)
        {
            type = ZhanCheRulerData.ZhanCheJiBaoState.State1;
        }
        else if (coinDt[0].XuBiVal > coinDt[1].XuBiVal && coinDt[1].XuBiVal == coinDt[2].XuBiVal)
        {
            type = ZhanCheRulerData.ZhanCheJiBaoState.State2;
        }
        else if (coinDt[0].XuBiVal > coinDt[1].XuBiVal && coinDt[1].XuBiVal > coinDt[2].XuBiVal)
        {
            type = ZhanCheRulerData.ZhanCheJiBaoState.State3;
        }
        else if (coinDt[0].XuBiVal == coinDt[1].XuBiVal && coinDt[1].XuBiVal > coinDt[2].XuBiVal)
        {
            type = ZhanCheRulerData.ZhanCheJiBaoState.State4;
        }

        //Debug.Log("Unity: GetPlayerIndexByJiBaoGaiLv::xuBiVal -> " + coinDt[0].XuBiVal + ", " + coinDt[1].XuBiVal + ", " + coinDt[2].XuBiVal
        //    + ", type ====== " + type);
        ZhanCheRulerData.ZhanCheJiBaoRuler ruler = m_ZhanCheRulerData.m_ZhanCheJiBaoRulerNew[(int)type];
        switch (npcType)
        {
        case NpcState.ZhanChe:
        {
            if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetChuPiaoTiaoJianBeiShu(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe) >= 2)
            {
                ruler = m_ZhanCheRulerData.m_ZhanCheJiBaoRuler[(int)type];
            }
            break;
        }

        case NpcState.JPBoss:
        {
            if (XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetChuPiaoTiaoJianBeiShu(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.JPBoss) >= 2)
            {
                ruler = m_ZhanCheRulerData.m_ZhanCheJiBaoRuler[(int)type];
            }
            break;
        }
        }

        float rv = Random.Range(0f, 100f) / 100f;

        if (rv < ruler.MaxJiBaoGaiLv)
        {
            index = coinDt[0].IndexPlayer;
        }
        else if (rv < ruler.MaxJiBaoGaiLv + ruler.CenJiBaoGaiLv)
        {
            index = coinDt[1].IndexPlayer;
        }
        else if (rv < ruler.MaxJiBaoGaiLv + ruler.CenJiBaoGaiLv + ruler.MinJiBaoGaiLv)
        {
            index = coinDt[2].IndexPlayer;
        }
        //Debug.Log("Unity: GetPlayerIndexByJiBaoGaiLv::xuBiVal -> index ============= " + index);
        return(index);
    }
Esempio n. 30
0
    public void ActiveJiFenJieMian()
    {
        if (Network.peerType == NetworkPeerType.Server)
        {
            return;
        }

        if (JiFenJieMianObj.activeSelf)
        {
            return;
        }
        FinishTaskObj.SetActive(false);

        if (!JiFenZongJieMianObj.activeSelf)
        {
            DanYaoInfoCtrl.GetInstanceOne().HiddenPlayerDanYaoInfo();
            DanYaoInfoCtrl.GetInstanceTwo().HiddenPlayerDanYaoInfo();
            ZhunXingCtrl.GetInstanceOne().SetActiveZhunXingObj(false);
            ZhunXingCtrl.GetInstanceTwo().SetActiveZhunXingObj(false);
            CoinPlayerCtrl.GetInstanceOne().HiddenPlayerCoin();
            CoinPlayerCtrl.GetInstanceTwo().HiddenPlayerCoin();
            YouLiangAddCtrl.GetInstance().HiddenYouLiangAdd();
            YouLiangCtrl.GetInstance().HiddenYouLiang();
            JiFenZongJieMianObj.SetActive(true);
        }
        else
        {
            XkGameCtrl.HiddenMissionCleanup();

            if (Network.peerType == NetworkPeerType.Client)
            {
                if (NetCtrl.GetInstance() != null)
                {
                    NetCtrl.GetInstance().TryCloseServerPort();
                }
            }
        }

        System.GC.Collect();
        if (XkPlayerCtrl.GetInstanceFeiJi() != null)
        {
            XkPlayerCtrl.GetInstanceFeiJi().StopPlayerMoveAudio();
        }

        if (XkPlayerCtrl.GetInstanceTanKe() != null)
        {
            XkPlayerCtrl.GetInstanceTanKe().StopPlayerMoveAudio();
        }
        JiFenJieMianObj.SetActive(true);

        if (XkGameCtrl.IsPlayGamePOne)
        {
            XunZhangJBCtrl.GetInstanceOne().ShowPlayerXunZhangJB();
        }

        if (XkGameCtrl.IsPlayGamePTwo)
        {
            XunZhangJBCtrl.GetInstanceTwo().ShowPlayerXunZhangJB();
        }

        pcvr.CloseGunZhenDongDengJi();
        pcvr.CloseAllQiNangArray();
        if (pcvr.GetInstance() != null)
        {
            pcvr.GetInstance().CloseFangXiangPanPower(PlayerEnum.Null);
        }

        Invoke("DelayForceRestartComPort", 0.5f);
    }