// Use this for initialization
    void Start()
    {
        _Instance = this;

        YouLiangDianMoveCtrl yldScript = null;

        for (int i = 0; i < 20; i++)
        {
            yldScript = YouLiangDianUICtrl.GetInstance().SpawnYouLiangDianUI(YouLiangDengJi.Level_1);
            XkGameCtrl.AddYLDLv(yldScript);
            yldScript.gameObject.SetActive(false);
            if (i < 5)
            {
                yldScript = YouLiangDianUICtrl.GetInstance().SpawnYouLiangDianUI(YouLiangDengJi.Level_2);
                XkGameCtrl.AddYLDLv(yldScript);
                yldScript.gameObject.SetActive(false);

                yldScript = YouLiangDianUICtrl.GetInstance().SpawnYouLiangDianUI(YouLiangDengJi.Level_3);
                XkGameCtrl.AddYLDLv(yldScript);
                yldScript.gameObject.SetActive(false);
            }
        }
    }
Пример #2
0
    /// <summary>
    /// Actives the game UI camera.
    /// </summary>
    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();
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            return;
        }

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

        XkPlayerCtrl ScriptPlayer = XkGameCtrl.GetPlayerScript(other.gameObject);

        if (ScriptPlayer == null)
        {
            return;
        }
        CheckAutoFireCom();
    }
Пример #4
0
    /// <summary>
    /// 创建补充npc.
    /// </summary>
    public GameObject CreateBuChongNpc()
    {
#if NOT_CREAT_GAME_NPC
        //不产生npc,测试用.
        return;
#endif

        if (XkGameCtrl.GetInstance().IsCartoonShootTest&& NpcObj == null)
        {
            return(null);
        }

        if (!enabled || !gameObject.activeSelf)
        {
            return(null);
        }
        //设置为补充npc
        IsBuChongNpc          = true;
        IsRemoveSpawnPointNpc = false;
        InitSpawnPointInfo();
        StartSpawnBuChongNpc();
        return(NpcLoopObj);
    }
Пример #5
0
    void CheckAmmoDamageNpc()
    {
        if (AmmoType == PlayerAmmoType.Null)
        {
            return;
        }

        //		XKNpcMoveCtrl npcScript = null;
        XKNpcHealthCtrl healthScript = null;

        Transform[] npcArray = XkGameCtrl.GetInstance().GetNpcTranList().ToArray();
        int         max      = npcArray.Length;
        Vector3     posA     = AmmoTran.position;
        Vector3     posB     = Vector3.zero;

        for (int i = 0; i < max; i++)
        {
            if (npcArray[i] == null)
            {
                continue;
            }

            posB = npcArray[i].position;

            /*float disTest = Vector3.Distance(posA, posB);
             * Debug.Log("disTest "+disTest+", posA "+posA+", posB "+posB+", AmmoDamageDis "+AmmoDamageDis);*/
            if (Vector3.Distance(posA, posB) <= AmmoDamageDis)
            {
                healthScript = npcArray[i].GetComponentInChildren <XKNpcHealthCtrl>();
                if (healthScript != null && !healthScript.IsYouTongNpc)
                {
                    //Add Damage Npc num to PlayerInfo.
                    healthScript.OnDamageNpc(AmmoType, PlayerState);
                }
            }
        }
    }
Пример #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............");
            }
        }
    }
Пример #7
0
    void OnSreenAlphaToMin()
    {
        if (Network.peerType != NetworkPeerType.Server)
        {
            //ZhunXingTeXiaoCtrl.GetInstance().ShowZhunXingTeXiao();
            if (SSUIRoot.GetInstance().m_GameUIManage != null)
            {
                SSUIRoot.GetInstance().m_GameUIManage.CreatGameStartTimeUI();
            }

            if (GameStartTimeCtrl.GetInstance() != null)
            {
                GameStartTimeCtrl.GetInstance().InitPlayStartTimeUI();
            }
        }
        else
        {
            StartCameraObj.SetActive(false);
            ScreenDanHeiObj.SetActive(false);
        }

        if (/*XkGameCtrl.GetInstance().IsServerCameraTest ||*/ Network.peerType == NetworkPeerType.Server)
        {
            XkGameCtrl.ActiveServerCameraTran();
            if (XKPlayerCamera.GetInstanceFeiJi() != null)
            {
                XKPlayerCamera.GetInstanceFeiJi().SetEnableCamera(false);
            }

            if (XKPlayerCamera.GetInstanceTanKe() != null)
            {
                XKPlayerCamera.GetInstanceTanKe().SetEnableCamera(false);
            }
        }
        IsSreenAlphaToMin     = true;
        IsOpenSreenAlphaToMin = false;
    }
    void OnCollisionEnter(Collision collision)
    {
        if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
        {
            //没有玩家激活游戏时.
            return;
        }

        if (IsCaiPiaoDaoJu)
        {
            //彩票随机道具不接受玩家碰撞得取.
            return;
        }

        //Debug.Log("Unity:"+"OnCollisionEnter -> nameHit "+collision.gameObject.name);
        string layerName = LayerMask.LayerToName(collision.gameObject.layer);

        if (layerName == XkGameCtrl.TerrainLayer &&
            IsSpawnDaoJu &&
            !IsDelayDestroy)
        {
            InitDelayDestroyBuJiBao();
        }

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

        XKPlayerMoveCtrl script = collision.transform.root.GetComponent <XKPlayerMoveCtrl>();

        if (script == null)
        {
            return;
        }
        RemoveBuJiBao(script.PlayerIndex);
    }
