示例#1
0
    void ChangeDaoJiShiVal()
    {
        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            StopDaoJiShi();
            return;
        }

        if (DaoJiShiCount <= 1)
        {
            StopDaoJiShi();
            ShowGameOverObj();
//			if (XkGameCtrl.PlayerActiveNum <= 0 && CountDaoJiShi > 0) {
//				Debug.LogWarning("ChangeDaoJiShiVal -> CountDaoJiShi "+CountDaoJiShi);
//			}

            if (XkGameCtrl.PlayerActiveNum <= 0 && CountDaoJiShi <= 0)
            {
                GameOverCtrl.GetInstance().ShowGameOver();
            }
            return;
        }

        DaoJiShiCount--;
        DaoJiShiSprite.spriteName = "daoJiShi" + DaoJiShiCount;
        ShowDaoJiShiInfo();
    }
示例#2
0
    void Update()
    {
        if (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            if (InsertCoinObj.activeSelf)
            {
                InsertCoinObj.SetActive(false);
            }

            if (StartBtObj.activeSelf)
            {
                StartBtObj.SetActive(false);
            }
            return;
        }

        CheckPlayerOneCoinCur();
        CheckPlayerTwoCoinCur();
        CheckPlayerThreeCoinCur();
        //CheckPlayerFourCoinCur();

        if (pcvr.bIsHardWare == true && StartBtObj != null && PlayerSt != PlayerEnum.PlayerFour)
        {
            if (StartBtObj.activeInHierarchy == true)
            {
                pcvr.GetInstance().OpenPlayerStartLed(PlayerSt);
            }
            else
            {
                pcvr.GetInstance().ClosePlayerStartLed(PlayerSt);
            }
        }
    }
示例#3
0
    void ChangeDaoJiShiVal()
    {
        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            StopDaoJiShi();
            return;
        }

        if (DaoJiShiCount <= 1)
        {
            StopDaoJiShi();
            ShowGameOverObj();
//			if (XkGameCtrl.PlayerActiveNum <= 0 && CountDaoJiShi > 0) {
//				Debug.LogWarning("Unity:"+"ChangeDaoJiShiVal -> CountDaoJiShi "+CountDaoJiShi);
//			}

            //玩家没有进行续币.
            //重置玩家续币信息.
            XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.ResetPlayerXuBiInfo(PlayerIndex);
            //if (XkGameCtrl.PlayerActiveNum <= 0 && CountDaoJiShi <= 0) {
            //	GameOverCtrl.GetInstance().ShowGameOver();
            //}

            XkGameCtrl.GetInstance().ResetPlayerInfo(PlayerIndex);
            return;
        }

        DaoJiShiCount--;
        DaoJiShiSprite.spriteName = "daoJiShi" + DaoJiShiCount;
        ShowDaoJiShiInfo();
    }
    public static void ShowDongGanInfo()
    {
        if (!ScreenDanHeiCtrl.IsStartGame)
        {
            return;
        }

        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            return;
        }

        if (Instance == null)
        {
            return;
        }

        DongGanCount++;
        if (DongGanCount > 1)
        {
            DongGanCount = 0;
        }
        pcvr.DongGanState = (byte)DongGanCount;
        Instance.ShowDongGanUI(DongGanCount);
    }
示例#5
0
 void DelayStopJiFenPanel()
 {
     if (JiFenJieMianCtrl.GetInstance() != null)
     {
         JiFenJieMianCtrl.GetInstance().StopJiFenTime();
     }
 }
示例#6
0
    void OnTriggerEnter(Collider other)
    {
        if (XKTriggerKaQiuShaFire.IsCloseKaQiuShaTest)
        {
            return;             //test;
        }

        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            return;
        }

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

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

        if (script == null || !script.GetIsHandleRpc())
        {
            return;
        }
        PlayerCameraTr  = script.GetPlayerCameraScript().transform;
        IsActiveTrigger = true;
    }
示例#7
0
 void DelayActiveJiFenJieMian()
 {
     if (GameTimeBossCtrl.GetInstance().GetTimeBossResidual() > 0)
     {
         XKGlobalData.GetInstance().PlayAudioBossShengLi();
     }
     JiFenJieMianCtrl.GetInstance().ActiveJiFenJieMian();
 }
