private void EnableControl() { if (Scene.CurScene != Scene.Type.BATTLE) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null && @char.IsReady3DModel()) { GameObject rootGameObject = @char.Get3DChar().GetRootGameObject(); if (rootGameObject != null) { this.target = rootGameObject.transform; } } } else { GameObject gameObject = GameObject.Find("BattleCameraTarget"); if (gameObject != null) { this.target = gameObject.transform; } } this.m_DisableContorl = false; this.CameraWork(); }
public void CleanWideCollArea() { int[] array = new int[3]; int num = 0; foreach (KeyValuePair <int, Vector2> current in this.m_kWideCollArea) { if (current.Key != 0) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(current.Key); if (@char == null || [email protected]()) { array[num++] = current.Key; } if (num >= 3) { break; } } } for (int i = 0; i < num; i++) { this.DelWideCollArea(array[i]); } }
private void FixedUpdate() { if (!this.MakeComplete && this.m_MakeNpcTable != null) { this.MakeComplete = true; if (this.m_MakeNpcTable.Count > 0) { foreach (SubNpc current in this.m_MakeNpcTable.Values) { if (!current.bLoad) { NrCharBase charByCharUnique = NrTSingleton <NkCharManager> .Instance.GetCharByCharUnique(current.i16CharUnique); if (charByCharUnique != null) { if (!charByCharUnique.IsGround()) { this.MakeComplete = false; } if (charByCharUnique.IsReady3DModel()) { charByCharUnique.SetShowHide3DModel(false, false, false); current.bLoad = true; } } } } } if (this.MakeComplete && this._CompleteFunc != null) { this._CompleteFunc(this); base.enabled = false; } } }
public void SetLevelValue() { if (this.m_DisableContorl) { return; } CAMERASETTING_DATA cameraData = NrTSingleton <NkCameraSettingsManager> .Instance.GetCameraData(this.m_nCameraLevel); if (this.m_bUseCameraLevel && cameraData != null) { this.yMaxLimit = cameraData.m_YRotate; this.yDeg = maxCamera.ClampAngle(this.yDeg, this.yMinLimit, this.yMaxLimit); this.rotation = Quaternion.Euler(this.yDeg, this.xDeg, 0f); base.transform.rotation = this.rotation; NrPersonInfoUser charPersonInfo = NrTSingleton <NkCharManager> .Instance.GetCharPersonInfo(1); if (charPersonInfo != null) { NkSoldierInfo soldierInfo = charPersonInfo.GetSoldierInfo(0); if (soldierInfo == null) { return; } if (soldierInfo.GetSolID() <= 0L) { return; } this.fLevelHeight = cameraData.GetTribeHeight(soldierInfo.GetCharKindInfo().GetCharTribe()); if (this.fTargetHeight == 0f) { this.fTargetHeight = this.fLevelHeight; } if (Scene.CurScene == Scene.Type.WORLD) { this.minDistance = cameraData.GetTribeZoom(soldierInfo.GetCharKindInfo().GetCharTribe()); this.maxDistance = cameraData.GetTribeZoom(soldierInfo.GetCharKindInfo().GetCharTribe()); } else { this.minDistance = cameraData.m_Zoom; this.maxDistance = cameraData.m_Zoom; } } if (Scene.CurScene == Scene.Type.WORLD && this.m_nCameraLevel >= NrTSingleton <NkCameraSettingsManager> .Instance.GetMaxLevel() - 1) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null && @char.IsReady3DModel()) { @char.SetShowHide3DModel(false, false, false); } } this.m_bDistanceMove = true; } }
public static bool IsLoadedStage() { if (Scene.IsCurScene(Scene.Type.WORLD) && StageSystem.IsStable) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null && @char.IsReady3DModel()) { return(true); } } return(false); }
public void CameraWork() { if (null == this.target) { this.Init(); return; } CAMERASETTING_DATA cAMERASETTING_DATA = null; if (this.m_bUseCameraLevel) { cAMERASETTING_DATA = NrTSingleton <NkCameraSettingsManager> .Instance.GetCameraData(this.m_nCameraLevel); } float num = 0f; float num2 = 0f; if (this.GetAxisRange(ref num, ref num2)) { this.xDeg += num; if (this.m_bUseCameraLevel && cAMERASETTING_DATA != null) { this.yDeg -= num2; this.yDeg = maxCamera.ClampAngle(this.yDeg, this.yMinLimit, cAMERASETTING_DATA.m_YRotate); } else { this.yDeg -= num2; this.yDeg = maxCamera.ClampAngle(this.yDeg, this.yMinLimit, this.yMaxLimit); } this.rotation = Quaternion.Euler(this.yDeg, this.xDeg, 0f); base.transform.rotation = this.rotation; } else if (this.bFollowHero) { float num3 = this.target.rotation.eulerAngles.y; if (Mathf.Abs(this.xDeg - num3) > 180f) { num3 += 360f; } this.fFollowHeroDepending = 1.25f; this.fFollowHeroDepending += 1f; this.fFollowHeroDepending = Time.deltaTime * this.fFollowHeroDepending; this.xDeg = Mathf.Lerp(this.xDeg, num3, this.fFollowHeroDepending); this.yDeg = Mathf.Lerp(this.yDeg, 5f, this.fFollowHeroDepending); this.rotation = Quaternion.Euler(this.yDeg, this.xDeg, 0f); base.transform.rotation = this.rotation; } if (this.m_bUseCameraLevel && cAMERASETTING_DATA != null) { if (this.m_bDistanceMove) { this.desiredDistance = Mathf.Clamp(this.desiredDistance, this.minDistance, this.maxDistance); this.currentDistance = Mathf.Lerp(this.m_fBeforeCurrentDistance, this.desiredDistance, (Time.time - this.m_fLerpStartTime) / cAMERASETTING_DATA.m_LerpTime); if (this.desiredDistance == this.currentDistance) { if (this.m_nCameraLevel < NrTSingleton <NkCameraSettingsManager> .Instance.GetMaxLevel() - 1) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null && @char.IsReady3DModel()) { @char.SetShowHide3DModel(true, true, true); } } this.m_bDistanceMove = false; } } } else { float axis = Input.GetAxis("Mouse ScrollWheel"); if (!this.m_bToolCamera && axis != 0f && NrTSingleton <FormsManager> .Instance.IsMouseOverForm()) { return; } this.desiredDistance -= axis * Time.deltaTime * (float)this.zoomRate * Mathf.Abs(this.desiredDistance); this.desiredDistance = Mathf.Clamp(this.desiredDistance, this.minDistance, this.maxDistance); this.currentDistance = Mathf.Lerp(this.currentDistance, this.desiredDistance, Time.deltaTime * this.zoomDampening); } if (this.bCullisionCamera) { this.position = this.CullisionCamera(); } else { this.position = this.target.position - (base.transform.rotation * Vector3.forward * this.currentDistance + this.targetOffset); } base.transform.position = this.position; Camera component = base.GetComponent <Camera>(); if (this.m_bUseCameraLevel && cAMERASETTING_DATA != null) { this.fieldOfView = Mathf.Lerp(this.m_fBeforeFov, cAMERASETTING_DATA.GetFOV(), (Time.time - this.m_fLerpStartTime) / cAMERASETTING_DATA.m_LerpTime); } component.fieldOfView = this.fieldOfView; }
public void Init() { if (!this.target) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null && @char.IsReady3DModel()) { GameObject rootGameObject = @char.Get3DChar().GetRootGameObject(); if (rootGameObject != null) { this.target = rootGameObject.transform; } } if (!this.target) { return; } } if (this.m_DisableContorl) { return; } this.RestoreCameraInfo(); this.distance = Vector3.Distance(base.transform.position, this.target.position); this.currentDistance = this.distance; this.desiredDistance = this.distance; this.xDeg = this.target.rotation.eulerAngles.y; this.yDeg = 35f; this.yDeg = maxCamera.ClampAngle(this.yDeg, this.yMinLimit, this.yMaxLimit); this.rotation = Quaternion.Euler(this.yDeg, this.xDeg, 0f); base.transform.rotation = this.rotation; this.BackUpCameraInfo(); if (!this.m_bBattleCamera) { this.maxDistance = 12f; this.minDistance = 1.4f; this.xSpeed = 4f; this.ySpeed = 4f; this.yMinLimit = -70f; this.yMaxLimit = 80f; this.zoomRate = 20; this.panSpeed = 0.5f; this.zoomDampening = 6f; base.camera.fieldOfView = 60f; if (TsPlatform.IsMobile) { this.m_nCameraLevel = 2; } } else { this.maxDistance = 24f; this.minDistance = 3f; this.xSpeed = 4f; this.ySpeed = 4f; this.yMinLimit = 2f; this.yMaxLimit = 80f; this.zoomRate = 25; this.panSpeed = 0.5f; this.zoomDampening = 6f; this.currentDistance = 200f; this.desiredDistance = 200f; Camera component = base.GetComponent <Camera>(); if (component != null) { this.fieldOfView = 35f; this.xDeg = 280f; this.yDeg = 45f; this.rotation = Quaternion.Euler(this.yDeg, this.xDeg, 0f); base.transform.rotation = this.rotation; this.CameraWork(); } } if (this.m_bUseCameraLevel) { this.SetLevelValue(); } AudioListener component2 = base.GetComponent <AudioListener>(); if (component2 != null) { component2.enabled = false; } this.StartCameraControl(); }
public static bool IsLoadMyChar() { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); return(@char != null && @char.IsReady3DModel()); }