Пример #9
0
    public void SetBloodBossAmount(float bloodAmount, XKNpcHealthCtrl bossHealth = null)
    {
        //不去设置boss血条UI.
        return;

        if (bossHealth != null && bloodAmount == -1f)
        {
            BossHealthScript = bossHealth;             //存储Boss血量脚本.
        }

        if (!IsCanSubXueTiaoAmount)
        {
            return;
        }

        if (!gameObject.activeSelf)
        {
            return;
        }

        bloodAmount = bloodAmount > 1f ? 1f : bloodAmount;
        bloodAmount = bloodAmount < 0f ? 0f : bloodAmount;
        BossXueTiaoSprite.fillAmount = bloodAmount;
        if (bloodAmount <= 0f)
        {
            //JiFenJieMianCtrl.GetInstance().ShowFinishTaskInfo();
            IsWuDiPlayer = true;
            Invoke("DelayActiveJiFenJieMian", 4f);
            XkGameCtrl.BossRemoveAllNpcAmmo();
            AudioBeiJingCtrl.StopGameBeiJingAudio();
            HiddenBossXueTiao();
            if (BossHealthScript != null && bossHealth == null)
            {
                BossHealthScript.OnDamageNpc(99999999, PlayerEnum.Null);
            }
        }
    }
    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();
        }
    }
    void ResetNpcHealthInfo()
    {
        IsHitFanWeiHou = false;
        CheckNpcRigidbody();
        XkGameCtrl.GetInstance().AddNpcTranToList(transform);
        if (BoxColCom != null)
        {
            BoxColCom.enabled = true;
        }

        CountActivePlayer = 0;
        PuTongAmmoCount   = 0;
        IsDeathNpc        = false;
        int max = HiddenNpcObjArray.Length;

        for (int i = 0; i < max; i++)
        {
            if (HiddenNpcObjArray[i] != null && !HiddenNpcObjArray[i].activeSelf)
            {
                HiddenNpcObjArray[i].SetActive(true);
            }
        }
        CheckDisGameCamera();
    }
    /// <summary>
    /// 初始化.
    /// </summary>
    internal void Init(PlayerEnum indexPlayer)
    {
        if (m_BaoJiParticle != null)
        {
            int baoJiDengJi = -1;
            if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null)
            {
                baoJiDengJi = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.GetPlayerBaoJiDengJi(indexPlayer);
            }
            //SSDebug.Log("Init -> indexPlayer == " + indexPlayer + ", baoJiDengJi ============ " + baoJiDengJi);

            if (baoJiDengJi <= -1)
            {
                m_BaoJiParticle.gameObject.SetActive(false);
            }
            else
            {
                //SSDebug.Log("Init -> indexPlayer == " + indexPlayer + ", baoJiDengJi ============ " + baoJiDengJi);
                Material mat = null;
                if (XkGameCtrl.GetInstance().m_CaiPiaoHealthDt != null)
                {
                    mat = XkGameCtrl.GetInstance().m_CaiPiaoHealthDt.GetPlayerBaoJiMaterial(indexPlayer, baoJiDengJi);
                }

                if (mat == null)
                {
                    m_BaoJiParticle.gameObject.SetActive(false);
                }
                else
                {
                    m_BaoJiParticle.renderer.material = mat;
                    m_BaoJiParticle.gameObject.SetActive(true);
                }
            }
        }
    }
Пример #13
0
    void SetGenZongDanInfo()
    {
        if (AmmoType != PlayerAmmoType.GenZongAmmo)
        {
            return;
        }

        CosJiaoDuGZ = Mathf.Cos(ShanXingJiaoDu);
        if (XkGameCtrl.GetInstance() != null)
        {
            switch (MuBiaoXuanDing)
            {
            case 1:
                IndexPlayerAim = XkGameCtrl.GetInstance().GetMaxHealthPlayer();
                break;

            default:
                IndexPlayerAim = XkGameCtrl.GetInstance().GetRandAimPlayerObj();
                break;
            }
        }
        TargetObject = XKPlayerCamera.GetInstanceFeiJi().gameObject;
        //TargetObject = TestTarget; //test
    }
Пример #14
0
    void Start()
    {
        MeshRenderer meshCom = GetComponent <MeshRenderer>();

        if (meshCom != null)
        {
            meshCom.enabled = false;
        }

        /*switch (Mode) {
         * case TriggerMode.DanJi:
         *      if (XkGameCtrl.GameModeVal == GameMode.LianJi) {
         *              return;
         *      }
         *      break;
         *
         * case TriggerMode.LianJi:
         *      if (XkGameCtrl.GameModeVal != GameMode.LianJi) {
         *              return;
         *      }
         *      break;
         * }*/

        for (int i = 0; i < SpawnPointArray.Length; i++)
        {
            if (SpawnPointArray[i] == null)
            {
                Debug.LogWarning("SpawnPointArray was wrong! index " + (i + 1));
                GameObject obj = null;
                obj.name = "null";
                break;
            }
            SpawnPointArray[i].SetIsRemoveTrigger();
        }
        XkGameCtrl.GetInstance().ChangeBoxColliderSize(transform);
    }
        /// <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);
            }
        }
Пример #16
0
    public void StopDaoJiShi()
    {
        if (GameOverObj.activeInHierarchy == true)
        {
            if (IsInvoking("HiddenGameOverObj"))
            {
                CancelInvoke("HiddenGameOverObj");
            }
            GameOverObj.SetActive(false);
        }

        if (!IsPlayDaoJishi)
        {
            //重置玩家信息.
            XkGameCtrl.GetInstance().ResetPlayerInfo(PlayerIndex);
            XKPlayerScoreCtrl.ShowPlayerScore(PlayerIndex);
            return;
        }
        IsPlayDaoJishi = false;
        CountDaoJiShi--;
        ContinueGameObj.SetActive(false);
        DaoJiShiObj.SetActive(false);
        //m_TVYaoKongEnterObj.SetActive(false);
    }
