void CheckServerPortCamera() { switch (CameraType) { case PlayerTypeEnum.FeiJi: if (XkPlayerCtrl.GetInstanceFeiJi() == null) { if (XkPlayerCtrl.GetInstanceTanKe() != null) { CloseCameraServer(); ServerPortCameraCtrl.GetInstanceTK().ActiveServerPortCamera(); } return; } break; case PlayerTypeEnum.TanKe: if (XkPlayerCtrl.GetInstanceTanKe() == null) { if (XkPlayerCtrl.GetInstanceFeiJi() != null) { CloseCameraServer(); ServerPortCameraCtrl.GetInstanceFJ().ActiveServerPortCamera(); } return; } break; } }
// Use this for initialization void Awake() { Debug.Log("Init serverPortCamera -> CameraType " + CameraType); switch (CameraType) { case PlayerTypeEnum.FeiJi: _InstanceFJ = this; break; case PlayerTypeEnum.TanKe: _InstanceTK = this; break; } CameraTran = transform; CameraObj = gameObject; // MinRandTime = XkGameCtrl.GetInstance().MinRandTimeServer; // MaxRandTime = XkGameCtrl.GetInstance().MaxRandTimeServer; }
void CheckTanKeLocalPostion() { transform.position = TranParent.position; // if (posLoc.x != 0f) { // posLoc.x = 0f; // isChangePos = true; // } // // if (posLoc.z != 0f) { // posLoc.z = 0f; // isChangePos = true; // } // // if (isChangePos) { // transform.localPosition = posLoc; // } if (ServerPortCameraCtrl.GetInstanceTK() != null) { ServerPortCameraCtrl.GetInstanceTK().CheckCameraFollowTran(); } }
public static void RandOpenServerPortCamera() { // bool isTestTK = false; // if (isTestTK) { // ServerPortCameraCtrl.GetInstanceTK().ActiveServerPortCamera(); // return; // } int randVal = Random.Range(0, 100) % 2; if (randVal == 0) { CountTK = 0; CountFJ++; if (CountFJ > 2) { CountFJ = 0; CountTK++; ServerPortCameraCtrl.GetInstanceTK().ActiveServerPortCamera(); return; } ServerPortCameraCtrl.GetInstanceFJ().ActiveServerPortCamera(); } else { CountFJ = 0; CountTK++; if (CountTK > 2) { CountTK = 0; CountFJ++; ServerPortCameraCtrl.GetInstanceFJ().ActiveServerPortCamera(); return; } ServerPortCameraCtrl.GetInstanceTK().ActiveServerPortCamera(); } }
public void SmothMoveCamera() { if (XKPlayerHeTiData.IsActiveHeTiPlayer) { if (PlayerSt == PlayerTypeEnum.FeiJi || PlayerSt == PlayerTypeEnum.TanKe) { this.enabled = false; return; } } if (CameraParent == null) { return; } if (PlayerScript.PlayerSt == PlayerTypeEnum.FeiJi || PlayerScript.PlayerSt == PlayerTypeEnum.CartoonCamera) { if (Vector3.Distance(CameraTran.position, CameraParent.position) > 30f) { CameraTran.position = CameraParent.position; CameraTran.rotation = CameraParent.rotation; } else { // CameraTran.position = Vector3.Lerp(CameraTran.position, CameraParent.position, Time.deltaTime); CameraTran.position = Vector3.Lerp(CameraTran.position, CameraParent.position, GenZongCamPosVal); } } else { if (!CameraShake.IsCameraShake) { //CameraTran.position = CameraParent.position; if (Vector3.Distance(CameraTran.position, CameraParent.position) > 30f) { CameraTran.position = CameraParent.position; CameraTran.rotation = CameraParent.rotation; } else { CameraTran.position = Vector3.Lerp(CameraTran.position, CameraParent.position, Time.deltaTime); } } } SmothChangeCameraRot(); if (PlayerScript.PlayerSt == PlayerTypeEnum.FeiJi) { if (ServerPortCameraCtrl.GetInstanceFJ() != null) { ServerPortCameraCtrl.GetInstanceFJ().CheckCameraFollowTran(); } } else if (PlayerScript.PlayerSt == PlayerTypeEnum.TanKe) { if (ServerPortCameraCtrl.GetInstanceTK() != null) { ServerPortCameraCtrl.GetInstanceTK().CheckCameraFollowTran(); } } }
void OnTriggerEnter(Collider other) { if (XKTriggerKaQiuShaFire.IsCloseKaQiuShaTest) { return; //test; } if (Network.peerType != NetworkPeerType.Disconnected) { if (Network.peerType == NetworkPeerType.Server) { if (FeiJiMarkCom != null && TanKeMarkCom != null) { IsActiveHeTiCloseUI = true; ServerPortCameraCtrl.CloseAllServerPortCamera(); } return; } } if (DaoJiShiCtrl.GetInstance().GetIsPlayDaoJishi() || GameOverCtrl.IsShowGameOver) { return; } XkPlayerCtrl playerScript = other.GetComponent <XkPlayerCtrl>(); if (playerScript == null) { return; } if (playerScript.PlayerSt == PlayerTypeEnum.FeiJi && XkGameCtrl.GameJiTaiSt != GameJiTaiType.FeiJiJiTai) { return; } if (playerScript.PlayerSt == PlayerTypeEnum.TanKe && XkGameCtrl.GameJiTaiSt != GameJiTaiType.TanKeJiTai) { return; } if (FeiJiMarkCom != null && TanKeMarkCom != null && IsActiveHeTiCloseUI) { return; } IsClosePlayerUI = true; CheckIsPlayDaoJiShi(); ScreenDanHeiCtrl.GetInstance().ClosePlayerUI(); if (FeiJiMarkCom != null && TanKeMarkCom != null) { IsActiveHeTiCloseUI = true; if (Network.peerType == NetworkPeerType.Client && NetCtrl.GetInstance() != null) { NetCtrl.GetInstance().TryActiveHeTiPlayerEvent(); } ScreenDanHeiCtrl.GetInstance().OpenStartCamera(); ScreenDanHeiCtrl.GetInstance().OpenScreenDanHui(1); GameMode modeVal = XkGameCtrl.GameModeVal; switch (modeVal) { case GameMode.DanJiFeiJi: playerScript.MakePlayerMoveToAiMark(FeiJiMarkCom); break; case GameMode.DanJiTanKe: playerScript.MakePlayerMoveToAiMark(TanKeMarkCom); break; case GameMode.LianJi: if (Network.peerType != NetworkPeerType.Disconnected) { if (XkPlayerCtrl.GetInstanceFeiJi() != null) { XkPlayerCtrl.GetInstanceFeiJi().MakePlayerMoveToAiMark(FeiJiMarkCom); } if (XkPlayerCtrl.GetInstanceTanKe() != null) { XkPlayerCtrl.GetInstanceTanKe().MakePlayerMoveToAiMark(TanKeMarkCom); } } else { XkPlayerCtrl.GetInstanceFeiJi().MakePlayerMoveToAiMark(FeiJiMarkCom); XkPlayerCtrl.GetInstanceTanKe().MakePlayerMoveToAiMark(TanKeMarkCom); } // if (XkGameCtrl.GetInstance().IsServerCameraTest) { // ServerPortCameraCtrl.CloseAllServerPortCamera(); // } break; } } gameObject.SetActive(false); }