示例#8
0
 public void SetParentTran(Transform tran)
 {
     if (GameOverCtrl.IsShowGameOver ||
         (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()))
     {
         return;
     }
     XkGameCtrl.SetParentTran(transform, tran);
 }
    void HiddenGameOver()
    {
        GameOverObj.SetActive(false);
        //XkGameCtrl.LoadingGameMovie(); //Back Movie Scene.

        if (JiFenJieMianCtrl.GetInstance() != null)
        {
            JiFenJieMianCtrl.GetInstance().ActiveJiFenJieMian();
        }
    }
示例#10
0
 [RPC] void NetCtrlMakeOtherPortStopJiFenTime()
 {
     if (IsMakeGameStopJiFenTime)
     {
         return;
     }
     Debug.Log("Unity:" + "NetCtrlMakeOtherPortStopJiFenTime...");
     IsMakeGameStopJiFenTime = true;
     JiFenJieMianCtrl.GetInstance().StopJiFenTime();
 }
    public void HandleNpcYouLiangDian(int youLiangDianVal, Transform tranNpc)
    {
        if (JiFenJieMianCtrl.GetInstance() != null)
        {
            if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
            {
                return;
            }
        }

        int randVal = Random.Range(0, 100) % 4;
        int yldLvA  = 4;        //min
        int yldLvB  = 9;        //center

        if (youLiangDianVal <= yldLvA)
        {
            randVal = 0;
        }
        else if (youLiangDianVal > yldLvA && youLiangDianVal <= yldLvB)
        {
            randVal = 1;
        }
        else
        {
            randVal = 2;
        }
        //randVal = 1; //test

        YouLiangDianMoveCtrl scriptYLD = null;

        switch (randVal)
        {
        case 0:
            scriptYLD = XkGameCtrl.GetYLDMoveScript(YouLiangDengJi.Level_1);
            break;

        case 1:
            scriptYLD = XkGameCtrl.GetYLDMoveScript(YouLiangDengJi.Level_2);
            break;

        default:
            scriptYLD = XkGameCtrl.GetYLDMoveScript(YouLiangDengJi.Level_3);
            break;
        }

        Vector3 startPos = Vector3.zero;

        startPos   = Camera.main.WorldToScreenPoint(tranNpc.position);
        startPos.z = 0f;
        startPos.x = (XkGameCtrl.ScreenWidth * startPos.x) / Screen.width;
        startPos.y = (XkGameCtrl.ScreenHeight * startPos.y) / Screen.height;
        //Debug.Log("startPos **** "+startPos);
        scriptYLD.StartMoveYouLiangDian(startPos, YLDEndPosTran.position);
    }
 void SetActiveZuiGaoFen(bool isActive)
 {
     if (isActive)
     {
         if ((JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()) ||
             JiFenJieMianCtrl.GetInstance() == null)
         {
             isActive = false;
         }
     }
     ZuiGaoFenObj.SetActive(isActive);
 }
    void OnTriggerFireAnimation()
    {
        //return; //test
        //Debug.Log("OnTriggerFireAnimation**NpcName "+AnimatorCom.name);
        if (!XkGameCtrl.IsMoveOnPlayerDeath)
        {
            if (!XkGameCtrl.IsActivePlayerOne && !XkGameCtrl.IsActivePlayerTwo)
            {
                return;
            }
        }

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

        if (Network.peerType == NetworkPeerType.Client)
        {
            if (!IsDoHuanDanAction)
            {
                StartSpawnNpcAmmo();
                if (CountHuanDan > 0)
                {
                    CountFireAction++;
                    if (CountHuanDan <= CountFireAction)
                    {
                        CountFireAction = 0;
                        PlayNPCHuanDanAction();                         //Play huanDan action}
                    }
                }
            }
            return;
        }

        int rv = AddCountFireAction();

        if (Network.peerType == NetworkPeerType.Server)
        {
            if (XkGameCtrl.CountNpcAmmo >= XkGameCtrl.AmmoNumMaxNpc)
            {
                return;
            }
        }

        if (rv != -1)
        {
            StartSpawnNpcAmmo();
        }
    }
示例#14
0
    void OnTriggerEnter(Collider other)
    {
        if (IsDonnotSpawnNpcTest)
        {
            return;             //test.
        }

        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            return;
        }

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

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

        if (ScriptPlayer == null)
        {
            return;
        }

        if (Time.time - m_LastTriggerTime < 300f)
        {
            //冷却时间.
            return;
        }
        m_LastTriggerTime = Time.time;

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

        //Debug.Log("Unity:"+"XKTriggerSpawnNpc::OnTriggerEnter -> hit "+other.name);
        for (int i = 0; i < SpawnPointArray.Length; i++)
        {
//			if (SpawnPointArray[i].NpcObj.name != TestNpcName || SpawnPointArray[i].NpcFangZhen != null) {
//					continue; //test
//			}
//
//			if (IsDonnotSpawnNpcTest) {
//				return;
//			}
//			IsDonnotSpawnNpcTest = true;
            SpawnPointArray[i].SpawnPointAllNpc();
        }
    }