Пример #17
0
//	[RPC] void XKHuoCheSendHuoCheTranInfo(Vector3 pos, Quaternion rot)
//	{
//		SpawnPointHuoChePos = pos;
//		SpawnPointHuoCheRot = rot;
//	}

    public void OnRemoveHuoCheObj(float timeVal = 0f)
    {
        if (IsDeathNpc)
        {
            return;
        }
        IsDeathNpc = true;

        //XkGameCtrl.ClearNpcSpawnAllAmmo(gameObject);
        XkGameCtrl.GetInstance().RemoveNpcTranFromList(transform);
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            XKNpcSpawnListCtrl.GetInstance().CheckNpcObjByNpcSpawnListDt(gameObject);
            Destroy(gameObject, timeVal);
        }
        else
        {
            if (NetworkServerNet.GetInstance() != null)
            {
                XKNpcSpawnListCtrl.GetInstance().CheckNpcObjByNpcSpawnListDt(gameObject);
                NetworkServerNet.GetInstance().RemoveNetworkObj(gameObject);
            }
        }
    }
Пример #18
0
    // Use this for initialization
    void Awake()
    {
        switch (PlayerSt)
        {
        case PlayerTypeEnum.FeiJi:
            InstanceFeiJi           = this;
            PlayerTranFeiJi         = transform;
            KaQiuShaAimPlayerTranFJ = KaQiuShaAimPoint;
            Invoke("DelaySetFeiJiNpcInfo", 1f);
            break;

        case PlayerTypeEnum.TanKe:
            InstanceTanKe           = this;
            PlayerTranTanKe         = transform;
            KaQiuShaAimPlayerTranTK = KaQiuShaAimPoint;
            break;

        case PlayerTypeEnum.CartoonCamera:
            InstanceCartoon = this;
            break;
        }

        if (PlayerSt != PlayerTypeEnum.CartoonCamera)
        {
            XkGameCtrl.GetInstance().ChangeAudioListParent();
        }
        PlayerObj     = gameObject;
        PlayerTran    = transform;
        AimSpawnPoint = new List <XKSpawnNpcPoint>();
        NetViewCom    = GetComponent <NetworkView>();
        if ((XkGameCtrl.GameModeVal == GameMode.LianJi && Network.peerType == NetworkPeerType.Disconnected) ||
            XkGameCtrl.GameModeVal != GameMode.LianJi)
        {
            NetViewCom.enabled = false;
        }
    }
