/// <summary> /// 循环产生空袭导弹. /// </summary> IEnumerator LoopSpawnKongXiDaoDan(GameObject playerDaoDan) { bool isDamagePlayer = false; do { if (KongXiDt.IsRemoveKongXiZuDang) { Debug.Log("LoopSpawnKongXiDaoDan -> stop!"); yield break; } Debug.Log("LoopSpawnKongXiDaoDan -> time " + Time.time); int max = KongXiDt.AmmoPointTr.Length; for (int i = 0; i < max; i++) { if (mPlayerScript != null && KongXiDt.AmmoPointTr[i] != null) { KongXiDt.AmmoPointTr[i].gameObject.SetActive(false); mPlayerScript.SpawnPlayerDaoDan(KongXiDt.AmmoPointTr[i], playerDaoDan); } } if (!isDamagePlayer) { Vector3 pos1 = KongXiDt.KongXiDianObj.transform.position; Vector3 pos2 = XkPlayerCtrl.GetInstanceTanKe().transform.position; pos1.y = pos2.y = 0f; if (Vector3.Distance(pos1, pos2) <= KongXiDt.DamageDis) { isDamagePlayer = true; XkGameCtrl.GetInstance().SubPlayerYouLiang(PlayerEnum.PlayerOne, KongXiDt.PlayerDamage); XkGameCtrl.GetInstance().SubPlayerYouLiang(PlayerEnum.PlayerTwo, KongXiDt.PlayerDamage); if (GameUICenterCtrl.GetInstance() != null) { GameUICenterCtrl.GetInstance().RemoveKongXiZuDangUI(); GameUICenterCtrl.GetInstance().RemoveKongXiShanHongUI(); GameUICenterCtrl.GetInstance().RemoveKongXiDaoJishiUI(); GameUICenterCtrl.GetInstance().SpawnKongXiJiZhongUI(); } if (mPlayerScript.GetPlayerCameraScript() != null) { //画面开始变黑白. mPlayerScript.GetPlayerCameraScript().mCameraColorChange.Init(); } } } yield return(new WaitForSeconds(KongXiDt.TimeLoopDaoDan)); }while (!KongXiDt.IsRemoveKongXiZuDang); }
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; }
void OnTriggerEnter(Collider other) { if (XKTriggerKaQiuShaFire.IsCloseKaQiuShaTest) { return; //test; } if (Network.peerType == NetworkPeerType.Server) { 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; } Instance = this; Debug.Log("Unity:" + "XKTriggerCameraFieldOfView -> OnTriggerEnter..."); XKPlayerCamera cameraScript = playerScript.GetPlayerCameraScript(); CameraObj = cameraScript.gameObject; TweenCamFOV = CameraObj.GetComponent <TweenFOV>(); if (TweenCamFOV != null) { DestroyObject(TweenCamFOV); } PlayerCamera = CameraObj.GetComponent <Camera>(); CameraFieldViewStart = PlayerCamera.fieldOfView; TweenCamFOV = CameraObj.AddComponent <TweenFOV>(); TweenCamFOV.enabled = false; TweenCamFOV.from = CameraFieldViewStart; TweenCamFOV.to = CameraFieldView; TweenCamFOV.duration = TimeChangeCamFOV; EventDelegate.Add(TweenCamFOV.onFinished, delegate { ChangeWorldTimeVal(0); }); TweenCamFOV.enabled = true; TweenCamFOV.PlayForward(); }