示例#15
0
    /// <summary>
    /// 被空袭击中UI提示动画结束事件响应.
    /// </summary>
    public void OnAnimationEnvent()
    {
        if (GameUICenterCtrl.GetInstance() != null)
        {
            GameUICenterCtrl.GetInstance().RemoveKongXiJiZhongUI();
        }

        if (!JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            DaoJiShiCtrl.GetInstance().StartPlayDaoJiShi();
        }
        XkGameCtrl.SetActivePlayerOne(false);
        XkGameCtrl.SetActivePlayerTwo(false);
    }
示例#16
0
    void OnTriggerEnter(Collider other)
    {
        if (IsDonnotSpawnNpcTest)
        {
            return;             //test;
        }

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

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

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

        //XkPlayerCtrl ScriptPlayer = other.GetComponent<XkPlayerCtrl>();
        //if (ScriptPlayer == null) {
        //	return;
        //}

        XKXuNiPlayerCtrl ScriptPlayer = other.GetComponent <XKXuNiPlayerCtrl>();

        if (ScriptPlayer == null)
        {
            return;
        }

        //test
        //		if (ScriptPlayer.PlayerSt == PlayerTypeEnum.FeiJi) {
        //			IsDonnotSpawnNpcTest = true;
        //		}
        //		else {
        //			return;
        //		}

        //Debug.Log("XKTriggerSpawnNpc::OnTriggerEnter -> hit "+other.name);
        for (int i = 0; i < SpawnPointArray.Length; i++)
        {
            SpawnPointArray[i].SpawnPointAllNpc();
        }
    }
示例#17
0
    void OnClickTiaoGuoBt()
    {
        XKGlobalData.GetInstance().PlayStartBtAudio();
        HiddenTiaoGuoBt();
        if (!JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            if (Network.peerType != NetworkPeerType.Server)
            {
                XKTriggerEndCartoon.GetInstance().CloseStartCartoon();
            }
        }

        /*else {
         *      JiFenJieMianCtrl.GetInstance().StopJiFenTime();
         * }*/
    }
 void SetActiveZuiGaoFen(bool isActive)
 {
     if (isActive)
     {
         //if ((JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
         //    || JiFenJieMianCtrl.GetInstance() == null) {
         if (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
         {
             isActive = false;
         }
         else if (gameObject.activeInHierarchy == false)
         {
             isActive = false;
         }
     }
     ZuiGaoFenObj.SetActive(isActive);
 }
示例#19
0
    void ChangeDaoJiShiVal()
    {
        if (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            StopDaoJiShi();
            return;
        }

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

        DaoJiShiCount--;
        DaoJiShiSprite.spriteName = "daoJiShi" + DaoJiShiCount;
        ShowDaoJiShiInfo();
    }
示例#20
0
    void Update()
    {
        if (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            if (InsertCoinObj.activeSelf)
            {
                InsertCoinObj.SetActive(false);
            }

            if (StartBtObj.activeSelf)
            {
                StartBtObj.SetActive(false);
            }
            return;
        }

        CheckPlayerOneCoinCur();
        CheckPlayerTwoCoinCur();
    }
    void OnTriggerEnter(Collider other)
    {
        if (IsDonnotSpawnNpcTest)
        {
            return;             //test.
        }

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

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

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

        if (ScriptPlayer == null)
        {
            return;
        }

        if (Time.time - m_LastTriggerTime < 300f)
        {
            //冷却时间.
            return;
        }
        m_LastTriggerTime = Time.time;

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

        StartCoroutine(DelayCreateNpc());
        //Debug.Log("Unity:"+"XKTriggerSpawnNpc::OnTriggerEnter -> hit "+other.name);
        //for (int i = 0; i < SpawnPointArray.Length; i++) {
        //	SpawnPointArray[i].SpawnPointAllNpc();
        //}
    }
    void Update()
    {
        if ((JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()) ||
            (PlayerSt == PlayerEnum.PlayerOne && XkGameCtrl.IsActivePlayerOne) ||
            (PlayerSt == PlayerEnum.PlayerTwo && XkGameCtrl.IsActivePlayerTwo))
        {
            if (InsertCoinObj.activeSelf)
            {
                InsertCoinObj.SetActive(false);
            }

            if (StartBtObj.activeSelf)
            {
                StartBtObj.SetActive(false);
            }
            return;
        }

        CheckPlayerOneCoinCur();
        CheckPlayerTwoCoinCur();
    }
    void OnTriggerEnter(Collider other)
    {
        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            return;
        }

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

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

        if (playerScript == null || !playerScript.GetIsHandleRpc())
        {
            return;
        }
        gameObject.SetActive(false);
        XkGameCtrl.GetInstance().SetIsStopMovePlayer(false);
        XkGameCtrl.GetInstance().SetIsActiveWuDiState(true);
    }
    public static void ShowDongGanInfo(PlayerEnum playerIndex)
    {
        if (!ScreenDanHeiCtrl.IsStartGame)
        {
            return;
        }

        if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            return;
        }

        DongGanUICtrl instanceDG = null;

        switch (playerIndex)
        {
        case PlayerEnum.PlayerOne:
            instanceDG = InstanceOne;
            break;

        case PlayerEnum.PlayerTwo:
            instanceDG = InstanceTwo;
            break;

        case PlayerEnum.PlayerThree:
            instanceDG = InstanceThree;
            break;

        case PlayerEnum.PlayerFour:
            instanceDG = InstanceFour;
            break;
        }

        if (instanceDG == null)
        {
            return;
        }
        instanceDG.AddDongGanCount();
    }