Пример #19
0
    void Awake()
    {
        _Instance = this;

        bool isOutputError = false;
        int  max           = SpawnArray.Length;

        for (int i = 0; i < max; i++)
        {
            if (SpawnArray[i] == null)
            {
                Debug.LogWarning("SpawnArray was wrong! index = " + i);
                isOutputError = true;
                break;
            }
        }

        max = RemoveArray.Length;
        for (int i = 0; i < max; i++)
        {
            if (RemoveArray[i] == null)
            {
                Debug.LogWarning("RemoveArray was wrong! index = " + i);
                isOutputError = true;
                break;
            }
            XkGameCtrl.AddCartoonTriggerSpawnList(RemoveArray[i]);
        }

        if (isOutputError)
        {
            GameObject obj = null;
            obj.name = "null";
        }
        XkGameCtrl.GetInstance().ChangeBoxColliderSize(transform);
    }
    void ChangeDaoJiShiVal()
    {
        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            StopDaoJiShi();
            return;
        }

        if (DaoJiShiCount <= 1)
        {
            StopDaoJiShi();
            GameOverCtrl.GetInstance().ShowGameOver();
            return;
        }

        DaoJiShiCount--;
        DaoJiShiSprite.spriteName = "daoJiShi" + DaoJiShiCount;
        ShowDaoJiShiInfo();

        if (!pcvr.bIsHardWare && DaoJiShiCount == 1 && IsTestActivePlayer)
        {
            XkGameCtrl.SetActivePlayerOne(true);
        }
    }
    // Use this for initialization
    void Awake()
    {
        switch (PlayerSt)
        {
        case PlayerTypeEnum.FeiJi:
            _InstanceFeiJi = this;
            break;

        case PlayerTypeEnum.TanKe:
            _InstanceTanKe = this;
            break;
        }

        for (int i = 0; i < GenSuiMoveCam.Length; i++)
        {
            if (MainCamera == GenSuiMoveCam[i])
            {
                continue;
            }

            if (!XkGameCtrl.GetInstance().IsCartoonShootTest)
            {
                if (camera != null)
                {
                    camera.enabled = false;
                }
            }
            GenSuiMoveCam[i].SetActive(false);
            GenSuiMoveCam[i].tag = "MainCamera";
        }

        /*if (MainCamera != null) {
         *      Camera.main.enabled = false;
         *      MainCamera.SetActive(true);
         * }*/
    }
    // Update is called once per frame
    void Update()
    {
        if (Time.time - m_LastTimeVal >= 180f)
        {
            m_LastTimeVal = Time.time;
            if (DaoJiShiCtrl.GetInstanceOne().IsPlayDaoJishi == true ||
                DaoJiShiCtrl.GetInstanceTwo().IsPlayDaoJishi == true ||
                DaoJiShiCtrl.GetInstanceThree().IsPlayDaoJishi == true)
            {
                //有玩家正在播放倒计时.
                //Debug.LogWarning("player have play daoJiShi...");
                return;
            }

            if (XkGameCtrl.GetInstance().m_GamePlayerAiData != null &&
                XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == false)
            {
                //有激活游戏的玩家.
                //Debug.LogWarning("player have play game...");
                return;
            }
            StartCoroutine(DelayLoadingReconectServerGameScene());
        }
    }
    public void ShowGamePaiMing()
    {
        //Debug.Log("Unity:"+"ShowGamePaiMing...");
        int timeShengYu = GameTimeBossCtrl.GetInstance().GetTimeBossResidual();

        //timeShengYu = 51; //test.
        BossJiFenCtrl.GetInstance().ShowBossJiFenInfo(timeShengYu);

        int fenShuBoss = BossFenShuVal * timeShengYu;

        //Debug.Log("Unity:"+"fenShuBoss ****************** "+fenShuBoss);
        if (XkGameCtrl.IsActivePlayerOne)
        {
            XkGameCtrl.PlayerJiFenArray[0] += fenShuBoss;
            if (fenShuBoss > 0)
            {
                XKPlayerScoreCtrl.ChangePlayerScore(PlayerEnum.PlayerOne);
            }
        }
        if (XkGameCtrl.IsActivePlayerTwo)
        {
            XkGameCtrl.PlayerJiFenArray[1] += fenShuBoss;
            if (fenShuBoss > 0)
            {
                XKPlayerScoreCtrl.ChangePlayerScore(PlayerEnum.PlayerTwo);
            }
        }
        if (XkGameCtrl.IsActivePlayerThree)
        {
            XkGameCtrl.PlayerJiFenArray[2] += fenShuBoss;
            if (fenShuBoss > 0)
            {
                XKPlayerScoreCtrl.ChangePlayerScore(PlayerEnum.PlayerThree);
            }
        }
        if (XkGameCtrl.IsActivePlayerFour)
        {
            XkGameCtrl.PlayerJiFenArray[3] += fenShuBoss;
            if (fenShuBoss > 0)
            {
                XKPlayerScoreCtrl.ChangePlayerScore(PlayerEnum.PlayerFour);
            }
        }

        for (int i = 0; i < XkGameCtrl.PlayerJiFenArray.Length; i++)
        {
            XkGameCtrl.PlayerJiFenArray[i] = XkGameCtrl.PlayerJiFenArray[i] > MaxGameFenShu
                                ? MaxGameFenShu : XkGameCtrl.PlayerJiFenArray[i];
        }

        for (int i = 0; i < PlayerPaiMingObjArray.Length; i++)
        {
            PlayerPaiMingObjArray[i].SetActive(false);
        }
        XinJiLuObj.SetActive(false);
        HuangGuanObj.SetActive(false);

        int  countJF          = 0;
        bool isActiveXinJiLu  = false;
        bool isActivePlayerJF = false;

        //test start.

        /*XkGameCtrl.PlayerJiFenArray[0] = 123;
         * XkGameCtrl.PlayerJiFenArray[1] = 12345;
         * XkGameCtrl.PlayerJiFenArray[2] = 1234;
         * XkGameCtrl.PlayerJiFenArray[3] = 1234;*/
        //test end.
        int[] playerJFArray = XkGameCtrl.PlayerJiFenArray;
        if (PlayerJiFenList != null)
        {
            PlayerJiFenList.Clear();
            PlayerJiFenList = null;
        }

        PlayerJiFenList = new List <int>(playerJFArray);
        PlayerJiFenList.Sort();
        PlayerJiFenList.Reverse();
        int[] jiLuFenShuKey = { 0, 0, 0, 0 };
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                /*Debug.Log("Unity:"+"playerJFArray["+i+"] *** "+playerJFArray[i]
                 +", PlayerJiFenList["+j+"] *** "+PlayerJiFenList[j]);*/
                if (playerJFArray[i] == PlayerJiFenList[j] && jiLuFenShuKey[j] == 0)
                {
                    jiLuFenShuKey[j] = 1;
                    isActivePlayerJF = playerJFArray[i] > 0 ? true : false;
                    if (!isActivePlayerJF && j > 0)
                    {
                        break;
                    }

                    countJF++;
                    if (XKGlobalData.GameVersionPlayer == 0)
                    {
                        if (pcvr.IsHongDDShouBing)
                        {
                            string url = pcvr.GetInstance().m_PlayerHeadUrl[i];
                            XkGameCtrl.GetInstance().m_AsyImage.LoadPlayerHeadImg(url, PlayerNumUITexture[j]);
                        }
                        else
                        {
                            PlayerNumUITexture[j].mainTexture = PlayerTexture[i];
                        }
                    }
                    else
                    {
                        PlayerNumUITexture[j].mainTexture = PlayerTextureShR[i];
                    }

                    switch (j)
                    {
                    case 0:
                        isActivePlayerJF = true;
                        if (XinJiLuVal < PlayerJiFenList[j])
                        {
                            isActiveXinJiLu = true;
                            XinJiLuVal      = PlayerJiFenList[j];
                        }
                        SetPlayerJiFen(PlayerJF_1, PlayerJiFenList[j]);
                        break;

                    case 1:
                        SetPlayerJiFen(PlayerJF_2, PlayerJiFenList[j]);
                        break;

                    case 2:
                        SetPlayerJiFen(PlayerJF_3, PlayerJiFenList[j]);
                        break;

                    case 3:
                        SetPlayerJiFen(PlayerJF_4, PlayerJiFenList[j]);
                        break;
                    }
                    PlayerPaiMingObjArray[j].SetActive(isActivePlayerJF);
                    break;
                }
            }
        }

        if (countJF > 1)
        {
            HuangGuanObj.SetActive(true);
        }
        XinJiLuObj.SetActive(isActiveXinJiLu);

        if (GameJiLuFenShuCtrl.GetInstance() != null)
        {
            GameJiLuFenShuCtrl.GetInstance().ShowGameJiLuScore();
        }
        XKPlayerScoreCtrl.HiddenPlayerScore(PlayerEnum.Null);
    }
    public void Init(Vector3 startPos, PlayerEnum indexPlayer, SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState type)
    {
        m_CaiPiaoStartPos = startPos;
        switch (indexPlayer)
        {
        case PlayerEnum.PlayerOne:
        {
            m_CaiPiaoEndTr = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_CaiPiaoEndTrP1;
            break;
        }

        case PlayerEnum.PlayerTwo:
        {
            m_CaiPiaoEndTr = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_CaiPiaoEndTrP2;
            break;
        }

        case PlayerEnum.PlayerThree:
        {
            m_CaiPiaoEndTr = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_CaiPiaoEndTrP3;
            break;
        }
        }

        switch (type)
        {
        case SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhanChe:
        {
            if (m_ZhanCheCaiPiaoFlyObjListCom == null)
            {
                m_ZhanCheCaiPiaoFlyObjListCom = gameObject.AddComponent <SSGameObjListManage>();
            }
            m_MaxCaiPiao       = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_ZhanCheCaiPiaoFlyDt.MaxCaiPiao;
            m_TimeFly          = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_ZhanCheCaiPiaoFlyDt.TimeFly;
            m_FlyCaiPiaoPrefab = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_ZhanCheFlyCaiPiaoPrefab;
            break;
        }

        case SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.SuiJiDaoJu:
        {
            if (m_SuiJiDaoJuCaiPiaoFlyObjListCom == null)
            {
                m_SuiJiDaoJuCaiPiaoFlyObjListCom = gameObject.AddComponent <SSGameObjListManage>();
            }
            m_MaxCaiPiao       = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_SuiJiCaiPiaoFlyDt.MaxCaiPiao;
            m_TimeFly          = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_SuiJiCaiPiaoFlyDt.TimeFly;
            m_FlyCaiPiaoPrefab = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_FlyCaiPiaoPrefab;
            break;
        }

        case SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState.ZhengChang:
        {
            if (m_ZhengChangCaiPiaoFlyObjListCom == null)
            {
                m_ZhengChangCaiPiaoFlyObjListCom = gameObject.AddComponent <SSGameObjListManage>();
            }
            m_MaxCaiPiao       = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_ZhengChangCaiPiaoFlyDt.MaxCaiPiao;
            m_TimeFly          = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_ZhengChangCaiPiaoFlyDt.TimeFly;
            m_FlyCaiPiaoPrefab = XkGameCtrl.GetInstance().m_CaiPiaoFlyData.m_FlyCaiPiaoPrefab;
            break;
        }
        }

        if (m_FlyCaiPiaoPrefab == null)
        {
            UnityLogWarning("Init -> m_FlyCaiPiaoPrefab was null. type ======== " + type);
            Destroy(this);
            return;
        }

        m_LastCaiPiaoTime = Time.time;
        m_CaiPiaoCount    = 0;
        IndexPlayer       = indexPlayer;
        m_DeCaiState      = type;
        IsCreatCaiPiao    = true;
        CreatFlyCaiPiao();
    }
    void StartSpawnNpcAmmo()
    {
        if (AudioNpcFire != null)
        {
            if (AudioNpcFire.isPlaying)
            {
                AudioNpcFire.Stop();
            }
            AudioNpcFire.Play();
        }

        GameObject obj  = null;
        Transform  tran = null;

        if (AmmoLiZiPrefab != null)
        {
            obj = SpawnParticleCom.SpawnParticleObject(AmmoLiZiPrefab, AmmoSpawnTran.position, AmmoSpawnTran.rotation);
            if (obj.transform.parent != XkGameCtrl.NpcAmmoArray)
            {
                obj.transform.parent = XkGameCtrl.NpcAmmoArray;
            }
        }

        PlayerAmmoCtrl ammoPlayerScript = AmmoPrefab.GetComponent <PlayerAmmoCtrl>();

        if (ammoPlayerScript != null && !XkGameCtrl.GetInstance().IsCartoonShootTest)
        {
            return;
        }

        obj = GetNpcAmmoFromList(AmmoSpawnTran);
        if (obj == null)
        {
            return;
        }

        tran        = obj.transform;
        tran.parent = XkGameCtrl.NpcAmmoArray;
        NpcAmmoCtrl AmmoScript = obj.GetComponent <NpcAmmoCtrl>();

        if (AmmoScript != null)
        {
            AmmoScript.SetNpcScriptInfo(NpcScript);
            AmmoScript.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("npc fire PlayerAmmo, fire obj -> "+hit.collider.name);
                    firePos = hit.point;
                    XKNpcHealthCtrl healthScript = hit.collider.GetComponent <XKNpcHealthCtrl>();
                    if (healthScript != null)
                    {
                        healthScript.OnDamageNpc(ammoScript.AmmoType, PlayerEnum.Null);
                    }

                    BuJiBaoCtrl buJiBaoScript = hit.collider.GetComponent <BuJiBaoCtrl>();
                    if (buJiBaoScript != null)
                    {
                        buJiBaoScript.RemoveBuJiBao(PlayerEnum.Null);                         //buJiBaoScript
                    }
                }
                ammoScript.StartMoveAmmo(firePos, PlayerEnum.Null);
            }
        }
    }
