2241 lines
61 KiB
C#
2241 lines
61 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
// Token: 0x02000007 RID: 7
|
|
public class RtsCamera : MonoBehaviour
|
|
{
|
|
// Token: 0x06000048 RID: 72 RVA: 0x00006DD8 File Offset: 0x00004FD8
|
|
private void Awake()
|
|
{
|
|
this._initialMinDistance = this.MinDistance;
|
|
this.tr = base.transform;
|
|
if (!this.cameraTarget)
|
|
{
|
|
this.CreateTarget();
|
|
}
|
|
this.cam = base.gameObject.GetComponent<Camera>();
|
|
this.groundPlane = new Plane(Vector3.up, 0f);
|
|
this.groundPlaneDown = new Plane(Vector3.down, 0f);
|
|
this.colliderPlane = new Plane(Vector3.up, 0f);
|
|
this.cameraPlane = new Plane(Vector3.down, 250f);
|
|
this.startNearClipPlane = this.cam.nearClipPlane;
|
|
new GameObject("Bokeh Follow");
|
|
this._currOrtho = 13.5f;
|
|
this.savedMinOrtho = this._currOrtho;
|
|
this.Ortho = 13.5f;
|
|
this.initialMinOrtho = this.MinOrtho;
|
|
Shader.SetGlobalFloat("_CloseUp", 0f);
|
|
Shader.SetGlobalFloat("_Perspective", 0f);
|
|
this.topCam.farClipPlane = this.cam.farClipPlane;
|
|
this.topCam.nearClipPlane = this.cam.nearClipPlane;
|
|
this.savedNearClip = this.cam.nearClipPlane;
|
|
this.savedFarClip = this.cam.farClipPlane;
|
|
}
|
|
|
|
// Token: 0x06000049 RID: 73 RVA: 0x00006F2C File Offset: 0x0000512C
|
|
public void CameraStart()
|
|
{
|
|
this.cam.enabled = true;
|
|
this.SetCameraParams();
|
|
this._initialLookAt = this.LookAt;
|
|
this._initialDistance = this.Distance;
|
|
this._initialRotation = this.Rotation;
|
|
this._initialTilt = this.MinTilt;
|
|
this._currDistance = this.Distance;
|
|
this._currRotation = this.Rotation;
|
|
this._currTilt = this.Tilt;
|
|
this.cameraControls = Links.x.cameraControls;
|
|
this.SavedZoomDampening = this.cameraControls.ZoomDampening;
|
|
this.SavedMoveDampening = this.cameraControls.MoveDampening;
|
|
Links.x.cameraEffects.CreateNormalsCamera(false);
|
|
this.cameraTargetTr.parent = Links.x.gameplay.gameObject.transform;
|
|
this.mainCameraCulling = this.cam.cullingMask;
|
|
}
|
|
|
|
// Token: 0x0600004A RID: 74 RVA: 0x00007016 File Offset: 0x00005216
|
|
public void SetCameraParams()
|
|
{
|
|
if (!this.cam)
|
|
{
|
|
this.cam = base.gameObject.GetComponent<Camera>();
|
|
}
|
|
this.SetShadows();
|
|
QualitySettings.shadowNearPlaneOffset = 0f;
|
|
}
|
|
|
|
// Token: 0x0600004B RID: 75 RVA: 0x00007048 File Offset: 0x00005248
|
|
public void SetShadows()
|
|
{
|
|
if (Records.x.inMenus || Records.x.dialogue || Links.x.rallyStage.playing)
|
|
{
|
|
if (Records.x.windows)
|
|
{
|
|
QualitySettings.shadowDistance = 300f;
|
|
QualitySettings.shadowProjection = ShadowProjection.CloseFit;
|
|
return;
|
|
}
|
|
if (QualitySettings.shadowDistance > 200f)
|
|
{
|
|
QualitySettings.shadowDistance = 25f;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (Records.x.windows)
|
|
{
|
|
QualitySettings.shadowDistance = 250f;
|
|
QualitySettings.shadowProjection = ShadowProjection.StableFit;
|
|
return;
|
|
}
|
|
if (QualitySettings.shadowDistance < 200f)
|
|
{
|
|
QualitySettings.shadowDistance = 250f;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600004C RID: 76 RVA: 0x000070E5 File Offset: 0x000052E5
|
|
public void SwitchScene()
|
|
{
|
|
this.Tilt = 33f;
|
|
this.sceneName = Links.x.diorama.sceneName;
|
|
}
|
|
|
|
// Token: 0x0600004D RID: 77 RVA: 0x00007107 File Offset: 0x00005307
|
|
public void StartShake(string type)
|
|
{
|
|
if (Links.x.options.screenShake)
|
|
{
|
|
this.cameraShake = true;
|
|
this.cameraShakeTime = Time.timeSinceLevelLoad;
|
|
this.cameraShakeType = type;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600004E RID: 78 RVA: 0x00007138 File Offset: 0x00005338
|
|
private void LateUpdate()
|
|
{
|
|
this.DoUpdate();
|
|
this.UpdateCamera();
|
|
}
|
|
|
|
// Token: 0x0600004F RID: 79 RVA: 0x00007148 File Offset: 0x00005348
|
|
private void DoUpdate()
|
|
{
|
|
Vector3 lookAt = this.LookAt;
|
|
if (!this.puzzleTarget)
|
|
{
|
|
if (Links.x.main)
|
|
{
|
|
Shader.SetGlobalVector("_PlayerShadowPosition", Links.x.main.tr.position + new Vector3(0f, 3f, 0f));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Shader.SetGlobalVector("_PlayerShadowPosition", this.puzzleTarget.transform.position + new Vector3(0f, 3f, 0f));
|
|
}
|
|
this.SetShadows();
|
|
if (Links.x.hasMain && !this.puzzleTarget)
|
|
{
|
|
bool flag = this.AreCharacterAndCameraTogether();
|
|
SceneCamera sceneCamera = this.ShouldCharacterBeInPerspectiveCamera();
|
|
bool flag2 = this.ShouldCharacterBeInOrthoCamera();
|
|
if (sceneCamera)
|
|
{
|
|
flag2 = false;
|
|
}
|
|
if (Links.x.main.indoorID != "" && Links.x.main.indoorID != "?" && this.currentBoundsName != Links.x.main.indoorID)
|
|
{
|
|
this.GetCameraBounds();
|
|
}
|
|
if (!Links.x.cameraEffects.transitioning && Links.x.gaia.sceneLoaded && !Links.x.combat.inPocketAttack)
|
|
{
|
|
if (!flag)
|
|
{
|
|
if (Links.x.main.indoorID != "" && !Links.x.cameraEffects.indoors)
|
|
{
|
|
this.JumpTo(Links.x.main.tr, true);
|
|
}
|
|
if (Links.x.main.indoorID == "" && Links.x.cameraEffects.indoors)
|
|
{
|
|
this.JumpTo(Links.x.main.tr, true);
|
|
}
|
|
this.GetCameraBounds();
|
|
this.doorJumpCharacter = null;
|
|
this.Jump(Links.x.main.tr.position);
|
|
}
|
|
if (!Links.x.inspectTextAnimator.gameObject.activeSelf || (Links.x.inspectTextAnimator.gameObject.activeSelf && Links.x.inspectTextAnimator.GetCurrentAnimatorStateInfo(0).IsName("InspectOff")))
|
|
{
|
|
if (sceneCamera)
|
|
{
|
|
string text = Links.x.diorama.GetIndoorView().GetInteriorBoundsName(Links.x.main.tr.position);
|
|
if (text == "?")
|
|
{
|
|
text = "";
|
|
}
|
|
Records.x.inspectCamera = sceneCamera;
|
|
if (text == "" || text == "?")
|
|
{
|
|
Records.x.previousView = Links.x.diorama.GetOutdoorView();
|
|
}
|
|
else
|
|
{
|
|
Records.x.previousView = Links.x.diorama.GetIndoorView();
|
|
}
|
|
Links.x.diorama.ToggleSceneCameras(Records.x.inspectCamera.isInterior, Records.x.inspectCamera.id);
|
|
Links.x.rtsCamera.CopyPerspectiveCamera(Links.x.diorama.activeView.sceneCamera, null, null);
|
|
Links.x.cameraEffects.ToggleInteriorExterior(Links.x.main);
|
|
Records.x.inspecting = true;
|
|
}
|
|
else if (flag2 && !Records.x.removeControls && this.savedPerspectiveCam != null && !this.cam.orthographic)
|
|
{
|
|
Records.x.previousView = null;
|
|
if (Links.x.main.indoorID != "" && Links.x.main.indoorID != "?")
|
|
{
|
|
Records.x.previousView = Links.x.diorama.GetIndoorView();
|
|
}
|
|
else
|
|
{
|
|
Records.x.previousView = Links.x.diorama.GetOutdoorView();
|
|
}
|
|
Records.x.inspecting = false;
|
|
Links.x.diorama.ToggleSceneCameras(true, Records.x.previousView.id);
|
|
Links.x.rtsCamera.ReturnOrthographicCamera();
|
|
Links.x.cameraEffects.ToggleInteriorExterior(Links.x.main);
|
|
Links.x.rtsCamera.Follow(Links.x.main.tr, Links.x.main, true);
|
|
Records.x.inspectCamera = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!this.cam.orthographic)
|
|
{
|
|
return;
|
|
}
|
|
if (Time.timeScale > 0.95f)
|
|
{
|
|
this.currentTimeDelta = Time.deltaTime;
|
|
if (Records.x.filming)
|
|
{
|
|
this.currentTimeDelta = Time.deltaTime * Records.x.filmingAnimatorSpeed;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.currentTimeDelta = Time.unscaledDeltaTime;
|
|
this.cameraShakeTime = 0f;
|
|
this.cameraShake = false;
|
|
}
|
|
if (this.cameraShake)
|
|
{
|
|
float num = 0.5f;
|
|
if (this.cameraShakeType == "Small")
|
|
{
|
|
num = 0.15f;
|
|
}
|
|
if (Time.timeSinceLevelLoad > this.cameraShakeTime + num)
|
|
{
|
|
this.cameraShakeTime = 0f;
|
|
this.cameraShake = false;
|
|
}
|
|
}
|
|
if (Records.x.mainMenuOpen)
|
|
{
|
|
if (this.IsFollowing)
|
|
{
|
|
this.EndFollow();
|
|
}
|
|
this.cameraTargetTr.position = new Vector3(10000f, 100000f, 10000f);
|
|
}
|
|
if (!this.cam || !this.cameraTarget || !Links.x)
|
|
{
|
|
return;
|
|
}
|
|
if (Records.x.saving || !Links.x.gameplay)
|
|
{
|
|
return;
|
|
}
|
|
if (Links.x.cameraEffects.transitioning)
|
|
{
|
|
return;
|
|
}
|
|
this.worldMousePosition = this.cameraTargetTr.position;
|
|
bool flag3 = false;
|
|
Ray ray = Links.x.worldCamera.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0f));
|
|
RaycastHit raycastHit;
|
|
if (Physics.Raycast(ray, out raycastHit, 1000f, 4456465))
|
|
{
|
|
this.worldMousePosition = raycastHit.point;
|
|
flag3 = true;
|
|
GameObject gameObject = raycastHit.collider.gameObject;
|
|
this.prevWorldMousePosition = this.worldMousePosition;
|
|
}
|
|
if (!flag3)
|
|
{
|
|
Plane plane = new Plane(Vector3.up, this.prevWorldMousePosition);
|
|
float num2;
|
|
if (plane.Raycast(ray, out num2))
|
|
{
|
|
this.worldMousePosition = ray.GetPoint(num2);
|
|
flag3 = true;
|
|
}
|
|
}
|
|
this.cameraMiddleWorldPosition = this.cameraTargetTr.position;
|
|
if (Physics.Raycast(this.tr.position, this.tr.forward, out raycastHit, 1000f, 4456465))
|
|
{
|
|
this.cameraMiddleWorldPosition = raycastHit.point;
|
|
}
|
|
else
|
|
{
|
|
Ray ray2 = new Ray(this.tr.position, this.tr.forward);
|
|
Plane plane2 = new Plane(Vector3.up, this.cameraTargetTr.position);
|
|
float num3;
|
|
if (plane2.Raycast(ray2, out num3))
|
|
{
|
|
this.cameraMiddleWorldPosition = ray2.GetPoint(num3);
|
|
}
|
|
}
|
|
if (this.cam.orthographic)
|
|
{
|
|
this.bokehFollow.position = this.cameraMiddleWorldPosition;
|
|
}
|
|
if (this.puzzleTarget)
|
|
{
|
|
this.bokehFollow.position = this.puzzleTarget.transform.position + new Vector3(0f, 1f, 0f) + this.tr.forward * -0.3f;
|
|
}
|
|
else if (this.followCharacter && this.followTarget && this.cam.orthographic)
|
|
{
|
|
this.bokehFollow.position = this.followCharacter.body.GetNeck().position + new Vector3(0f, 0.25f, 0f) + this.tr.forward * -0.3f;
|
|
}
|
|
if (!Records.x.removeControls && !Records.x.pocketPause && (!this.IsFollowing || !this.followTarget) && Links.x.main)
|
|
{
|
|
this.Follow(Links.x.main.tr, Links.x.main, false);
|
|
}
|
|
if (this.IsFollowing && this.followTarget && Links.x.gaia.sceneLoaded)
|
|
{
|
|
bool flag4 = false;
|
|
if (Records.x.turnBased && Records.x.InCombat(false))
|
|
{
|
|
flag4 = true;
|
|
}
|
|
if (!flag4)
|
|
{
|
|
Transform transform = this.followTarget.transform;
|
|
if (this.followCharacter && !Records.x.dialogue)
|
|
{
|
|
transform = this.followCharacter.tr;
|
|
}
|
|
else if (this.followCharacter && Records.x.dialogue)
|
|
{
|
|
transform = this.followCharacter.tr;
|
|
}
|
|
if (transform)
|
|
{
|
|
Vector3 vector = transform.position;
|
|
if (this.inspecting)
|
|
{
|
|
this.LookAt = vector;
|
|
}
|
|
else
|
|
{
|
|
if (this.followCharacter)
|
|
{
|
|
if (this.followCharacter.body.currentHash == this.followCharacter.body.walkStartHash || this.followCharacter.body.currentHash == this.followCharacter.body.combatWalkStartHash || this.followCharacter.body.currentHash == this.followCharacter.body.creepStartHash)
|
|
{
|
|
vector = Vector3.Lerp(this.LookAt, this.followCharacter.tr.position, this.currentTimeDelta * 20f);
|
|
}
|
|
else if (this.followCharacter.sailing)
|
|
{
|
|
vector = Vector3.Lerp(this.LookAt, this.followCharacter.tr.position, this.currentTimeDelta * 10f);
|
|
}
|
|
else
|
|
{
|
|
vector = Vector3.Lerp(this.LookAt, this.followCharacter.tr.position, this.currentTimeDelta * 35f);
|
|
}
|
|
vector.y = Mathf.Lerp(this.LookAt.y, this.followCharacter.tr.position.y, this.currentTimeDelta * 15f);
|
|
if (this.followCharacter.sailing)
|
|
{
|
|
vector.y = Links.x.gaia.boat.boatFollow.position.y;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
vector = this.followTarget.position;
|
|
}
|
|
if (Records.x.pocketPause && (Links.x.combat.pickingRally || Links.x.combat.inRally))
|
|
{
|
|
vector = Links.x.attackDome.transform.position;
|
|
}
|
|
if (Records.x.pocketPause && Links.x.pocketWheel.rallyWheelOpen && Links.x.pocketWheel.selectedRallyCharacter)
|
|
{
|
|
vector = Links.x.pocketWheel.selectedRallyCharacter.tr.position;
|
|
}
|
|
if (Records.x.pocketPause && Links.x.joy && this.targetSelecting && this.joyTarget)
|
|
{
|
|
vector = Vector3.Lerp(this.LookAt, this.joyTarget.transform.position, this.currentTimeDelta * 5f);
|
|
this.returningLerp = true;
|
|
}
|
|
if (Links.x.combat.pocketTarget && !Links.x.combat.inPocketAttack && (Links.x.combat.pocketTargetPosition - Links.x.main.currentPosition).sqrMagnitude < 1600f)
|
|
{
|
|
float num4 = 0.5f;
|
|
if (Links.x.gameplay.attackingCharacter.invRow1._MeleeRangeEnd < 5f)
|
|
{
|
|
num4 = 0.75f;
|
|
}
|
|
vector = Vector3.Lerp(Links.x.gameplay.attackingCharacter.tr.position, Links.x.combat.pocketTargetPosition, num4);
|
|
this.returningLerp = true;
|
|
}
|
|
if (Records.x.pocketPause && Links.x.combat.inPocketAttack && this.pocketPoint != Vector3.zero)
|
|
{
|
|
vector = Vector3.Lerp(this.LookAt, this.pocketPoint, this.currentTimeDelta * 5f);
|
|
}
|
|
if (Links.x.combat.bubbleEventTarget && (Links.x.combat.bubbleEventTargetPosition - Links.x.main.currentPosition).sqrMagnitude < 8100f)
|
|
{
|
|
if (Links.x.attackDome.transform.position != Vector3.zero)
|
|
{
|
|
vector = Vector3.Lerp(Links.x.attackDome.transform.position, Links.x.combat.bubbleEventTargetPosition, 0.8f);
|
|
}
|
|
else
|
|
{
|
|
vector = Links.x.combat.bubbleEventTargetPosition;
|
|
}
|
|
this.returningLerp = true;
|
|
}
|
|
if (this.puzzleTarget && this.puzzleLerp)
|
|
{
|
|
if (Links.x.combat.inPocketAttack)
|
|
{
|
|
Vector3 vector2 = Vector3.Lerp(this.pocketPoint, this.puzzleTarget.transform.position, 0.5f);
|
|
vector = Vector3.Lerp(this.LookAt, vector2, this.currentTimeDelta * 5f);
|
|
}
|
|
else
|
|
{
|
|
vector = Vector3.Lerp(this.LookAt, this.puzzleTarget.transform.position, this.currentTimeDelta * 10f);
|
|
}
|
|
this.returningLerp = true;
|
|
}
|
|
if (this.puzzleTarget && !this.puzzleLerp)
|
|
{
|
|
this.returningLerp = false;
|
|
this.LookAt = this.puzzleTarget.transform.position;
|
|
vector = this.LookAt;
|
|
}
|
|
if (this.returningLerp && !this.puzzleTarget && !Links.x.combat.inRally && this.followCharacter)
|
|
{
|
|
float sqrMagnitude = (new Vector3(this.followCharacter.tr.position.x, this.cameraTargetTr.position.y, this.followCharacter.tr.position.z) - this.cameraTargetTr.position).sqrMagnitude;
|
|
if ((sqrMagnitude < 0.010000001f && this.followCharacter.moving) || sqrMagnitude <= 9.999999E-09f)
|
|
{
|
|
this.returningLerp = false;
|
|
}
|
|
}
|
|
this.LookAt = Vector3.Lerp(this.LookAt, vector, this.currentTimeDelta * 25f);
|
|
if (this.puzzleSnapCamera)
|
|
{
|
|
this.LookAt = vector;
|
|
}
|
|
if (this.cameraShake)
|
|
{
|
|
if (this.cameraShakeType == "Small")
|
|
{
|
|
this.LookAt += Random.insideUnitSphere * 0.1f;
|
|
}
|
|
else
|
|
{
|
|
this.LookAt += Random.insideUnitSphere * 0.4f;
|
|
}
|
|
}
|
|
if (this.singleJumpFrame > 0)
|
|
{
|
|
this.LookAt = this.followCharacter.tr.position;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Transform transform2 = this.followTarget.transform;
|
|
if (this.followCharacter)
|
|
{
|
|
transform2 = this.followCharacter.moveFollow;
|
|
}
|
|
Vector3 position = transform2.position;
|
|
if (!this.TargetInSight(transform2))
|
|
{
|
|
Vector3 vector3 = Links.x.worldCamera.WorldToViewportPoint(transform2.position);
|
|
Vector3 vector4 = Links.x.worldCamera.WorldToViewportPoint(this.cameraTargetTr.position);
|
|
Vector3 vector5 = vector3 - vector4;
|
|
this.AddToPosition(vector5.x, 0f, vector5.y);
|
|
Vector3 vector6 = this.LookAt + Quaternion.Euler(0f, this.Rotation, 0f) * this._moveVector;
|
|
this.LookAt = vector6;
|
|
}
|
|
}
|
|
}
|
|
else if (Records.x.InCombat(false) && Records.x.turnBased)
|
|
{
|
|
this._moveVector.y = 0f;
|
|
Vector3 vector7 = this.LookAt + Quaternion.Euler(0f, this.Rotation, 0f) * this._moveVector - Links.x.combat.domeCenter;
|
|
this.LookAt = Links.x.combat.domeCenter + Vector3.ClampMagnitude(vector7, 20f);
|
|
}
|
|
else
|
|
{
|
|
Vector3 lookAt2 = this.LookAt;
|
|
Vector3 position2 = this.cameraTargetTr.position;
|
|
if (!this.inspecting)
|
|
{
|
|
if (Input.GetMouseButton(2))
|
|
{
|
|
if (this.panning && flag3 && !Input.GetMouseButtonDown(2))
|
|
{
|
|
Vector3 vector8 = this.worldMousePosition - this.touchStart;
|
|
this.LookAt = this.cameraTargetTr.position;
|
|
vector8 = this.worldMousePosition - this.touchStart;
|
|
this.LookAt -= vector8;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this._moveVector.y = 0f;
|
|
Vector3 vector9 = this.LookAt + Quaternion.Euler(0f, this.Rotation, 0f) * this._moveVector;
|
|
this.LookAt = vector9;
|
|
}
|
|
}
|
|
if (Input.GetMouseButtonUp(2) && this.panning)
|
|
{
|
|
this.panning = false;
|
|
Links.x.hudControl.ToggleBothCanvasGroup(true);
|
|
this.LookAt = this.cameraTargetTr.position;
|
|
}
|
|
}
|
|
if (!Input.GetMouseButton(2))
|
|
{
|
|
if (this.inspecting || !flag3)
|
|
{
|
|
this.cursor.transform.position = Links.x.gameplay.farPosition;
|
|
}
|
|
else
|
|
{
|
|
this.cursor.transform.position = this.worldMousePosition;
|
|
}
|
|
}
|
|
if (float.IsNaN(this.LookAt.x))
|
|
{
|
|
this.LookAt = lookAt;
|
|
}
|
|
this.prevCameraPlace = this.LookAt;
|
|
float num5 = this.scroll;
|
|
float ortho = this.Ortho;
|
|
bool flag5 = false;
|
|
if ((Records.x.secrets || Records.x.editor) && (Input.GetKey(KeyCode.LeftBracket) || Input.GetKey(KeyCode.RightBracket)))
|
|
{
|
|
flag5 = true;
|
|
}
|
|
if (flag5 && this.Tilt > 30f && !Records.x.removeControls)
|
|
{
|
|
if (Links.x.mk)
|
|
{
|
|
if (this.cameraControls && !Links.x.gameplay.uiHover)
|
|
{
|
|
float axisRaw = Input.GetAxisRaw(this.cameraControls.ZoomInputAxis);
|
|
this.Ortho -= axisRaw * this.cameraControls.ZoomSpeed * this.currentTimeDelta * 2f;
|
|
}
|
|
}
|
|
else if (Links.x.gameplay.dockDown && Links.x.gaia.sceneLoaded && !Links.x.gameplay.gameFeedScrolling && !Records.x.inMenus && !Records.x.typing && !Records.x.removeControls && Mathf.Abs(Links.x.fellowship.direction.y) > 0.25f)
|
|
{
|
|
float num6 = Links.x.fellowship.direction.y * 0.05f;
|
|
this.Ortho -= num6 * this.cameraControls.ZoomSpeed * this.currentTimeDelta * 2f;
|
|
}
|
|
}
|
|
if (Records.x.partySailing)
|
|
{
|
|
this.Ortho = Mathf.Clamp(this.Ortho, this.MinOrtho, this.MaxOrtho + 5f);
|
|
}
|
|
else
|
|
{
|
|
this.Ortho = Mathf.Clamp(this.Ortho, this.MinOrtho, this.MaxOrtho);
|
|
}
|
|
this.Distance = Mathf.Clamp(this.Distance, this.MinDistance, this.MaxDistance);
|
|
if (this.cameraControls)
|
|
{
|
|
if (this.cameraControls.Smoothing && this.singleJumpFrame <= 0 && !this.inspecting)
|
|
{
|
|
float num7 = this.cameraControls.ZoomDampening;
|
|
if (!Records.x.pocketPause && !Records.x.removeControls && !Records.x.dialogue && !this.puzzleLerp && !this.returningLerp && !this.puzzleTarget)
|
|
{
|
|
num7 = 5f;
|
|
}
|
|
else if (this.puzzleTarget)
|
|
{
|
|
num7 = 0.5f;
|
|
}
|
|
else if (Links.x.combat.inPocketAttack || Links.x.combat.bubbleEvent)
|
|
{
|
|
num7 = 1f;
|
|
}
|
|
else if (Links.x.combat.pocketTarget && !Links.x.combat.inPocketAttack && !Links.x.combat.bubbleEvent)
|
|
{
|
|
num7 = Mathf.Lerp(6f, 0.1f, Mathf.Clamp((this.MaxOrtho - this._currOrtho) / 2f, 0f, 1f));
|
|
}
|
|
else
|
|
{
|
|
num7 = 5f;
|
|
}
|
|
this._currOrtho = Mathf.Lerp(this._currOrtho, this.Ortho, this.currentTimeDelta * num7);
|
|
}
|
|
else
|
|
{
|
|
this._currOrtho = this.Ortho;
|
|
}
|
|
}
|
|
Vector3 lookAt3 = this.LookAt;
|
|
this.ConstrainCameraBounds();
|
|
if (lookAt3 == this.LookAt && this.currentBoundsName != "" && !this.puzzleTarget)
|
|
{
|
|
this.LookAt = new Vector3(Mathf.Clamp(this.LookAt.x, this.MinBounds.x, this.MaxBounds.x), this.LookAt.y, Mathf.Clamp(this.LookAt.z, this.MinBounds.z, this.MaxBounds.z));
|
|
}
|
|
if (this.cameraControls)
|
|
{
|
|
float moveDampening = this.cameraControls.MoveDampening;
|
|
float num8 = this.cameraControls.RotationDampening;
|
|
float num9 = this.cameraControls.TiltDampening;
|
|
if (this.slowDialogue)
|
|
{
|
|
num9 = 5f;
|
|
num8 = 1f;
|
|
}
|
|
if (this.cameraControls.Smoothing && this.singleJumpFrame <= 0 && !this.inspecting && (ortho == this.Ortho || Records.x.dialogue))
|
|
{
|
|
if (!Links.x.gaia.sceneLoaded)
|
|
{
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
}
|
|
else
|
|
{
|
|
bool flag6 = false;
|
|
if (this.followCharacter && !this.followCharacter.mainSelected)
|
|
{
|
|
flag6 = true;
|
|
}
|
|
if (!this.puzzleSnapCamera && ((this.puzzleTarget && this.puzzleLerp) || this.returningLerp || Records.x.pocketPause || Records.x.removeControls))
|
|
{
|
|
float num10 = 5f;
|
|
if (!Records.x.pocketPause && this.returningLerp && !Records.x.removeControls && !this.puzzleSnapCamera)
|
|
{
|
|
float num11 = Vector3.Distance(Links.x.main.currentPosition, this.cameraTargetTr.position);
|
|
num10 = Mathf.Lerp(5f, 10f, Mathf.Clamp(num11 / 20f - 1f, 0f, 1f));
|
|
}
|
|
this.cameraTargetTr.position = Vector3.Lerp(this.cameraTargetTr.position, this.LookAt, this.currentTimeDelta * num10);
|
|
}
|
|
else if (flag6 && !this.puzzleSnapCamera)
|
|
{
|
|
this.cameraTargetTr.position = Vector3.Lerp(this.cameraTargetTr.position, this.LookAt, this.currentTimeDelta * 4f);
|
|
}
|
|
else
|
|
{
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
}
|
|
if (this.cameraControls.Smoothing && this.singleJumpFrame <= 0 && !this.inspecting)
|
|
{
|
|
this._currRotation = Mathf.LerpAngle(this._currRotation, this.Rotation, this.currentTimeDelta * num8);
|
|
this._currDistance = this.Distance;
|
|
this._currTilt = Mathf.LerpAngle(this._currTilt, this.Tilt, this.currentTimeDelta * num9);
|
|
}
|
|
else
|
|
{
|
|
this._currRotation = this.Rotation;
|
|
this._currDistance = this.Distance;
|
|
this._currTilt = this.Tilt;
|
|
this._currOrtho = this.Ortho;
|
|
this.singleJumpFrame--;
|
|
}
|
|
if (Links.x.diorama && Links.x.diorama.globalVegVolume && (Links.x.diorama.globalVegVolume.position - this.cameraTargetTr.position).sqrMagnitude > 400f)
|
|
{
|
|
Links.x.diorama.globalVegVolume.position = this.cameraTargetTr.position;
|
|
}
|
|
}
|
|
this._moveVector = Vector3.zero;
|
|
this.cameraTargetPosition = this.cameraTargetTr.position;
|
|
}
|
|
|
|
// Token: 0x06000050 RID: 80 RVA: 0x00008BA4 File Offset: 0x00006DA4
|
|
private void UpdateCamera()
|
|
{
|
|
if (!this.cam || !this.cameraTarget)
|
|
{
|
|
return;
|
|
}
|
|
if (this.cam.orthographic)
|
|
{
|
|
Quaternion quaternion = Quaternion.Euler(this._currTilt, this._currRotation, 0f);
|
|
Vector3 vector = new Vector3(0f, 0f, -this._currDistance);
|
|
Vector3 vector2 = quaternion * vector + this.cameraTargetTr.position;
|
|
this.cam.orthographicSize = this._currOrtho;
|
|
this.topCam.orthographicSize = this._currOrtho;
|
|
this.tr.rotation = quaternion;
|
|
this.tr.position = vector2;
|
|
}
|
|
if (Links.x.gaia.sceneLoaded)
|
|
{
|
|
Links.x.hudControl.NearButtonLocations();
|
|
Links.x.inventory.groundBag.itemLabelGrid.ItemLabels();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000051 RID: 81 RVA: 0x00008C98 File Offset: 0x00006E98
|
|
public void Zoom(bool state, string type)
|
|
{
|
|
if (!state && this.zoomCount == 0)
|
|
{
|
|
return;
|
|
}
|
|
this.slowDialogue = false;
|
|
if (!state)
|
|
{
|
|
this.zoomCount = 0;
|
|
if (type == "Synergy2" || type == "Synergy" || type == "Pocket")
|
|
{
|
|
this.MinOrtho = this.initialMinOrtho;
|
|
if (this.prevZoomed == 0f)
|
|
{
|
|
this.Ortho = this.savedMinOrtho;
|
|
}
|
|
else
|
|
{
|
|
this.Ortho = this.savedMinOrtho;
|
|
}
|
|
if (Records.x.partySailing)
|
|
{
|
|
this.Ortho += 5f;
|
|
}
|
|
this.Tilt = this.prevTilt;
|
|
this.Rotation = this.prevRotation;
|
|
this._currRotation = this.Rotation;
|
|
this._currTilt = this.Tilt;
|
|
this._currOrtho = this.Ortho;
|
|
this.returningLerp = false;
|
|
this.LookAt = Links.x.main.tr.position;
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
if (this.returnPerspective)
|
|
{
|
|
this.CopyPerspectiveCamera(this.returnPerspective, null, null);
|
|
this.returnPerspective = null;
|
|
}
|
|
this.UpdateCamera();
|
|
this.cam.backgroundColor = Color.black;
|
|
}
|
|
else
|
|
{
|
|
this.MinOrtho = this.initialMinOrtho;
|
|
if (this.Tilt < 30f && this.prevTilt != 0f)
|
|
{
|
|
this.Tilt = this.prevTilt;
|
|
}
|
|
if (this.prevZoomed == 0f)
|
|
{
|
|
this.Ortho = this.savedMinOrtho;
|
|
}
|
|
else
|
|
{
|
|
this.Ortho = this.savedMinOrtho;
|
|
}
|
|
if (Records.x.partySailing)
|
|
{
|
|
this.Ortho += 5f;
|
|
}
|
|
}
|
|
this.prevZoomed = 0f;
|
|
return;
|
|
}
|
|
this.zoomCount++;
|
|
this.cameraControls.MoveDampening = this.SavedMoveDampening * 5f;
|
|
if (this.prevZoomed == 0f)
|
|
{
|
|
this.prevZoomed = this.Ortho;
|
|
this.prevTilt = this.Tilt;
|
|
this.prevRotation = this.Rotation;
|
|
this.savedOrtho = this.Ortho;
|
|
}
|
|
this.MinTilt = 1f;
|
|
if (type == "Dialogue")
|
|
{
|
|
this.MinOrtho = 10f;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
float num = 0f;
|
|
if (Records.x.partySailing)
|
|
{
|
|
num += 5f;
|
|
}
|
|
if (type == "Synergy")
|
|
{
|
|
this.MinOrtho = 7f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
this._currOrtho = this.Ortho;
|
|
this.Tilt = 5f;
|
|
this._currTilt = this.Tilt;
|
|
string text = "Saved persp cam ";
|
|
Camera camera = this.savedPerspectiveCam;
|
|
Debug.Log(text + ((camera != null) ? camera.ToString() : null));
|
|
if (this.savedPerspectiveCam)
|
|
{
|
|
this.returnPerspective = this.savedPerspectiveCam;
|
|
this.ReturnOrthographicCamera();
|
|
this._currRotation = this.Rotation;
|
|
this._currTilt = this.Tilt;
|
|
this._currOrtho = this.Ortho;
|
|
this.returningLerp = false;
|
|
this.cameraTargetTr.position = Links.x.combat.rallyTarget.tr.position + new Vector3(0f, 2f, 0f);
|
|
this.LookAt = this.cameraTargetTr.position;
|
|
this.UpdateCamera();
|
|
}
|
|
this.RotateToLookAtTheSide(0, Links.x.main, Links.x.combat.rallyTarget);
|
|
this.UpdateCamera();
|
|
this.cam.backgroundColor = this.synergy1 * 0.2f;
|
|
return;
|
|
}
|
|
if (type == "Synergy2")
|
|
{
|
|
this.MinOrtho = 6f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
this.Tilt = 10f;
|
|
if (this.savedPerspectiveCam)
|
|
{
|
|
this.returnPerspective = this.savedPerspectiveCam;
|
|
this.ReturnOrthographicCamera();
|
|
this._currRotation = this.Rotation;
|
|
this._currTilt = this.Tilt;
|
|
this._currOrtho = this.Ortho;
|
|
this.returningLerp = false;
|
|
this.cameraTargetTr.position = Links.x.combat.rallyTarget.tr.position + new Vector3(0f, 2f, 0f);
|
|
this.LookAt = this.cameraTargetTr.position;
|
|
this.UpdateCamera();
|
|
}
|
|
this.cam.backgroundColor = this.synergy2 * 0.2f;
|
|
return;
|
|
}
|
|
if (type == "Pocket")
|
|
{
|
|
this.MinOrtho = 8f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
this.Tilt = 15f;
|
|
if (this.savedPerspectiveCam)
|
|
{
|
|
this.returnPerspective = this.savedPerspectiveCam;
|
|
this.ReturnOrthographicCamera();
|
|
this._currRotation = this.Rotation;
|
|
this._currTilt = this.Tilt;
|
|
this._currOrtho = this.Ortho;
|
|
this.returningLerp = false;
|
|
this.cameraTargetTr.position = Links.x.combat.rallyTarget.tr.position + new Vector3(0f, 2f, 0f);
|
|
this.LookAt = this.cameraTargetTr.position;
|
|
this.UpdateCamera();
|
|
}
|
|
int portraitOrder = Links.x.GetPortraitOrder(Links.x.main);
|
|
if (portraitOrder == 0)
|
|
{
|
|
this.cam.backgroundColor = this.player1 * 0.2f;
|
|
return;
|
|
}
|
|
if (portraitOrder == 1)
|
|
{
|
|
this.cam.backgroundColor = this.player2 * 0.2f;
|
|
return;
|
|
}
|
|
if (portraitOrder == 2)
|
|
{
|
|
this.cam.backgroundColor = this.player3 * 0.2f;
|
|
return;
|
|
}
|
|
this.cam.backgroundColor = this.player4 * 0.2f;
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (type == "Combat")
|
|
{
|
|
this.MinOrtho = 10f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
if (type == "MainCharacterQTE")
|
|
{
|
|
this.MinOrtho = 9f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
if (type == "MainCharacterQTERange")
|
|
{
|
|
this.MinOrtho = 11f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
if (type == "MainCharacterQTERallyPick")
|
|
{
|
|
this.MinOrtho = 11f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
if (type == "TargetSelect")
|
|
{
|
|
this.MinOrtho = 13f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
this.MinOrtho = 12f + num;
|
|
this.Ortho = this.MinOrtho;
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000052 RID: 82 RVA: 0x0000939C File Offset: 0x0000759C
|
|
private float GetDialogueTilt(Character character1, Character character2)
|
|
{
|
|
float num = 15f;
|
|
if (Vector3.Distance(character1.tr.position, character2.tr.position) < 4f)
|
|
{
|
|
num = 20f;
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06000053 RID: 83 RVA: 0x000093D8 File Offset: 0x000075D8
|
|
public void DialogueZoom(string zoomActor)
|
|
{
|
|
if (this.prevZoomed == 0f)
|
|
{
|
|
this.prevZoomed = this.Distance;
|
|
this.prevTilt = this.Tilt;
|
|
this.prevRotation = this.Rotation;
|
|
}
|
|
Character selectedDialogueCharacter = Links.x.dialogue.GetSelectedDialogueCharacter();
|
|
if (zoomActor == "Party")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(selectedDialogueCharacter);
|
|
}
|
|
else if (zoomActor == "NPC")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc1);
|
|
}
|
|
else if (zoomActor == "NPC2")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc2);
|
|
}
|
|
else if (zoomActor == "NPC3")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc3);
|
|
}
|
|
else if (zoomActor == "NPC4")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc4);
|
|
}
|
|
else if (zoomActor == "Responder")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.respondCharacter);
|
|
}
|
|
if (this.followCharacter)
|
|
{
|
|
this.followCharacter.indoorID != this.currentBoundsName;
|
|
this.dialogueHeight = this.followCharacter.body.headBone.position.y - this.followCharacter.tr.position.y;
|
|
}
|
|
this.slowDialogue = true;
|
|
}
|
|
|
|
// Token: 0x06000054 RID: 84 RVA: 0x00009590 File Offset: 0x00007790
|
|
public void DialogueRotation(string zoomActor)
|
|
{
|
|
if (zoomActor == "Party")
|
|
{
|
|
Character selectedDialogueCharacter = Links.x.dialogue.GetSelectedDialogueCharacter();
|
|
Links.x.dialogue.UpdateToFace(selectedDialogueCharacter);
|
|
return;
|
|
}
|
|
if (zoomActor == "NPC")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc1);
|
|
return;
|
|
}
|
|
if (zoomActor == "NPC2")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc2);
|
|
return;
|
|
}
|
|
if (zoomActor == "NPC3")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.npc3);
|
|
return;
|
|
}
|
|
if (zoomActor == "Responder")
|
|
{
|
|
Links.x.dialogue.UpdateToFace(Links.x.dialogue.respondCharacter);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000055 RID: 85 RVA: 0x0000967C File Offset: 0x0000787C
|
|
public bool RotateToLookAtTheSide(int attempt, Character character1, Character character2)
|
|
{
|
|
float tilt = this.Tilt;
|
|
float rotation = this.Rotation;
|
|
Vector3 position = character1.tr.position;
|
|
Vector3 position2 = character2.tr.position;
|
|
float num = -1f;
|
|
Random.Range(0, 2);
|
|
float num2 = rotation;
|
|
bool flag = false;
|
|
for (int i = 0; i < 60; i++)
|
|
{
|
|
if (!flag)
|
|
{
|
|
num2 += 6f;
|
|
if (num2 > 360f)
|
|
{
|
|
num2 -= 360f;
|
|
}
|
|
if (num2 < 220f && num2 > 60f)
|
|
{
|
|
Quaternion quaternion = Quaternion.Euler(tilt, num2, 0f);
|
|
Vector3 vector = new Vector3(0f, 0f, -1f);
|
|
Vector3 vector2 = quaternion * vector + position;
|
|
Vector3 vector3 = Quaternion.LookRotation(position - new Vector3(vector2.x, position.y, vector2.z)) * Vector3.forward;
|
|
Vector3 vector4 = Vector3.Normalize(position2 - new Vector3(vector2.x, position2.y, vector2.z));
|
|
float num3 = Vector3.Dot(vector3, vector4);
|
|
if (num3 < 0.15f && num3 > -0.15f)
|
|
{
|
|
num = num2;
|
|
flag = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (num > -1f)
|
|
{
|
|
this.Rotation = num2;
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06000056 RID: 86 RVA: 0x000097CF File Offset: 0x000079CF
|
|
public void ToggleSailing()
|
|
{
|
|
if (Records.x.partySailing)
|
|
{
|
|
this.Ortho = this.savedMinOrtho + 5f;
|
|
return;
|
|
}
|
|
this.Ortho = this.savedMinOrtho;
|
|
}
|
|
|
|
// Token: 0x06000057 RID: 87 RVA: 0x000097FC File Offset: 0x000079FC
|
|
public void GetCameraBounds()
|
|
{
|
|
if (!Links.x.diorama)
|
|
{
|
|
return;
|
|
}
|
|
BoxCollider boxCollider = this.coll;
|
|
this.coll = null;
|
|
if (Links.x.cameraEffects.indoors)
|
|
{
|
|
if (this.doorJumpCharacter)
|
|
{
|
|
if (Links.x.diorama.activeView)
|
|
{
|
|
this.coll = Links.x.diorama.GetIndoorView().GetInteriorCamera(this.doorJumpCharacter.indoorID);
|
|
this.currentBoundsName = this.doorJumpCharacter.indoorID;
|
|
}
|
|
}
|
|
else if (!this.doorJumpCharacter && this.followCharacter)
|
|
{
|
|
if (Links.x.diorama.activeView)
|
|
{
|
|
this.coll = Links.x.diorama.GetIndoorView().GetInteriorCamera(this.followCharacter.indoorID);
|
|
this.currentBoundsName = this.followCharacter.indoorID;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.coll = Links.x.diorama.GetIndoorView().cameraCollider;
|
|
this.currentBoundsName = "";
|
|
}
|
|
this.colliderPlane.SetNormalAndPosition(Vector3.up, new Vector3(0f, Links.x.diorama.GetIndoorView().cameraCollider.bounds.center.y, 0f));
|
|
}
|
|
else if (Links.x.diorama.activeView)
|
|
{
|
|
this.currentBoundsName = "";
|
|
this.coll = Links.x.diorama.GetOutdoorView().cameraCollider;
|
|
this.colliderPlane.SetNormalAndPosition(Vector3.up, new Vector3(0f, this.coll.bounds.center.y, 0f));
|
|
}
|
|
if (this.coll && boxCollider != this.coll && this.currentBoundsName != "")
|
|
{
|
|
Links.x.diorama.ToggleSceneCameras(true, Links.x.diorama.GetCurrentCaptureCameraID());
|
|
if (Links.x.gaia.sceneLoaded && Links.x.sceneMap.undergroundMap)
|
|
{
|
|
Links.x.sceneMap.undergroundMap.ChangedArea(this.currentBoundsName);
|
|
}
|
|
}
|
|
if (this.coll)
|
|
{
|
|
this.coll.enabled = true;
|
|
Bounds bounds = this.coll.bounds;
|
|
float x = this.coll.bounds.size.x;
|
|
float z = this.coll.bounds.size.z;
|
|
float num = this.coll.bounds.center.x - x / 2f;
|
|
float num2 = this.coll.bounds.center.x + x / 2f;
|
|
float num3 = this.coll.bounds.center.z - z / 2f;
|
|
float num4 = this.coll.bounds.center.z + z / 2f;
|
|
this.MinBounds = new Vector3(num, -1000f, num3);
|
|
this.MaxBounds = new Vector3(num2, 1000f, num4);
|
|
if (Links.x.cameraEffects.indoors)
|
|
{
|
|
this.coll.enabled = false;
|
|
}
|
|
if (this.needToJump)
|
|
{
|
|
this.Jump(Links.x.main.tr.position);
|
|
this.needToJump = false;
|
|
}
|
|
Links.x.cameraEffects.SetShadowInfo();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000058 RID: 88 RVA: 0x00009BD4 File Offset: 0x00007DD4
|
|
public void UpdateDialogueCharacterPosition(Character bokehFollowCharacter)
|
|
{
|
|
this.bokehFollow.position = bokehFollowCharacter.body.GetNeck().position + new Vector3(0f, 0.25f, 0f) + this.tr.forward * -0.3f;
|
|
}
|
|
|
|
// Token: 0x06000059 RID: 89 RVA: 0x00009C2F File Offset: 0x00007E2F
|
|
public void UpdatePerspectiveCameraSize()
|
|
{
|
|
if (!this.cam)
|
|
{
|
|
return;
|
|
}
|
|
if (!this.cam.orthographic && this.savedPerspectiveCam)
|
|
{
|
|
this.SetPerspectiveCameraInfo(this.savedPerspectiveCam);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600005A RID: 90 RVA: 0x00009C68 File Offset: 0x00007E68
|
|
public void SetPerspectiveCameraInfo(Camera perspectiveCam)
|
|
{
|
|
float num = perspectiveCam.fieldOfView * (1.7777778f / ((float)Screen.width / (float)Screen.height));
|
|
if ((float)Screen.width / (float)Screen.height >= 1.7777778f)
|
|
{
|
|
num = perspectiveCam.fieldOfView;
|
|
}
|
|
this.cam.orthographic = false;
|
|
this.cam.fieldOfView = num;
|
|
this.cam.farClipPlane = perspectiveCam.farClipPlane;
|
|
this.cam.nearClipPlane = perspectiveCam.nearClipPlane;
|
|
this.tr.position = perspectiveCam.gameObject.transform.position;
|
|
this.tr.rotation = perspectiveCam.gameObject.transform.rotation;
|
|
this.topCam.orthographic = false;
|
|
this.topCam.fieldOfView = num;
|
|
this.topCam.farClipPlane = this.cam.farClipPlane;
|
|
this.topCam.nearClipPlane = this.cam.nearClipPlane;
|
|
Links.x.cameraEffects.ToggleObscurance();
|
|
if (Links.x.diorama && Links.x.main && Links.x.main.node != null)
|
|
{
|
|
Links.x.diorama.UpdateMapExits(Links.x.main.node.Area);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600005B RID: 91 RVA: 0x00009DC4 File Offset: 0x00007FC4
|
|
public void CopyPerspectiveCamera(Camera perspectiveCam, Transform bokehFollowTransform, Character bokehFollowCharacter)
|
|
{
|
|
if (this.cam.orthographic)
|
|
{
|
|
this.savedOrthoPosition = this.tr.position;
|
|
this.savedOrthoLookAt = this.LookAt;
|
|
this.savedOrthoSize = this._currOrtho;
|
|
this.savedOrthoRotation = this._currRotation;
|
|
this.savedOrthoDistance = this._currDistance;
|
|
this.savedFarClip = this.cam.farClipPlane;
|
|
this.savedNearClip = this.cam.nearClipPlane;
|
|
}
|
|
this.SetPerspectiveCameraInfo(perspectiveCam);
|
|
Transform parent = perspectiveCam.gameObject.transform.parent;
|
|
if (parent)
|
|
{
|
|
foreach (object obj in parent)
|
|
{
|
|
Transform transform = (Transform)obj;
|
|
if (transform.gameObject.name.Contains("oint"))
|
|
{
|
|
bokehFollowTransform = transform;
|
|
}
|
|
}
|
|
}
|
|
this.savedPerspectiveCam = perspectiveCam;
|
|
if (bokehFollowCharacter)
|
|
{
|
|
this.bokehFollow.position = bokehFollowCharacter.body.GetNeck().position + new Vector3(0f, 0.25f, 0f) + this.tr.forward * -0.3f;
|
|
}
|
|
else if (bokehFollowTransform)
|
|
{
|
|
this.bokehFollow.position = bokehFollowTransform.position;
|
|
}
|
|
else
|
|
{
|
|
Vector3 vector = this.cameraTargetTr.position + new Vector3(0f, 2.5f, 0f);
|
|
RaycastHit raycastHit;
|
|
if (Physics.Raycast(this.tr.position, this.tr.forward, out raycastHit, 1000f, 4456465))
|
|
{
|
|
vector = raycastHit.point + new Vector3(0f, 2.5f, 0f);
|
|
}
|
|
this.bokehFollow.position = vector;
|
|
}
|
|
Shader.SetGlobalFloat("_CloseUp", 1f);
|
|
Shader.SetGlobalFloat("_Perspective", 1f);
|
|
}
|
|
|
|
// Token: 0x0600005C RID: 92 RVA: 0x00009FD4 File Offset: 0x000081D4
|
|
public void ReturnOrthographicCamera()
|
|
{
|
|
Shader.SetGlobalFloat("_CloseUp", 0f);
|
|
Shader.SetGlobalFloat("_Perspective", 0f);
|
|
this.tr.position = this.savedOrthoPosition;
|
|
this.LookAt = this.savedOrthoLookAt;
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
this._currOrtho = this.savedOrthoSize;
|
|
this._currRotation = this.savedOrthoRotation;
|
|
this._currDistance = this.savedOrthoDistance;
|
|
this.cam.orthographic = true;
|
|
this.cam.farClipPlane = this.savedFarClip;
|
|
this.cam.nearClipPlane = this.savedNearClip;
|
|
this.topCam.orthographic = true;
|
|
this.topCam.farClipPlane = this.cam.farClipPlane;
|
|
this.topCam.nearClipPlane = this.cam.nearClipPlane;
|
|
this.UpdateCamera();
|
|
this.savedPerspectiveCam = null;
|
|
Links.x.cameraEffects.ToggleObscurance();
|
|
}
|
|
|
|
// Token: 0x0600005D RID: 93 RVA: 0x0000A0D3 File Offset: 0x000082D3
|
|
public void MouseUpdate()
|
|
{
|
|
bool flag = this.inspecting;
|
|
}
|
|
|
|
// Token: 0x0600005E RID: 94 RVA: 0x0000A0DC File Offset: 0x000082DC
|
|
public void KeyUpdate()
|
|
{
|
|
if (Records.x.typing)
|
|
{
|
|
return;
|
|
}
|
|
if (Records.x.dialogue)
|
|
{
|
|
return;
|
|
}
|
|
if (this.inspecting)
|
|
{
|
|
return;
|
|
}
|
|
if (this.cameraControls.AllowRotate && this.cameraControls.RotateUsesInputAxis)
|
|
{
|
|
float axisRaw = Input.GetAxisRaw(this.cameraControls.RotateInputAxis);
|
|
if (Mathf.Abs(axisRaw) > 0.001f)
|
|
{
|
|
this.Rotation += axisRaw * this.cameraControls.RotateSpeed * this.currentTimeDelta;
|
|
}
|
|
}
|
|
if (this.cameraControls.AllowTilt && this.cameraControls.TiltUsesInputAxis)
|
|
{
|
|
float axisRaw2 = Input.GetAxisRaw(this.cameraControls.TiltInputAxis);
|
|
if (Mathf.Abs(axisRaw2) > 0.001f)
|
|
{
|
|
this.Tilt += axisRaw2 * this.cameraControls.TiltSpeed * this.currentTimeDelta;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000001 RID: 1
|
|
// (get) Token: 0x0600005F RID: 95 RVA: 0x0000A1BE File Offset: 0x000083BE
|
|
public Transform CameraTarget
|
|
{
|
|
get
|
|
{
|
|
return this.cameraTargetTr;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000002 RID: 2
|
|
// (get) Token: 0x06000060 RID: 96 RVA: 0x0000A1C6 File Offset: 0x000083C6
|
|
public bool IsFollowing
|
|
{
|
|
get
|
|
{
|
|
return this.FollowTarget != null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000003 RID: 3
|
|
// (get) Token: 0x06000061 RID: 97 RVA: 0x0000A1D4 File Offset: 0x000083D4
|
|
public Transform FollowTarget
|
|
{
|
|
get
|
|
{
|
|
return this.followTarget;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000062 RID: 98 RVA: 0x0000A1DC File Offset: 0x000083DC
|
|
public void ResetToInitialValues(bool includePosition, bool snap = false)
|
|
{
|
|
if (includePosition)
|
|
{
|
|
this.LookAt = this._initialLookAt;
|
|
}
|
|
this.Distance = this._initialDistance;
|
|
this.Rotation = this._initialRotation;
|
|
this.Tilt = this._initialTilt;
|
|
if (snap)
|
|
{
|
|
this._currDistance = this.Distance;
|
|
this._currRotation = this.Rotation;
|
|
this._currTilt = this.Tilt;
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000063 RID: 99 RVA: 0x0000A254 File Offset: 0x00008454
|
|
public bool AreCharacterAndCameraTogether()
|
|
{
|
|
if (!Links.x.main || !Links.x.gaia.sceneLoaded)
|
|
{
|
|
return true;
|
|
}
|
|
if (Links.x.diorama.GetIndoorView())
|
|
{
|
|
string text = Links.x.diorama.GetIndoorView().GetInteriorBoundsName(Links.x.main.tr.position);
|
|
if (text == "?")
|
|
{
|
|
text = "";
|
|
}
|
|
return !(text != this.currentBoundsName);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06000064 RID: 100 RVA: 0x0000A2EC File Offset: 0x000084EC
|
|
public bool ShouldCharacterBeInOrthoCamera()
|
|
{
|
|
if (Links.x.main && Links.x.diorama)
|
|
{
|
|
if (this.cam.orthographic)
|
|
{
|
|
return false;
|
|
}
|
|
RaycastHit raycastHit;
|
|
if (!Physics.Raycast(Links.x.main.tr.position + new Vector3(0f, 50f, 0f), Vector3.up * -1f, out raycastHit, 200f, 134217728))
|
|
{
|
|
return true;
|
|
}
|
|
if (!raycastHit.collider.gameObject.name.Contains("Camera Collider"))
|
|
{
|
|
RaycastHit raycastHit2;
|
|
return !Physics.Raycast(raycastHit.point - new Vector3(0f, 0.5f, 0f), Vector3.up * -1f, out raycastHit2, 100f, 134217728) || !raycastHit2.collider.gameObject.name.Contains("Camera Collider");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000065 RID: 101 RVA: 0x0000A404 File Offset: 0x00008604
|
|
public SceneCamera ShouldCharacterBeInPerspectiveCamera()
|
|
{
|
|
RaycastHit raycastHit;
|
|
if (Links.x.main && Physics.Raycast(Links.x.main.tr.position + new Vector3(0f, 50f, 0f), Vector3.up * -1f, out raycastHit, 200f, 134217728))
|
|
{
|
|
RaycastHit raycastHit2;
|
|
if (raycastHit.collider.gameObject.name.Contains("Camera Collider"))
|
|
{
|
|
SceneCamera component = raycastHit.collider.gameObject.transform.parent.gameObject.GetComponent<SceneCamera>();
|
|
Camera sceneCamera = component.sceneCamera;
|
|
if ((this.cam.orthographic || sceneCamera != this.savedPerspectiveCam) && component.gameObject.name.Contains("Frog"))
|
|
{
|
|
return component;
|
|
}
|
|
}
|
|
else if (Physics.Raycast(raycastHit.point - new Vector3(0f, 0.5f, 0f), Vector3.up * -1f, out raycastHit2, 100f, 134217728) && raycastHit2.collider.gameObject.name.Contains("Camera Collider"))
|
|
{
|
|
SceneCamera component2 = raycastHit2.collider.gameObject.transform.parent.gameObject.GetComponent<SceneCamera>();
|
|
Camera sceneCamera2 = component2.sceneCamera;
|
|
if ((this.cam.orthographic || sceneCamera2 != this.savedPerspectiveCam) && component2.gameObject.name.Contains("Frog"))
|
|
{
|
|
return component2;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06000066 RID: 102 RVA: 0x0000A5B8 File Offset: 0x000087B8
|
|
public void JumpTo(Vector3 toPosition, Character jumpToCharacter, bool snap)
|
|
{
|
|
if (!this.cam.orthographic)
|
|
{
|
|
return;
|
|
}
|
|
if (!Records.x.dialogue)
|
|
{
|
|
this.EndFollow();
|
|
}
|
|
bool flag = false;
|
|
if (jumpToCharacter)
|
|
{
|
|
if (jumpToCharacter.indoorID != this.currentBoundsName)
|
|
{
|
|
flag = true;
|
|
this.doorJumpCharacter = jumpToCharacter;
|
|
Links.x.cameraEffects.ToggleInteriorExterior(jumpToCharacter);
|
|
if (!Records.x.dialogue)
|
|
{
|
|
this.EndFollow();
|
|
}
|
|
}
|
|
if (!flag)
|
|
{
|
|
if (this.first)
|
|
{
|
|
this.doorJumpCharacter = jumpToCharacter;
|
|
Links.x.cameraEffects.ToggleInteriorExterior(jumpToCharacter);
|
|
}
|
|
else
|
|
{
|
|
this.Jump(toPosition);
|
|
}
|
|
if (!Records.x.dialogue)
|
|
{
|
|
this.EndFollow();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.doorJumpCharacter = Links.x.main;
|
|
Links.x.cameraEffects.ToggleInteriorExterior(Links.x.main);
|
|
this.EndFollow();
|
|
}
|
|
this.first = false;
|
|
if (!snap)
|
|
{
|
|
this.LookAt = toPosition;
|
|
return;
|
|
}
|
|
if (flag)
|
|
{
|
|
this.needToJump = true;
|
|
return;
|
|
}
|
|
this.Jump(toPosition);
|
|
}
|
|
|
|
// Token: 0x06000067 RID: 103 RVA: 0x0000A6C0 File Offset: 0x000088C0
|
|
public void Jump(Vector3 toPosition)
|
|
{
|
|
if (!this.cam.orthographic)
|
|
{
|
|
return;
|
|
}
|
|
if (!this.cameraTarget)
|
|
{
|
|
this.CreateTarget();
|
|
}
|
|
if (this.followTarget && this.followCharacter)
|
|
{
|
|
this.LookAt = this.followCharacter.tr.position;
|
|
if (Records.x.dialogue)
|
|
{
|
|
this.LookAt = this.followCharacter.tr.position + new Vector3(0f, this.dialogueHeight, 0f);
|
|
}
|
|
}
|
|
if (this.doorJumpCharacter)
|
|
{
|
|
this.LookAt = this.doorJumpCharacter.tr.position;
|
|
}
|
|
if (this.currentBoundsName != "" && !this.followTarget)
|
|
{
|
|
this.LookAt = new Vector3(Mathf.Clamp(toPosition.x, this.MinBounds.x, this.MaxBounds.x), Mathf.Clamp(toPosition.y, this.MinBounds.y, this.MaxBounds.y), Mathf.Clamp(toPosition.z, this.MinBounds.z, this.MaxBounds.z));
|
|
}
|
|
if (this.currentBoundsName == "")
|
|
{
|
|
this.LookAt = toPosition;
|
|
}
|
|
this.ConstrainCameraBounds();
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
this.UpdateCamera();
|
|
this.singleJumpFrame = 3;
|
|
this.doorJumpCharacter = null;
|
|
}
|
|
|
|
// Token: 0x06000068 RID: 104 RVA: 0x0000A84E File Offset: 0x00008A4E
|
|
public void JumpTo(Transform toTransform, bool snap)
|
|
{
|
|
this.JumpTo(toTransform.position, toTransform.gameObject.GetComponent<Character>(), snap);
|
|
}
|
|
|
|
// Token: 0x06000069 RID: 105 RVA: 0x0000A868 File Offset: 0x00008A68
|
|
public void JumpTo(GameObject toGameObject, bool snap)
|
|
{
|
|
this.JumpTo(toGameObject.transform.position, toGameObject.GetComponent<Character>(), snap);
|
|
}
|
|
|
|
// Token: 0x0600006A RID: 106 RVA: 0x0000A884 File Offset: 0x00008A84
|
|
public void CombatFollow(Transform followTargetTransform, Character character, string type)
|
|
{
|
|
if (!this.cam.orthographic)
|
|
{
|
|
return;
|
|
}
|
|
if (this.followTarget != null && this.OnEndFollow != null)
|
|
{
|
|
this.OnEndFollow(this.followTarget);
|
|
}
|
|
this.combatFollowType = type;
|
|
this.followStartPosition = followTargetTransform.position;
|
|
if (!this.cameraTarget)
|
|
{
|
|
this.CreateTarget();
|
|
}
|
|
this.followTarget = followTargetTransform;
|
|
this.followCharacter = character;
|
|
if (this.followTarget != null && this.OnBeginFollow != null)
|
|
{
|
|
this.OnBeginFollow(this.followTarget);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600006B RID: 107 RVA: 0x0000A924 File Offset: 0x00008B24
|
|
public void Follow(Transform followTargetTransform, Character character, bool snap = false)
|
|
{
|
|
if (!this.cam.orthographic)
|
|
{
|
|
return;
|
|
}
|
|
if (this.followTarget != null && this.OnEndFollow != null)
|
|
{
|
|
this.OnEndFollow(this.followTarget);
|
|
}
|
|
if (character != this.followCharacter && Links.x.gaia.sceneLoaded && !Records.x.removeControls && character && this.followCharacter)
|
|
{
|
|
if (Vector3.Distance(this.followCharacter.tr.position, character.tr.position) < 50f)
|
|
{
|
|
this.returningLerp = true;
|
|
}
|
|
else
|
|
{
|
|
this.returningLerp = false;
|
|
}
|
|
}
|
|
if (!this.cameraTarget)
|
|
{
|
|
this.CreateTarget();
|
|
}
|
|
this.followTarget = followTargetTransform;
|
|
this.followCharacter = character;
|
|
this.lastFollow = character;
|
|
Links.x.cameraEffects.SetDepthOfFieldTarget(this.cameraTargetTr);
|
|
if (this.followTarget == null && !this.cameraTarget)
|
|
{
|
|
this.CreateTarget();
|
|
}
|
|
if (this.followTarget != null)
|
|
{
|
|
if (snap)
|
|
{
|
|
this.LookAt = this.followTarget.position;
|
|
}
|
|
if (this.OnBeginFollow != null)
|
|
{
|
|
this.OnBeginFollow(this.followTarget);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600006C RID: 108 RVA: 0x0000AA76 File Offset: 0x00008C76
|
|
public void Follow(GameObject followTarget, bool snap = false)
|
|
{
|
|
this.Follow(followTarget.transform, null, false);
|
|
}
|
|
|
|
// Token: 0x0600006D RID: 109 RVA: 0x0000AA86 File Offset: 0x00008C86
|
|
public void EndFollow()
|
|
{
|
|
if (!this.cam.orthographic)
|
|
{
|
|
return;
|
|
}
|
|
this.Follow(null, this.followCharacter, false);
|
|
}
|
|
|
|
// Token: 0x0600006E RID: 110 RVA: 0x0000AAA4 File Offset: 0x00008CA4
|
|
public void AddToPosition(float dx, float dy, float dz)
|
|
{
|
|
this._moveVector += new Vector3(dx, dy, dz);
|
|
}
|
|
|
|
// Token: 0x0600006F RID: 111 RVA: 0x0000AAC0 File Offset: 0x00008CC0
|
|
private void CreateTarget()
|
|
{
|
|
this.cameraTarget = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
|
this.cameraTargetTr = this.cameraTarget.transform;
|
|
this.cameraTargetTr.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
|
this.cameraTarget.GetComponent<Renderer>().material.color = Color.green;
|
|
this.rigid = this.cameraTarget.AddComponent<Rigidbody>();
|
|
this.rigid.isKinematic = true;
|
|
this.cameraTarget.layer = 10;
|
|
Collider component = this.cameraTarget.GetComponent<Collider>();
|
|
if (component != null)
|
|
{
|
|
component.enabled = false;
|
|
}
|
|
this._targetRenderer = this.cameraTarget.GetComponent<MeshRenderer>();
|
|
this._targetRenderer.enabled = false;
|
|
this.cameraTarget.name = "Camera Target";
|
|
this.cameraTargetTr.position = this.LookAt;
|
|
}
|
|
|
|
// Token: 0x06000070 RID: 112 RVA: 0x0000ABA8 File Offset: 0x00008DA8
|
|
public void ConstrainCameraBounds()
|
|
{
|
|
if (this.sceneName == "C6_FortenLazure" && Links.x.cameraEffects.indoors)
|
|
{
|
|
return;
|
|
}
|
|
float num = this._currOrtho * 2f;
|
|
float num2 = num * ((float)Screen.width / (float)Screen.height);
|
|
num2 /= 2f;
|
|
num /= 2f;
|
|
num *= 1.837f;
|
|
bool flag = false;
|
|
if (this.currentBoundsName != "")
|
|
{
|
|
flag = true;
|
|
}
|
|
Vector3 vector = this.bottomRightBounds;
|
|
Vector3 vector2 = this.topRightBounds;
|
|
Vector3 vector3 = this.bottomLeftBounds;
|
|
if (flag)
|
|
{
|
|
vector = this.bottomRightBoundsInterior;
|
|
vector2 = this.topRightBoundsInterior;
|
|
vector3 = this.bottomLeftBoundsInterior;
|
|
}
|
|
this.MinBounds.x = vector.x;
|
|
this.MaxBounds.x = vector2.x;
|
|
this.MinBounds.z = vector.z;
|
|
this.MaxBounds.z = vector3.z;
|
|
Quaternion quaternion = Quaternion.Euler(this._currTilt, this._currRotation, 0f);
|
|
Vector3 vector4 = new Vector3(0f, 0f, -this._currDistance);
|
|
Vector3 vector5 = quaternion * vector4 + this.LookAt;
|
|
Vector3 vector6 = vector5;
|
|
Ray ray = new Ray(vector5, this.tr.forward);
|
|
float num3;
|
|
if (this.colliderPlane.Raycast(ray, out num3))
|
|
{
|
|
vector6 = ray.GetPoint(num3);
|
|
}
|
|
float num4 = vector6.x + num;
|
|
float num5 = vector6.x - num;
|
|
float num6 = vector6.z + num2;
|
|
if (vector6.z - num2 < Mathf.Round(this.MinBounds.z))
|
|
{
|
|
this.LookAt.z = Mathf.Round(this.MinBounds.z) + num2;
|
|
}
|
|
if (num6 > Mathf.Round(this.MaxBounds.z))
|
|
{
|
|
this.LookAt.z = Mathf.Round(this.MaxBounds.z) - num2;
|
|
}
|
|
if (num5 < this.MinBounds.x)
|
|
{
|
|
Vector3 vector7 = Vector3.zero;
|
|
float y = this.LookAt.y;
|
|
Vector3 vector8 = vector;
|
|
vector8.x += num;
|
|
Ray ray2 = new Ray(vector8, this.tr.forward * -1f);
|
|
this.cameraPlane = new Plane(Vector3.down, y);
|
|
float num7;
|
|
if (this.cameraPlane.Raycast(ray2, out num7))
|
|
{
|
|
vector7 = ray2.GetPoint(num7);
|
|
}
|
|
else
|
|
{
|
|
ray2 = new Ray(vector8, this.tr.forward);
|
|
Vector3 vector9 = Vector3.zero;
|
|
this.cameraPlane = new Plane(Vector3.up, 0f);
|
|
float num8;
|
|
if (this.cameraPlane.Raycast(ray2, out num8))
|
|
{
|
|
vector9 = ray2.GetPoint(num8);
|
|
}
|
|
ray2 = new Ray(vector9, this.tr.forward * -1f);
|
|
this.cameraPlane = new Plane(Vector3.down, y);
|
|
float num9;
|
|
if (this.cameraPlane.Raycast(ray2, out num9))
|
|
{
|
|
vector7 = ray2.GetPoint(num9);
|
|
}
|
|
}
|
|
this.LookAt.x = vector7.x;
|
|
}
|
|
if (num4 > this.MaxBounds.x)
|
|
{
|
|
Vector3 vector10 = Vector3.zero;
|
|
float y2 = this.LookAt.y;
|
|
Vector3 vector11 = vector2;
|
|
vector11.x -= num;
|
|
Ray ray3 = new Ray(vector11, this.tr.forward * -1f);
|
|
this.cameraPlane = new Plane(Vector3.down, y2);
|
|
float num10;
|
|
if (this.cameraPlane.Raycast(ray3, out num10))
|
|
{
|
|
vector10 = ray3.GetPoint(num10);
|
|
}
|
|
else
|
|
{
|
|
ray3 = new Ray(vector11, this.tr.forward);
|
|
Vector3 vector12 = Vector3.zero;
|
|
this.cameraPlane = new Plane(Vector3.up, 0f);
|
|
float num11;
|
|
if (this.cameraPlane.Raycast(ray3, out num11))
|
|
{
|
|
vector12 = ray3.GetPoint(num11);
|
|
}
|
|
ray3 = new Ray(vector12, this.tr.forward * -1f);
|
|
this.cameraPlane = new Plane(Vector3.down, y2);
|
|
float num12;
|
|
if (this.cameraPlane.Raycast(ray3, out num12))
|
|
{
|
|
vector10 = ray3.GetPoint(num12);
|
|
}
|
|
}
|
|
this.LookAt.x = vector10.x;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000071 RID: 113 RVA: 0x0000AFFC File Offset: 0x000091FC
|
|
public bool TargetInSight(Transform lookTr)
|
|
{
|
|
Vector3 vector = Links.x.worldCamera.WorldToViewportPoint(lookTr.position);
|
|
if (this.combatFollowType == "Always Move")
|
|
{
|
|
if (vector.x > 0.4f && vector.x < 0.6f && vector.y > 0.4f && vector.y < 0.6f)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (this.combatFollowType == "Only if necessary")
|
|
{
|
|
if (vector.x > 0.2f && vector.x < 0.8f && vector.y > 0.2f && vector.y < 0.8f)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (vector.x > 0.3f && vector.x < 0.7f && vector.y > 0.3f && vector.y < 0.7f)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000072 RID: 114 RVA: 0x0000B0F4 File Offset: 0x000092F4
|
|
private Vector3 GetHitPosition(out Vector3 middle)
|
|
{
|
|
int num = 0;
|
|
middle = Vector3.zero;
|
|
Vector3 vector = this.cameraTargetTr.position;
|
|
Vector3 vector2 = Vector3.zero;
|
|
float num2 = 1000f;
|
|
RaycastHit raycastHit;
|
|
if (Physics.Raycast(this.tr.position, this.tr.forward, out raycastHit, 1000f, 1078199297))
|
|
{
|
|
vector = raycastHit.point;
|
|
num++;
|
|
num2 = raycastHit.distance;
|
|
}
|
|
Vector3 vector3 = this.tr.position + this.tr.right * 5f;
|
|
Vector3 vector4 = this.tr.position + this.tr.right * -5f;
|
|
Vector3 vector5 = this.tr.position + this.tr.up * 5f;
|
|
Vector3 vector6 = this.tr.position + this.tr.up * -5f;
|
|
if (Physics.Raycast(vector3, this.tr.forward, out raycastHit, 1000f, 4456449))
|
|
{
|
|
if (raycastHit.point.y > vector2.y)
|
|
{
|
|
vector2 = raycastHit.point;
|
|
}
|
|
num++;
|
|
if (raycastHit.distance < num2)
|
|
{
|
|
num2 = raycastHit.distance;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.B) && Records.x.editor)
|
|
{
|
|
Links.x.main.CreateSphere(raycastHit.point, 1f);
|
|
}
|
|
}
|
|
if (Physics.Raycast(vector4, this.tr.forward, out raycastHit, 1000f, 4456449))
|
|
{
|
|
if (raycastHit.point.y > vector2.y)
|
|
{
|
|
vector2 = raycastHit.point;
|
|
}
|
|
num++;
|
|
if (raycastHit.distance < num2)
|
|
{
|
|
num2 = raycastHit.distance;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.B) && Records.x.editor)
|
|
{
|
|
Links.x.main.CreateSphere(raycastHit.point, 1f);
|
|
}
|
|
}
|
|
if (Physics.Raycast(vector5, this.tr.forward, out raycastHit, 1000f, 4456449))
|
|
{
|
|
if (raycastHit.point.y > vector2.y)
|
|
{
|
|
vector2 = raycastHit.point;
|
|
}
|
|
num++;
|
|
if (raycastHit.distance < num2)
|
|
{
|
|
num2 = raycastHit.distance;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.B) && Records.x.editor)
|
|
{
|
|
Links.x.main.CreateSphere(raycastHit.point, 1f);
|
|
}
|
|
}
|
|
if (Physics.Raycast(vector6, this.tr.forward, out raycastHit, 1000f, 4456449))
|
|
{
|
|
if (raycastHit.point.y > vector2.y)
|
|
{
|
|
vector2 = raycastHit.point;
|
|
}
|
|
num++;
|
|
if (raycastHit.distance < num2)
|
|
{
|
|
num2 = raycastHit.distance;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.B) && Records.x.editor)
|
|
{
|
|
Links.x.main.CreateSphere(raycastHit.point, 1f);
|
|
}
|
|
}
|
|
middle = vector;
|
|
if (num > 0)
|
|
{
|
|
return this.tr.position + this.tr.forward * num2;
|
|
}
|
|
return vector;
|
|
}
|
|
|
|
// Token: 0x06000073 RID: 115 RVA: 0x0000B440 File Offset: 0x00009640
|
|
protected void Reset()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400013B RID: 315
|
|
public float Distance;
|
|
|
|
// Token: 0x0400013C RID: 316
|
|
public float Rotation = 45f;
|
|
|
|
// Token: 0x0400013D RID: 317
|
|
public float Tilt = 45f;
|
|
|
|
// Token: 0x0400013E RID: 318
|
|
public float Ortho = 12f;
|
|
|
|
// Token: 0x0400013F RID: 319
|
|
public float MinOrtho = 7f;
|
|
|
|
// Token: 0x04000140 RID: 320
|
|
public float MaxOrtho = 14f;
|
|
|
|
// Token: 0x04000141 RID: 321
|
|
public bool canMoveCamera;
|
|
|
|
// Token: 0x04000142 RID: 322
|
|
public Vector3 MinBounds;
|
|
|
|
// Token: 0x04000143 RID: 323
|
|
public Vector3 MaxBounds;
|
|
|
|
// Token: 0x04000144 RID: 324
|
|
public float MinDistance;
|
|
|
|
// Token: 0x04000145 RID: 325
|
|
public float MaxDistance = 300f;
|
|
|
|
// Token: 0x04000146 RID: 326
|
|
public float MinTilt = -360f;
|
|
|
|
// Token: 0x04000147 RID: 327
|
|
public float MaxTilt = 360f;
|
|
|
|
// Token: 0x04000148 RID: 328
|
|
public float minClipPlane = 0.1f;
|
|
|
|
// Token: 0x04000149 RID: 329
|
|
public float bokehMultiplier = 0.002f;
|
|
|
|
// Token: 0x0400014A RID: 330
|
|
public string combatFollowType;
|
|
|
|
// Token: 0x0400014B RID: 331
|
|
public Transform shadowCollector;
|
|
|
|
// Token: 0x0400014C RID: 332
|
|
public Vector3 followStartPosition;
|
|
|
|
// Token: 0x0400014D RID: 333
|
|
public Transform cameraTargetTr;
|
|
|
|
// Token: 0x0400014E RID: 334
|
|
public Vector3 cameraTargetPosition;
|
|
|
|
// Token: 0x0400014F RID: 335
|
|
public string currentBoundsName;
|
|
|
|
// Token: 0x04000150 RID: 336
|
|
public BoxCollider coll;
|
|
|
|
// Token: 0x04000151 RID: 337
|
|
public bool panning;
|
|
|
|
// Token: 0x04000152 RID: 338
|
|
public float dialogueHeight = 0.1f;
|
|
|
|
// Token: 0x04000153 RID: 339
|
|
public bool inspecting;
|
|
|
|
// Token: 0x04000154 RID: 340
|
|
public bool cameraShake;
|
|
|
|
// Token: 0x04000155 RID: 341
|
|
private float startNearClipPlane;
|
|
|
|
// Token: 0x04000156 RID: 342
|
|
private float cameraShakeTime;
|
|
|
|
// Token: 0x04000157 RID: 343
|
|
private string cameraShakeType;
|
|
|
|
// Token: 0x04000158 RID: 344
|
|
private float scroll;
|
|
|
|
// Token: 0x04000159 RID: 345
|
|
private float distFromWhereCamShouldBeToCamTarget;
|
|
|
|
// Token: 0x0400015A RID: 346
|
|
public int zoomCount;
|
|
|
|
// Token: 0x0400015B RID: 347
|
|
private Camera returnPerspective;
|
|
|
|
// Token: 0x0400015C RID: 348
|
|
public Action<Transform> OnBeginFollow;
|
|
|
|
// Token: 0x0400015D RID: 349
|
|
public Action<Transform> OnEndFollow;
|
|
|
|
// Token: 0x0400015E RID: 350
|
|
private bool first;
|
|
|
|
// Token: 0x0400015F RID: 351
|
|
public Transform tr;
|
|
|
|
// Token: 0x04000160 RID: 352
|
|
private Vector3 worldMousePosition;
|
|
|
|
// Token: 0x04000161 RID: 353
|
|
private Vector3 _initialLookAt;
|
|
|
|
// Token: 0x04000162 RID: 354
|
|
private float _initialDistance;
|
|
|
|
// Token: 0x04000163 RID: 355
|
|
private bool scrolling;
|
|
|
|
// Token: 0x04000164 RID: 356
|
|
private bool needToJump;
|
|
|
|
// Token: 0x04000165 RID: 357
|
|
private float _initialMinDistance;
|
|
|
|
// Token: 0x04000166 RID: 358
|
|
private float _initialRotation;
|
|
|
|
// Token: 0x04000167 RID: 359
|
|
private float _initialTilt;
|
|
|
|
// Token: 0x04000168 RID: 360
|
|
private float prevCamOrtho;
|
|
|
|
// Token: 0x04000169 RID: 361
|
|
private float savedOrtho;
|
|
|
|
// Token: 0x0400016A RID: 362
|
|
private Vector3 originalPos;
|
|
|
|
// Token: 0x0400016B RID: 363
|
|
private float _currDistance;
|
|
|
|
// Token: 0x0400016C RID: 364
|
|
private float _currRotation;
|
|
|
|
// Token: 0x0400016D RID: 365
|
|
private float _currTilt;
|
|
|
|
// Token: 0x0400016E RID: 366
|
|
private float _currOrtho;
|
|
|
|
// Token: 0x0400016F RID: 367
|
|
private float prevZoomed;
|
|
|
|
// Token: 0x04000170 RID: 368
|
|
private float prevRotation;
|
|
|
|
// Token: 0x04000171 RID: 369
|
|
private float SavedZoomDampening;
|
|
|
|
// Token: 0x04000172 RID: 370
|
|
private float SavedMoveDampening;
|
|
|
|
// Token: 0x04000173 RID: 371
|
|
private float prevTilt;
|
|
|
|
// Token: 0x04000174 RID: 372
|
|
public int singleJumpFrame;
|
|
|
|
// Token: 0x04000175 RID: 373
|
|
private Character lastFollow;
|
|
|
|
// Token: 0x04000176 RID: 374
|
|
private float AdjustedDistance;
|
|
|
|
// Token: 0x04000177 RID: 375
|
|
public Vector3 LookAt;
|
|
|
|
// Token: 0x04000178 RID: 376
|
|
private Character pocketTarget;
|
|
|
|
// Token: 0x04000179 RID: 377
|
|
public GameObject puzzleTarget;
|
|
|
|
// Token: 0x0400017A RID: 378
|
|
public GameObject joyTarget;
|
|
|
|
// Token: 0x0400017B RID: 379
|
|
public bool puzzleLerp;
|
|
|
|
// Token: 0x0400017C RID: 380
|
|
public bool returningLerp;
|
|
|
|
// Token: 0x0400017D RID: 381
|
|
public bool puzzleSnapCamera;
|
|
|
|
// Token: 0x0400017E RID: 382
|
|
public bool targetSelecting;
|
|
|
|
// Token: 0x0400017F RID: 383
|
|
public Vector3 pocketPoint;
|
|
|
|
// Token: 0x04000180 RID: 384
|
|
private Vector3 _moveVector;
|
|
|
|
// Token: 0x04000181 RID: 385
|
|
private Vector3 prevLookAt;
|
|
|
|
// Token: 0x04000182 RID: 386
|
|
private Vector3 prevCameraPlace;
|
|
|
|
// Token: 0x04000183 RID: 387
|
|
private GameObject rigidTarget;
|
|
|
|
// Token: 0x04000184 RID: 388
|
|
public GameObject cameraTarget;
|
|
|
|
// Token: 0x04000185 RID: 389
|
|
private Camera cam;
|
|
|
|
// Token: 0x04000186 RID: 390
|
|
private Camera savedPerspectiveCam;
|
|
|
|
// Token: 0x04000187 RID: 391
|
|
public Camera topCam;
|
|
|
|
// Token: 0x04000188 RID: 392
|
|
public Camera depthCam;
|
|
|
|
// Token: 0x04000189 RID: 393
|
|
private MeshRenderer _targetRenderer;
|
|
|
|
// Token: 0x0400018A RID: 394
|
|
public Transform followTarget;
|
|
|
|
// Token: 0x0400018B RID: 395
|
|
public Character followCharacter;
|
|
|
|
// Token: 0x0400018C RID: 396
|
|
public Character doorJumpCharacter;
|
|
|
|
// Token: 0x0400018D RID: 397
|
|
public Vector3 cameraMiddleWorldPosition;
|
|
|
|
// Token: 0x0400018E RID: 398
|
|
public CameraControls cameraControls;
|
|
|
|
// Token: 0x0400018F RID: 399
|
|
private Rigidbody rigid;
|
|
|
|
// Token: 0x04000190 RID: 400
|
|
private Vector3 directionAdd;
|
|
|
|
// Token: 0x04000191 RID: 401
|
|
private float currentTimeDelta;
|
|
|
|
// Token: 0x04000192 RID: 402
|
|
private bool slowDialogue;
|
|
|
|
// Token: 0x04000193 RID: 403
|
|
private Vector3 savedDirectionBoundsLeft;
|
|
|
|
// Token: 0x04000194 RID: 404
|
|
private Vector3 savedDirectionBoundsRight;
|
|
|
|
// Token: 0x04000195 RID: 405
|
|
private Vector3 savedDirectionBoundsUp;
|
|
|
|
// Token: 0x04000196 RID: 406
|
|
private Vector3 savedDirectionBoundsDown;
|
|
|
|
// Token: 0x04000197 RID: 407
|
|
public Vector3 topLeftBounds;
|
|
|
|
// Token: 0x04000198 RID: 408
|
|
public Vector3 topRightBounds;
|
|
|
|
// Token: 0x04000199 RID: 409
|
|
public Vector3 bottomLeftBounds;
|
|
|
|
// Token: 0x0400019A RID: 410
|
|
public Vector3 bottomRightBounds;
|
|
|
|
// Token: 0x0400019B RID: 411
|
|
public Vector3 topLeftBoundsInterior;
|
|
|
|
// Token: 0x0400019C RID: 412
|
|
public Vector3 topRightBoundsInterior;
|
|
|
|
// Token: 0x0400019D RID: 413
|
|
public Vector3 bottomLeftBoundsInterior;
|
|
|
|
// Token: 0x0400019E RID: 414
|
|
public Vector3 bottomRightBoundsInterior;
|
|
|
|
// Token: 0x0400019F RID: 415
|
|
public Quaternion cameraRotation;
|
|
|
|
// Token: 0x040001A0 RID: 416
|
|
public bool ignoreRemoveControls;
|
|
|
|
// Token: 0x040001A1 RID: 417
|
|
private Vector3 touchStart;
|
|
|
|
// Token: 0x040001A2 RID: 418
|
|
private Vector3 panStartPosition;
|
|
|
|
// Token: 0x040001A3 RID: 419
|
|
private Vector3 prevWorldMousePosition;
|
|
|
|
// Token: 0x040001A4 RID: 420
|
|
private Plane groundPlane;
|
|
|
|
// Token: 0x040001A5 RID: 421
|
|
private Plane groundPlaneDown;
|
|
|
|
// Token: 0x040001A6 RID: 422
|
|
public Plane cameraPlane;
|
|
|
|
// Token: 0x040001A7 RID: 423
|
|
public Plane colliderPlane;
|
|
|
|
// Token: 0x040001A8 RID: 424
|
|
public Transform cursor;
|
|
|
|
// Token: 0x040001A9 RID: 425
|
|
private float timeAtPanStart;
|
|
|
|
// Token: 0x040001AA RID: 426
|
|
public Transform bokehFollow;
|
|
|
|
// Token: 0x040001AB RID: 427
|
|
private float savedMinOrtho;
|
|
|
|
// Token: 0x040001AC RID: 428
|
|
private float savedOrthoSize;
|
|
|
|
// Token: 0x040001AD RID: 429
|
|
private float savedOrthoRotation;
|
|
|
|
// Token: 0x040001AE RID: 430
|
|
private float initialMinOrtho;
|
|
|
|
// Token: 0x040001AF RID: 431
|
|
private Vector3 savedOrthoLookAt;
|
|
|
|
// Token: 0x040001B0 RID: 432
|
|
private Vector3 savedOrthoPosition;
|
|
|
|
// Token: 0x040001B1 RID: 433
|
|
private float savedOrthoDistance;
|
|
|
|
// Token: 0x040001B2 RID: 434
|
|
private float savedFarClip;
|
|
|
|
// Token: 0x040001B3 RID: 435
|
|
private float savedNearClip;
|
|
|
|
// Token: 0x040001B4 RID: 436
|
|
private float startBokehLength;
|
|
|
|
// Token: 0x040001B5 RID: 437
|
|
public bool useBokeh;
|
|
|
|
// Token: 0x040001B6 RID: 438
|
|
public LayerMask mainCameraCulling;
|
|
|
|
// Token: 0x040001B7 RID: 439
|
|
public Color synergy1;
|
|
|
|
// Token: 0x040001B8 RID: 440
|
|
public Color synergy2;
|
|
|
|
// Token: 0x040001B9 RID: 441
|
|
public Color player1;
|
|
|
|
// Token: 0x040001BA RID: 442
|
|
public Color player2;
|
|
|
|
// Token: 0x040001BB RID: 443
|
|
public Color player3;
|
|
|
|
// Token: 0x040001BC RID: 444
|
|
public Color player4;
|
|
|
|
// Token: 0x040001BD RID: 445
|
|
public string sceneName;
|
|
}
|