示例#25
0
    void ChangeDaoJiShiVal()
    {
        m_TimeLastChange     = Time.time;
        IsOpenChangeDaoJiShi = false;
        if (JiFenJieMianCtrl.GetInstance() != null && JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask())
        {
            StopDaoJiShi();
            return;
        }

        if (DaoJiShiCount <= 1)
        {
            StopDaoJiShi();
            ShowGameOverObj();
//			if (XkGameCtrl.PlayerActiveNum <= 0 && CountDaoJiShi > 0) {
//				Debug.LogWarning("Unity:"+"ChangeDaoJiShiVal -> CountDaoJiShi "+CountDaoJiShi);
//			}

            //玩家没有进行续币.
            //重置玩家续币信息.
            XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.ResetPlayerXuBiInfo(PlayerIndex);
            //if (XkGameCtrl.PlayerActiveNum <= 0 && CountDaoJiShi <= 0) {
            //	GameOverCtrl.GetInstance().ShowGameOver();
            //}

            XkGameCtrl.GetInstance().ResetPlayerInfo(PlayerIndex);

            if (XKGlobalData.GetInstance().m_SSGameXuMingData != null)
            {
                //如果当前机位游戏续命倒计时结束之后就清除续命计数信息.
                XKGlobalData.GetInstance().m_SSGameXuMingData.ResetXuMingCount(PlayerIndex);
            }
            return;
        }

        DaoJiShiCount--;
        DaoJiShiSprite.spriteName = "daoJiShi" + DaoJiShiCount;
        ShowDaoJiShiInfo();
    }
    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();
    }
    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);
        }
    }
    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();
        }
    }