Пример #26
0
    void SpawnAmmoParticleObj()
    {
        GameObject objParticle = null;
        GameObject obj         = null;
        Transform  tran        = null;
        Vector3    hitPos      = transform.position;

        RaycastHit hit;

        if (!IsHandleRpc)
        {
            AmmoEndPos   = transform.position;
            AmmoStartPos = transform.position - transform.forward * 3f;
            Physics.Raycast(AmmoStartPos, transform.forward, out hit, 1000f, PlayerAmmoHitLayer);
            if (hit.collider != null)
            {
                AmmoEndPos = hit.point;
            }
        }

        Vector3 forwardVal = Vector3.Normalize(AmmoEndPos - AmmoStartPos);

        if (AmmoType == PlayerAmmoType.PuTongAmmo)
        {
//			float disVal = Vector3.Distance(AmmoEndPos, AmmoStartPos) + 10f;
//			Physics.Raycast(AmmoStartPos, forwardVal, out hit, disVal, PlayerAmmoHitLayer);

            Vector3 startPos = Vector3.zero;
            Vector3 backVal  = -10f * transform.forward;
            if (GameTypeCtrl.IsTankVRStatic)
            {
                startPos = transform.position + backVal;
            }
            else
            {
                float   disAmmoOffset = AmmoSanSheDis;
                float   randKay       = Random.Range(0, 100) % 2 == 0 ? -1 : 1;
                Vector3 upVal         = randKay * Random.Range(0f, disAmmoOffset) * transform.up;
                randKay = Random.Range(0, 100) % 2 == 0 ? -1 : 1;
                Vector3 rightVal = randKay * Random.Range(0f, disAmmoOffset) * transform.right;
                startPos = transform.position + upVal + rightVal + backVal;
            }

            Physics.Raycast(startPos, transform.forward, out hit, 20f, PlayerAmmoHitLayer);
            if (hit.collider != null)
            {
                hitPos = hit.point;
                XKAmmoParticleCtrl ammoParticleScript = hit.collider.GetComponent <XKAmmoParticleCtrl>();
                if (ammoParticleScript != null && ammoParticleScript.PuTongAmmoLZ != null)
                {
                    objParticle = ammoParticleScript.PuTongAmmoLZ;
                }
                else
                {
                    string tagHitObj = hit.collider.tag;
                    switch (tagHitObj)
                    {
                    case "metal":
                        if (MetalParticle != null)
                        {
                            objParticle = MetalParticle;
                        }
                        break;

                    case "concrete":
                        if (ConcreteParticle != null)
                        {
                            objParticle = ConcreteParticle;
                        }
                        break;

                    case "dirt":
                        if (DirtParticle != null)
                        {
                            objParticle = DirtParticle;
                        }
                        break;

                    case "wood":
                        if (WoodParticle != null)
                        {
                            objParticle = WoodParticle;
                        }
                        break;

                    case "water":
                        if (WaterParticle != null)
                        {
                            objParticle = WaterParticle;
                        }
                        break;

                    case "sand":
                        if (SandParticle != null)
                        {
                            objParticle = SandParticle;
                        }
                        break;

                    case "glass":
                        if (GlassParticle != null)
                        {
                            objParticle = GlassParticle;
                        }
                        break;
                    }

                    if (objParticle == null)
                    {
                        objParticle = AmmoExplode;
                    }
                }

                if (IsHandleRpc &&
                    !IsDonotHurtNpc &&
                    Network.peerType != NetworkPeerType.Server &&
                    AmmoType == PlayerAmmoType.PuTongAmmo)
                {
                    XKNpcHealthCtrl healthScript = hit.collider.GetComponent <XKNpcHealthCtrl>();
                    if (healthScript != null)
                    {
                        if (HitNpcObj == null || HitNpcObj != hit.collider.gameObject)
                        {
                            //Debug.Log("playerAmmo hit npc, npc is "+hit.collider.name);
                            healthScript.OnDamageNpc(AmmoType, PlayerState);
                        }
                    }
                }
            }
            else
            {
                objParticle = AmmoExplode;
            }
        }
        else
        {
            float disVal = Vector3.Distance(AmmoEndPos, AmmoStartPos) + 10f;
            Physics.Raycast(AmmoStartPos, forwardVal, out hit, disVal, PlayerAmmoHitLayer);
            if (hit.collider != null)
            {
//				if (AmmoType == PlayerAmmoType.GaoBaoAmmo) {
//					Debug.Log("hit.collider "+hit.collider.name);
//				}
                hitPos = hit.point;
                string tagHitObj = hit.collider.tag;
                switch (tagHitObj)
                {
                case "dirt":
                    if (DirtParticle != null)
                    {
                        objParticle = DirtParticle;
                    }
                    break;

                case "water":
                    if (WaterParticle != null)
                    {
                        objParticle = WaterParticle;
                    }
                    break;
                }

                if (objParticle == null)
                {
                    objParticle = AmmoExplode;
                }
            }
            else
            {
                objParticle = AmmoExplode;
            }
        }

        if (objParticle == null)
        {
            return;
        }

        if (AmmoType == PlayerAmmoType.DaoDanAmmo)
        {
            Vector3 AmmoPos = transform.position - (transform.forward * 3f);
            Physics.Raycast(AmmoPos, forwardVal, out hit, 13f, XkGameCtrl.GetInstance().LandLayer);
            if (hit.collider != null)
            {
                hitPos = hit.point;
                Vector3    normalVal = hit.normal;
                Quaternion rotVal    = Quaternion.LookRotation(normalVal);
                obj = SpawnParticleCom.SpawnParticleObject(objParticle, hitPos, rotVal);
                obj.transform.up = normalVal;
            }
            else
            {
                obj = SpawnParticleCom.SpawnParticleObject(objParticle, hitPos, transform.rotation);
            }
        }
        else
        {
            obj = SpawnParticleCom.SpawnParticleObject(objParticle, hitPos, transform.rotation);
        }
        tran        = obj.transform;
        tran.parent = XkGameCtrl.PlayerAmmoArray;
        XkGameCtrl.CheckObjDestroyThisTimed(obj);

        XkAmmoTieHuaCtrl tieHuaScript = obj.GetComponent <XkAmmoTieHuaCtrl>();

        if (tieHuaScript != null && tieHuaScript.TieHuaTran != null)
        {
            Transform tieHuaTran = tieHuaScript.TieHuaTran;
            Vector3   AmmoPos    = transform.position - (transform.forward * 3f);
            Physics.Raycast(AmmoPos, forwardVal, out hit, 13f, XkGameCtrl.GetInstance().PlayerAmmoHitLayer);
            if (hit.collider != null)
            {
                tieHuaTran.up = hit.normal;
            }
        }
    }