示例#29
0
    IEnumerator MovePlayerByMarkSpeed()
    {
        bool isStopMove   = false;
        int  countNode    = 0;
        int  maxCountNode = PathNodes.Length;

        EndPos = PathNodes[1];

//		Debug.Log("Unity:"+"MovePlayerByMarkSpeed -> start time "+Time.realtimeSinceStartup);
        float timeLastVal     = Time.realtimeSinceStartup;
        float timeRotationVal = 0f;

        do
        {
            if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask() && XkGameCtrl.IsLoadingLevel)
            {
                Debug.Log("Unity:" + "MovePlayerByMarkSpeed -> IsLoadingLevel " + XkGameCtrl.IsLoadingLevel
                          + ", IsShowFinishTask " + JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask());
                yield break;
            }

            if (PlayerSt == PlayerTypeEnum.CartoonCamera)
            {
                if (XkGameCtrl.GetInstance().IsCartoonShootTest)
                {
                    Debug.Log("Unity:" + "MovePlayerByMarkSpeed -> IsCartoonShootTest "
                              + XkGameCtrl.GetInstance().IsCartoonShootTest);
                    yield break;
                }

                if (!PlayerCamera.GetActiveCamera())
                {
                    PlayerObj.SetActive(false);
                    isStopMove       = true;
                    IsStopMovePlayer = true;
                    yield break;
                }
            }
            else
            {
                if (XKPlayerHeTiData.IsActiveHeTiPlayer)
                {
                    IsStopMovePlayer = true;
                    yield break;
                }
            }

            if (IsMoveToAiMark)
            {
                countNode = 0;
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            if (XKTriggerStopMovePlayer.IsActiveTrigger)
            {
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            if (pcvr.GetInstance().m_SSMiGuTvCheck != null &&
                pcvr.GetInstance().m_SSMiGuTvCheck.IsDisplayMiGuPayUI)
            {
                //咪咕电视游戏支付界面显示时,停止镜头的运动.
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            if (XkGameCtrl.GetInstance().m_GameUICom != null &&
                XkGameCtrl.GetInstance().m_GameUICom.IsShowGameBaoYueUI)
            {
                //游戏包月UI界面显示时,停止镜头的运动.
                yield return(new WaitForSeconds(0.1f));

                continue;
            }

            if (XkGameCtrl.PlayerActiveNum <= 0)
            {
                //玩家激活数量小于1时,镜头停止前进.
                if (PlayerSt == PlayerTypeEnum.FeiJi)
                {
                    yield return(new WaitForSeconds(0.1f));

                    continue;
                }
            }

            if (XkGameCtrl.PlayerActiveNum <= 0 &&
                PlayerSt != PlayerTypeEnum.CartoonCamera)
            {
                if (!XkGameCtrl.IsMoveOnPlayerDeath)
                {
                    XkGameCtrl.PlayerYouLiangCur = 0;
                    timeLastVal = Time.realtimeSinceStartup;
                    yield return(new WaitForSeconds(0.1f));

                    continue;
                }
            }
            else
            {
                if (IsDelayMovePlayer)
                {
                    IsDelayMovePlayer = false;
                    ResetIsPlayerTingLiu();
                    yield return(new WaitForSeconds(TimeDelayMove));

                    continue;
                }
            }

            float ds    = 0f;
            float dTime = Time.realtimeSinceStartup - timeLastVal;
            if (dTime > 1f)
            {
                dTime = TimeUnitMove;
            }

            /*else {
             *      float minTimeUnit = 0.03f;
             *      dTime = dTime > minTimeUnit ? minTimeUnit : dTime;
             * }*/

            bool isRecordDTime = false;
            if (XkGameCtrl.GameJiTaiSt == GameJiTaiType.FeiJiJiTai)
            {
                if (PlayerSt == PlayerTypeEnum.FeiJi)
                {
                    isRecordDTime = true;
                }
            }
            else if (XkGameCtrl.GameJiTaiSt == GameJiTaiType.TanKeJiTai)
            {
                if (PlayerSt == PlayerTypeEnum.TanKe)
                {
                    isRecordDTime = true;
                }
            }

            if (isRecordDTime)
            {
                TestDTimeVal = dTime;
            }

            //dTime = TimeUnitMove; //test
            timeLastVal = Time.realtimeSinceStartup;
            float disAimNode = Vector3.Distance(transform.position, EndPos);
            if (JiaSuDuVal == 0)
            {
                ds = SpeedA * dTime;
            }
            else
            {
                ds = (SpeedA * dTime) + (0.5f * JiaSuDuVal * Mathf.Pow(dTime, 2f));
                if ((SpeedA >= SpeedB && JiaSuDuVal >= 0f) ||
                    (SpeedA <= SpeedB && JiaSuDuVal <= 0f))
                {
                    SpeedA = SpeedB;
                }
                else
                {
                    if (disAimNode >= ds)
                    {
                        SpeedA = SpeedA + (JiaSuDuVal * dTime);
                    }
                    else
                    {
                        float speedValTmp = 2f * JiaSuDuVal * disAimNode + Mathf.Pow(SpeedA, 2f);
                        if (speedValTmp > 0)
                        {
                            SpeedA = Mathf.Sqrt(speedValTmp);
                        }
                    }

                    if ((SpeedA >= SpeedB && JiaSuDuVal >= 0f) ||
                        (SpeedA <= SpeedB && JiaSuDuVal <= 0f))
                    {
                        SpeedA = SpeedB;
                    }
                }
            }

            if (XkGameCtrl.GameJiTaiSt == GameJiTaiType.FeiJiJiTai && PlayerSt == PlayerTypeEnum.FeiJi)
            {
                TestSpeed = SpeedA;
            }
            else if (XkGameCtrl.GameJiTaiSt == GameJiTaiType.TanKeJiTai && PlayerSt == PlayerTypeEnum.TanKe)
            {
                TestSpeed = SpeedA;
            }

            if (PlayerSt == PlayerTypeEnum.FeiJi ||
                PlayerSt == PlayerTypeEnum.CartoonCamera)
            {
                timeRotationVal += dTime;
                if (timeRotationVal <= TimeRotation)
                {
                    float perRot = timeRotationVal / TimeRotation;
                    perRot             = perRot > 1f ? 1f : perRot;
                    transform.rotation = Quaternion.Lerp(RotationStart, RotationEnd, perRot);
                }
            }
            else
            {
                if (Vector3.Distance(EndPos, transform.position) > 0.01f)
                {
                    Vector3 forwardVal = Vector3.Normalize(EndPos - transform.position);
                    transform.forward = Vector3.Lerp(transform.forward, forwardVal, dTime * SpeedA * 0.5f);
                }
            }
//			Debug.Log("Unity:"+"SpeedA "+SpeedA+", ds "+ds+", dTime "+dTime);

            if (disAimNode <= ds)
            {
//				Debug.Log("Unity:"+"Over, ds "+ds+", realDis "+Vector3.Distance(transform.position, EndPos)+", time "+dTime);
                countNode++;
                float disVal  = ds - disAimNode;
                float disNode = 0f;
                int   count   = 0;
                for (int i = countNode; i < (maxCountNode - 2); i++)
                {
                    if ((i + 1) >= PathNodes.Length)
                    {
                        break;
                    }

                    disNode = Vector3.Distance(PathNodes[i], PathNodes[i + 1]);
                    if (disVal > disNode)
                    {
                        disVal = disVal - disNode;
                        count++;
                        transform.position = PathNodes[countNode];
                        SmothMovePlayerCamera();
                    }
                    else
                    {
                        break;
                    }
                }
                countNode += count;

                /*if (count > 0) {
                 *      string outPut = PlayerSt == PlayerTypeEnum.FeiJi ? "feiJi: " : "tanKe: ";
                 *      outPut += "countNode "+countNode+",count "+count+", maxCountNode "+maxCountNode;
                 *      Debug.Log("Unity:"+outPut);
                 * }*/

                if (countNode < (maxCountNode - 1) && (countNode + 1) < PathNodes.Length)
                {
                    transform.position = EndPos;
                    SmothMovePlayerCamera();
                    EndPos         = PathNodes[countNode + 1];                       //更新EndPos.
                    ForwardMoveVal = Vector3.Normalize(EndPos - transform.position); //更新ForwardMoveVal.

//					Debug.Log("Unity:"+"***realDis "+Vector3.Distance(transform.position, EndPos));
//					Debug.Log("Unity:"+"***ForwardMoveVal "+Vector3.Distance(ForwardMoveVal, Vector3.zero));
                    yield return(new WaitForSeconds(TimeUnitMove));

                    continue;
                }
                else
                {
                    if (IsPlayerTingLiu)
                    {
                        TimeTingLiuValStart = Time.realtimeSinceStartup;
                        yield return(new WaitForSeconds(TimeTingLiuVal));

                        if (!XkGameCtrl.IsMoveOnPlayerDeath)
                        {
                            if (XkGameCtrl.IsActivePlayerOne || XkGameCtrl.IsActivePlayerTwo)
                            {
                                if (!IsDelayMovePlayer)
                                {
                                    ResetIsPlayerTingLiu();
                                }
                            }
                        }
                        else
                        {
                            if (!IsDelayMovePlayer)
                            {
                                ResetIsPlayerTingLiu();
                            }
                        }
                    }

                    timeLastVal        = Time.realtimeSinceStartup;
                    timeRotationVal    = 0f;
                    SpeedA             = SpeedB;
                    transform.position = EndPos;
                    SmothMovePlayerCamera();

                    if (!MovePlayerOnCompelteITween())
                    {
                        isStopMove = true;
                        break;
                    }
                    countNode    = 0;
                    maxCountNode = PathNodes.Length;
                    yield return(new WaitForSeconds(TimeUnitMove));

                    continue;
                }
            }

            transform.position += (ForwardMoveVal * ds);
            SmothMovePlayerCamera();
            yield return(new WaitForSeconds(TimeUnitMove));
        } while (!isStopMove);
    }
示例#30
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;
//				}
            }
        }
    }