Пример #27
0
    /// <summary>
    /// 创建npc.
    /// npcType 产生的npc类型.
    /// pointState 产生点的方位信息.
    /// </summary>
    void CreatNpcObj(NpcState npcType, SpawnPointState pointState)
    {
        //Debug.Log("Unity: CreatNpcObj -> npcType ====== " + npcType + ", pointState ======= " + pointState);
        if (pointState == SpawnPointState.Null)
        {
            //pointState为null时不用产生战车npc.
            return;
        }

        NpcSpawnData data = GetNpcSpawnData(npcType, pointState);

        if (data != null)
        {
            GameObject obj = data.CreatPointNpc();
            if (obj != null)
            {
                XKNpcMoveCtrl npcMove = null;
                switch (npcType)
                {
                case NpcState.ZhanChe:
                {
                    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);
                    }
                    m_ZhanCheJPBossData.ZhanCheData.AddNpcToList(obj);
                    break;
                }

                case NpcState.JPBoss:
                {
                    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.Boss);
                    }
                    m_ZhanCheJPBossData.JPBossData.AddNpcToList(obj);

                    npcMove = obj.GetComponent <XKNpcMoveCtrl>();
                    if (npcMove != null)
                    {
                        switch (pointState)
                        {
                        case SpawnPointState.Up:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.Qian;
                            break;
                        }

                        case SpawnPointState.Down:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.Hou;
                            break;
                        }

                        case SpawnPointState.Left:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.Zuo;
                            break;
                        }

                        case SpawnPointState.Right:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.You;
                            break;
                        }
                        }
                    }

                    if (XKBossLXCtrl.GetInstance() != null)
                    {
                        //播放boss来袭UI.
                        XKBossLXCtrl.GetInstance().StartPlayBossLaiXi();
                        AudioBeiJingCtrl.StopGameBeiJingAudio();
                    }
                    break;
                }

                case NpcState.SuperJPBoss:
                {
                    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.Boss);
                    }
                    m_ZhanCheJPBossData.SuperJPBossData.AddNpcToList(obj);


                    npcMove = obj.GetComponent <XKNpcMoveCtrl>();
                    if (npcMove != null)
                    {
                        switch (pointState)
                        {
                        case SpawnPointState.Up:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.Qian;
                            break;
                        }

                        case SpawnPointState.Down:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.Hou;
                            break;
                        }

                        case SpawnPointState.Left:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.Zuo;
                            break;
                        }

                        case SpawnPointState.Right:
                        {
                            npcMove.m_TriggerDir = SSTriggerCaiPiaoBossMove.TriggerDir.You;
                            break;
                        }
                        }
                    }

                    if (XKBossLXCtrl.GetInstance() != null)
                    {
                        //播放boss来袭UI.
                        XKBossLXCtrl.GetInstance().StartPlayBossLaiXi();
                        AudioBeiJingCtrl.StopGameBeiJingAudio();
                    }
                    break;
                }
                }
            }
        }
    }
Пример #28
0
    void Update()
    {
        //if (Input.GetKeyDown(KeyCode.P))
        //{
        //    CreatNpcObj(NpcState.JPBoss, m_CreatZhanCheState.GetSpawnPointState()); //test.
        //}

        if (Time.time - m_LastUpdateTime < 8f)
        {
            //冷却时间.
            //增加彩票战车和boss产生的间隔时间.
            return;
        }
        m_LastUpdateTime = Time.time;


        if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true)
        {
            //没有激活玩家.
        }
        else
        {
            if (XkGameCtrl.PlayerActiveNum <= 0)
            {
                //没有玩家激活时.
                return;
            }
        }

        if (XkGameCtrl.GetInstance().IsDisplayBossDeathYanHua == true)
        {
            return;
        }

        if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_AiPathGroup != null &&
            XkGameCtrl.GetInstance().m_AiPathGroup.m_CameraMoveType == AiPathGroupCtrl.MoveState.YuLe)
        {
            //娱乐阶段不产生npc.
            return;
        }

#if CREAT_ZHAN_CHE_NPC
        if (Time.time - m_ZhanCheRulerData.LastTime >= m_ZhanCheRulerData.RandTime)
        {
            //检测是否可以产生战车.
            if (!m_ZhanCheJPBossData.IsCreatZhanChe)
            {
                m_ZhanCheJPBossData.IsCreatZhanChe = true;
                //Debug.Log("creat zhanCheNpc, RandTime ============= " + m_ZhanCheRulerData.RandTime);
            }
        }
#endif

#if CREAT_BOSS_NPC
        if (Time.time - m_JPBossRulerData.LastTime >= m_JPBossRulerData.RandTime)
        {
            //检测是否可以产生JPBoss.
            if (!m_ZhanCheJPBossData.IsCreatJPBoss)
            {
                m_ZhanCheJPBossData.IsCreatJPBoss = true;
                //Debug.Log("creat jpBoss, RandTime ============= " + m_JPBossRulerData.RandTime);
            }
        }

        //if (m_JPBossRulerData.IsPlayerXuBi)
        //{
        //    //玩家已经续币.
        //    if (Time.time - m_JPBossRulerData.LastXuBiTime >= m_JPBossRulerData.RandTimeXuBi)
        //    {
        //        //检测是否可以产生JPBoss.
        //        if (!m_ZhanCheJPBossData.IsCreatJPBoss)
        //        {
        //            m_ZhanCheJPBossData.IsCreatJPBoss = true;
        //        }
        //    }
        //}
#endif

        if (m_ZhanCheJPBossData.IsCreatSuperJPBoss)
        {
            //优先产生SuperJPBoss.
            if (!m_ZhanCheJPBossData.ZhanCheData.GetIsHaveNpc() &&
                !m_ZhanCheJPBossData.JPBossData.GetIsHaveNpc() &&
                !m_ZhanCheJPBossData.SuperJPBossData.GetIsHaveNpc())
            {
                //没有战车、JPBoss和SuperJPBoss时产生JPBoss.
                CreatNpcObj(NpcState.SuperJPBoss, m_CreatZhanCheState.GetSpawnPointState());
            }
        }
        else if (m_ZhanCheJPBossData.IsCreatJPBoss)
        {
            //其次产生JPBoss.
            if (!m_ZhanCheJPBossData.ZhanCheData.GetIsHaveNpc() &&
                !m_ZhanCheJPBossData.JPBossData.GetIsHaveNpc() &&
                !m_ZhanCheJPBossData.SuperJPBossData.GetIsHaveNpc())
            {
                //没有战车、JPBoss和SuperJPBoss时产生JPBoss.
                CreatNpcObj(NpcState.JPBoss, m_CreatZhanCheState.GetSpawnPointState());
            }
        }
        else if (m_ZhanCheJPBossData.IsCreatZhanChe)
        {
            //最后产生战车.
            if (!m_ZhanCheJPBossData.ZhanCheData.GetIsHaveNpc() &&
                !m_ZhanCheJPBossData.JPBossData.GetIsHaveNpc() &&
                !m_ZhanCheJPBossData.SuperJPBossData.GetIsHaveNpc())
            {
                //没有战车、JPBoss和SuperJPBoss时产生JPBoss.
                CreatNpcObj(NpcState.ZhanChe, m_CreatZhanCheState.GetSpawnPointState());
            }
        }
    }
    void OnGUI()
    {
        if (MovieRender != null)
        {
            return;
        }

        if (!IsPlayMovie)
        {
            return;
        }

        if (IsPlayMvLogo)
        {
            ShowGameMovieLogo();
            if (Time.realtimeSinceStartup - TimeLogo >= 3f)
            {
                IsPlayMvLogo          = false;
                TimeStartMV           = Time.realtimeSinceStartup;
                TimeDelayHiddenMvLogo = Time.realtimeSinceStartup;
                Movie.Play();
                AudioSourceObj.Play();
                return;
            }
            return;
        }

        if (Time.realtimeSinceStartup - TimeDelayHiddenMvLogo < 0.2f)
        {
            ShowGameMovieLogo();
            return;
        }

        if (IsStopMovie)
        {
            return;
        }
        CheckClientPortMovieInfo();
        GUI.DrawTexture(RectMv, Movie, ScaleMode.StretchToFill);

        TimeVal += Time.deltaTime;
        int timeTmp = (int)TimeVal;

        if (!XKGlobalData.IsFreeMode)
        {
            if (timeTmp % 2 == 0)
            {
                if (XKGlobalData.CoinPlayerOne < XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[0], TextureMv[0]);
                }
                else
                {
                    GUI.DrawTexture(RectArray[2], TextureMv[1]);
                }

                if (XKGlobalData.CoinPlayerTwo < XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[1], TextureMv[0]);
                }
                else
                {
                    GUI.DrawTexture(RectArray[3], TextureMv[1]);
                }
            }
            else
            {
                if (XKGlobalData.CoinPlayerOne >= XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[2], TextureMv[2]);
                }

                if (XKGlobalData.CoinPlayerTwo >= XKGlobalData.GameNeedCoin)
                {
                    GUI.DrawTexture(RectArray[3], TextureMv[2]);
                }
            }
        }
        else
        {
            if (timeTmp % 2 == 0)
            {
                GUI.DrawTexture(RectArray[2], TextureMv[1]);
                GUI.DrawTexture(RectArray[3], TextureMv[1]);
            }
            else
            {
                GUI.DrawTexture(RectArray[2], TextureMv[2]);
                GUI.DrawTexture(RectArray[3], TextureMv[2]);
            }
        }

        XkGameCtrl.TestNetInfo();
        if (Camera.main != null && IsThreeScreenGame)
        {
            Vector3 posTmp = Camera.main.WorldToScreenPoint(InsertCoinTr[0].position);
            float   testPX = posTmp.x - (RectArray[0].width / 2f);
            float   testPY = posTmp.y + (RectArray[0].height * 0.7f);
            testPY         = Screen.height - testPY;
            RectArray[0].x = testPX;
            RectArray[0].y = testPY;

            posTmp         = Camera.main.WorldToScreenPoint(InsertCoinTr[1].position);
            testPX         = posTmp.x - (RectArray[1].width / 2f);
            RectArray[1].x = testPX;
            RectArray[1].y = testPY;

            posTmp         = Camera.main.WorldToScreenPoint(StartBtTr[0].position);
            testPX         = posTmp.x - (RectArray[2].width / 2f);
            testPY         = posTmp.y + (RectArray[2].height * 0.7f);
            testPY         = Screen.height - testPY;
            RectArray[2].x = testPX;
            RectArray[2].y = testPY;

            posTmp         = Camera.main.WorldToScreenPoint(StartBtTr[1].position);
            testPX         = posTmp.x - (RectArray[3].width / 2f);
            RectArray[3].x = testPX;
            RectArray[3].y = testPY;
        }

        TimeMovieVal = Time.realtimeSinceStartup - TimeStartMV;
        if (TimeMovieVal >= Movie.duration + 3f)
        {
            TimeLogo     = Time.realtimeSinceStartup;
            IsPlayMvLogo = true;
            Movie.Stop();
            AudioSourceObj.Stop();

            TimeStartMV = Time.realtimeSinceStartup;
            CountMV++;
        }

        ShowGameMvLG();
        if (!pcvr.bIsHardWare)
        {
            string mvInfo = "mvTime " + Movie.duration + ", CountMV " + CountMV + ", timeVal " + TimeMovieVal.ToString("f2");
            GUI.Label(new Rect(10f, 0f, Screen.width * 0.5f, 30f), mvInfo);
        }
        XKGameFPSCtrl.DrawGameFPS();
    }
 void Start()
 {
     XkGameCtrl.GetInstance().ChangeBoxColliderSize(transform);
 }