using System; using System.Collections; using System.Collections.Generic; using DarkTonic.MasterAudio; using Pathfinding; using UnityEngine; // Token: 0x02000016 RID: 22 public class Boat : MonoBehaviour { // Token: 0x06000217 RID: 535 RVA: 0x0002CB28 File Offset: 0x0002AD28 private void Awake() { this.tr = base.transform; this.originalScale = this.tr.localScale; this.bouyancy = base.gameObject.GetComponent(); if (!this.bouyancy) { this.useBuoyancy = false; } this.rbody = base.gameObject.GetComponent(); this.rbody.isKinematic = true; this.rbody.useGravity = false; if (this.useBuoyancy) { this.bouyancy.enabled = false; } this.moveFollow = this.tr; base.gameObject.layer = 18; for (int i = 0; i < this.renderers.Length; i++) { this.renderers[i].gameObject.layer = 18; } this.tr.localScale = this.originalScale; if (this.animator) { this.animator.updateMode = AnimatorUpdateMode.Normal; } } // Token: 0x06000218 RID: 536 RVA: 0x0002CC20 File Offset: 0x0002AE20 private void Start() { this.settingPosition = false; if (this.partyBoat && !this.boatFollow) { GameObject gameObject = new GameObject("Boat Follow"); this.boatFollow = gameObject.transform; this.boatFollow.SetParent(this.tr, true); this.boatFollow.SetParent(null, true); } if (this.inMenu) { for (int i = 0; i < this.renderers.Length; i++) { this.renderers[i].gameObject.layer = 25; } this.tr.localScale = new Vector3(0.4f, 0.4f, 0.4f); if (this.animator) { this.animator.updateMode = AnimatorUpdateMode.UnscaledTime; this.animator.Play(this.animationOpenName, 0, 0.99f); } } } // Token: 0x06000219 RID: 537 RVA: 0x0002CD00 File Offset: 0x0002AF00 private void Update() { if (this.sailing && !Records.x.typing && Links.x.gaia.sceneLoaded && Links.x.gaia.pathfindingReady && !this.settingPosition) { if (this.canExit && Input.GetKeyDown(Links.x.keyControl.GetHotkey("Interact"))) { this.GetOffBoat(); } if (Time.timeSinceLevelLoad > this.updateTime + 1f) { this.CheckInTile(); this.updateTime = Time.timeSinceLevelLoad; this.updateTimeCount++; if (this.updateTimeCount > 100) { this.updateTimeCount = 0; this.ResetNode(); } } if (!this.leavingBoat) { float magnitude = this.rbody.linearVelocity.magnitude; float magnitude2 = this.rbody.angularVelocity.magnitude; for (int i = 0; i < this.sailors.Count; i++) { Character character = this.sailors[i]; if (character && !character.jumping) { character.SetPosition(this.standingSpots[i].position, null); if (!character.isBoro && !character.stats.animal) { float num = 6f; bool flag = false; if (magnitude2 > 1f) { bool flag2 = this.IsSailorLeft(character); if (!this.turningLeft && !flag2) { flag = true; } if (this.turningLeft && flag2) { flag = true; } } float num2; if (character.animator.GetBool("Combat")) { num2 = character.animator.GetFloat("Combat Variation"); } else { num2 = character.animator.GetFloat("Idle Variation"); } if ((magnitude > 1f || magnitude2 > 1f) && !flag && (this.physicsMove || this.movePoint != Vector3.zero || this.turning)) { if (num2 < 0.99f) { character.animator.SetFloat("Idle Variation", Mathf.Lerp(num2, 1f, Time.deltaTime * num)); character.animator.SetFloat("Combat Variation", Mathf.Lerp(num2, 1f, Time.deltaTime * num)); } else { character.animator.SetFloat("Idle Variation", 1f); character.animator.SetFloat("Combat Variation", 1f); } if (!character.oar) { character.NeedToUpdateSailingAnimator(false); } } else if (num2 > 0.01f) { character.animator.SetFloat("Idle Variation", Mathf.Lerp(num2, 0f, Time.deltaTime * num)); character.animator.SetFloat("Combat Variation", Mathf.Lerp(num2, 0f, Time.deltaTime * num)); } else { character.animator.SetFloat("Idle Variation", 0f); character.animator.SetFloat("Combat Variation", 0f); } } bool flag3 = true; if (character.hasActions) { flag3 = character.oar; } if (flag3) { character.SetRotation(Quaternion.Slerp(character.tr.rotation, this.standingSpots[i].rotation, Time.deltaTime * 40f), false, true); } } } if (this.splashFront) { float num3 = this.tr.position.y + 1f; num3 = Links.x.diorama.waterY + 0.1f; Vector3 eulerAngles = this.tr.rotation.eulerAngles; eulerAngles.x = 0f; eulerAngles.z = 0f; Quaternion quaternion = Quaternion.Euler(eulerAngles); if (!this.splashFront.activeSelf) { this.splashFront.SetActive(true); } this.splashFront.transform.position = new Vector3(this.tr.position.x, num3, this.tr.position.z); this.splashFront.transform.rotation = quaternion; if (!this.splashBack.activeSelf) { this.splashBack.SetActive(true); } this.splashBack.transform.position = new Vector3(this.tr.position.x, num3, this.tr.position.z); this.splashBack.transform.rotation = quaternion; int num4 = Mathf.RoundToInt(magnitude * 4f); int num5 = Mathf.RoundToInt(magnitude * 1.5f); for (int j = 0; j < this.splashParticles.Count; j++) { ParticleSystem.MainModule main = this.splashParticles[j].main; if (this.splashParticles[j].gameObject.name.Contains("Splash")) { main.maxParticles = num5; } else { main.maxParticles = num4; } } } if (this.partyBoat) { Links.x.gaia.boro.SetPosition(this.standingSpots[4].position, null); Links.x.gaia.boro.SetRotation(this.standingSpots[4].rotation, false, true); } } float x = this.tr.rotation.eulerAngles.x; float z = this.tr.rotation.eulerAngles.z; if (this.navigator && this.startSailCoroutine == null) { if ((x > 30f && x < 330f) || (z > 30f && z < 330f) || this.tr.position.y < Links.x.diorama.boatColliderY) { if (!this.isCapsized) { this.startCapsizedRot = this.tr.rotation; } this.isCapsized = true; float num6 = this.tr.rotation.eulerAngles.x; float num7 = this.tr.rotation.eulerAngles.z; float num8 = 900f * Time.deltaTime; if (x > 30f && x < 330f) { if (x < 180f) { num6 -= num8; } if (x >= 180f) { num6 += num8; } } else if (z > 30f && z < 330f) { if (z < 180f) { num7 -= num8; } if (z >= 180f) { num7 += num8; } } this.rbody.rotation = Quaternion.Euler(new Vector3(num6, this.tr.rotation.eulerAngles.y, num7)); if (this.navigator) { this.rbody.isKinematic = true; } if (this.tr.position.y < Links.x.diorama.boatColliderY) { this.tr.position += Vector3.up * Time.deltaTime * 50f; } } else { this.isCapsized = false; if (this.navigator) { this.rbody.isKinematic = false; } } } else { this.isCapsized = false; } } if (this.sailing) { if (Records.x.pocketPause && !this.pocket) { this.pocket = true; this.savedVelocity = this.rbody.linearVelocity; this.savedAngularVelocity = this.rbody.angularVelocity; this.rbody.isKinematic = true; return; } if (!Records.x.pocketPause && this.pocket) { this.pocket = false; this.rbody.isKinematic = false; this.rbody.AddForce(this.savedVelocity, ForceMode.VelocityChange); this.rbody.AddTorque(this.savedAngularVelocity, ForceMode.VelocityChange); } } } // Token: 0x0600021A RID: 538 RVA: 0x0002D570 File Offset: 0x0002B770 private void LateUpdate() { if (this.sailing && this.partyBoat) { this.BoatFollow(); } } // Token: 0x0600021B RID: 539 RVA: 0x0002D588 File Offset: 0x0002B788 public void NewPoint(Vector3 pt, GraphNode targetNode) { this.movePoint = pt; Vector3 vector = this.movePoint; vector.y = this.tr.position.y; this.look = Quaternion.LookRotation(vector - this.tr.position); this.rot = this.look; this.moveDistance = (vector - this.tr.position).sqrMagnitude; this.closeToPoint = false; this.savedTargetNode = targetNode; this.prevDist = 1000000f; this.turning = false; if ((Links.x.rtsCamera.cameraTargetTr.position - this.tr.position).sqrMagnitude < 625f) { MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); } } // Token: 0x0600021C RID: 540 RVA: 0x0002D6A0 File Offset: 0x0002B8A0 private void BoatFollow() { if (Records.x.pocketPause) { return; } Vector3 vector = Vector3.Lerp(this.boatFollow.position, this.tr.position, Time.unscaledDeltaTime * 2f); if (this.node != null) { Vector3 vector2 = (Vector3)this.node.position; vector.y = vector2.y; } this.boatFollow.position = vector; if (this.noiseUpdateTime > Time.timeSinceLevelLoad + 2f) { this.noiseUpdateTime = Time.timeSinceLevelLoad; for (int i = 0; i < this.sailors.Count; i++) { Links.x.sensory.AddFootstep(this.sailors[i]); } } } // Token: 0x0600021D RID: 541 RVA: 0x0002D764 File Offset: 0x0002B964 private void StopMove() { if (!this.mainTurning) { this.moving = false; } if (this.rbody.linearVelocity.magnitude < 0.01f && !this.mainTurning) { this.physicsMove = false; } } // Token: 0x0600021E RID: 542 RVA: 0x0002D7AC File Offset: 0x0002B9AC private void FixedUpdate() { if (this.sailing) { if (Records.x.pocketPause) { return; } bool flag = true; if (this.partyBoat && Links.x.joy) { flag = false; } this.t1 += Time.deltaTime * 5f; this.waveValue = Mathf.Lerp(this.startValue1, this.targetValue1, this.t1); if (this.waveValue >= this.targetValue1 && this.targetValue1 > 50f) { this.targetValue1 = Random.Range(0f, 10f); this.startValue1 = this.waveValue; this.t1 = 0f; } if (this.waveValue <= this.targetValue1 && this.targetValue1 < 50f) { this.startValue1 = this.waveValue; this.targetValue1 = Random.Range(90f, 100f); this.t1 = 0f; } this.rbody.AddForce(Vector3.up * (-1f * this.waveValue * this.waveMultiplier) * Time.fixedDeltaTime, ForceMode.Force); if (!this.isCapsized) { if (this.partyBoat) { bool flag2 = false; if (Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Left")) || Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Right")) || Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Up")) || Input.GetKey(Links.x.gameplay.keyControl.GetHotkey("Down"))) { flag2 = true; } bool flag3 = this.physicsMove; Vector3 one = Vector3.one; Quaternion quaternion = this.rot; this.physicsMove = Links.x.fellowship.GetDirection(Links.x.main, out quaternion, out one); if (this.physicsMove && !Links.x.main.CanPhysicsMove(flag2)) { this.physicsMove = false; } if (this.physicsMove) { this.rot = this.tr.rotation; if (this.previouslyMovingStartTime == 0f && !flag3) { this.previouslyMovingStartTime = Time.timeSinceLevelLoad; } if (this.previouslyMovingStartTime > 0f && Time.timeSinceLevelLoad > this.previouslyMovingStartTime + 0.05f) { this.previouslyMovingStartTime = 0f; } if (this.navigator && this.navigator.waypoint && this.navigator.waypoint.transform.position.x != Links.x.gameplay.farPosition.x) { this.navigator.waypoint.transform.position = Links.x.gameplay.farPosition; } if (!flag3 && (Links.x.gameplay.holdingMouseButton || flag2)) { this.navigator.ClearMoveTargets(); } if ((Links.x.gameplay.holdingMouseButton || (flag2 && !flag3)) && this.navigator) { this.navigator.ClearNodePath(); this.movePoint = Vector3.zero; } if (!Records.x.pocketPause && Records.x.InCombat(false) && Links.x.combat.GetNPCCountHostile() == 0 && Links.x.main.attackTime >= 1f) { Links.x.combat.EndCombat(false); } bool flag4 = true; this.rot = Quaternion.Slerp(this.tr.rotation, quaternion, Time.fixedDeltaTime * 30f); Vector3 vector = this.tr.position + this.rot * Vector3.forward * 2f; GraphNode graphNode = this.NearNode(vector, false, 0, -1); if (graphNode != null) { Vector3 vector2 = (Vector3)graphNode.position; if ((new Vector3(vector2.x, vector.y, vector2.z) - vector).sqrMagnitude > 30.25f) { flag4 = false; } } else { flag4 = false; this.rbody.linearVelocity *= 0.5f; } this.smoothRot = this.tr.rotation; Vector3 vector3 = Quaternion.Euler(0f, this.tr.rotation.eulerAngles.y, 0f) * Vector3.forward; this.targetRotation = Quaternion.Euler(0f, quaternion.eulerAngles.y, 0f); Vector3 vector4 = this.targetRotation * Vector3.forward; float num = Vector3.Dot(vector3, vector4); bool flag5 = this.moving; bool flag6 = true; float num2 = Quaternion.Angle(this.targetRotation, this.tr.rotation); if (Mathf.Abs(num2) > 8f && this.navigator.NodesCount() == 0) { float num3 = this.rbody.linearVelocity.sqrMagnitude / 100f; bool flag7 = false; if (this.AngleDir(this.tr.forward, this.targetRotation * Vector3.forward, this.tr.up) < 0f) { flag7 = true; this.turningLeft = true; } else { this.turningLeft = false; } float num4 = 30f * (Mathf.Abs(num2) / 200f) + num3; if (flag7) { num4 *= -1f; } this.rbody.AddTorque(new Vector3(0f, num4, 0f) * this.turnSpeed * 50f * Time.fixedDeltaTime); } if (((flag5 && num < -0.2f) || (!flag5 && num < 0.6f)) && flag6 && !Records.x.pocketPause) { this.mainTurning = true; } else { this.mainTurning = false; } if (flag4 && !this.mainTurning) { this.moving = true; if (graphNode != this.node) { this.ClaimNode(graphNode, (Vector3)graphNode.position, false); } float num5 = Mathf.Clamp((180f - Mathf.Abs(num2)) / 180f, 0.5f, 1f); this.rbody.AddForce(this.tr.rotation * Vector3.forward * this.GetSpeed() * num5 * Time.fixedDeltaTime, ForceMode.Acceleration); } this.turning = false; this.rotating = false; } else if (this.navigator && !this.navigator.moving) { this.StopMove(); } } if (this.navigator && flag) { if (this.navigator.moving && this.navigator.blockedTime == 0f && !this.navigator.waitingForNewPath && this.navigator.NodesCount() > 0 && this.movePoint != Vector3.zero) { Vector3 vector5 = this.movePoint; vector5.y = this.tr.position.y; Vector3 vector6 = vector5 - this.tr.position; float sqrMagnitude = vector6.sqrMagnitude; Vector3 vector7 = this.tr.TransformDirection(Vector3.forward); Vector3 vector8 = Vector3.Normalize(vector6); float num6 = Vector3.Dot(vector7, vector8); float num7 = Quaternion.Angle(this.rot, this.savedRot); this.smoothRot = this.tr.rotation; if (this.turning || (sqrMagnitude > 9f && num6 < 0.65f)) { this.angleRemaining = Quaternion.Angle(this.rot, this.smoothRot); this.intervalAngleRemaining = Quaternion.Angle(this.intervalRot, this.smoothRot); float num8 = Quaternion.Angle(this.tr.rotation, this.smoothRot); if (this.turning && (this.rot == this.smoothRot || this.angleRemaining < 15f) && num7 < 15f) { this.EndTurning(); } else if (num7 >= 15f || this.intervalAngleRemaining < 15f || !this.turning || num8 < 5f) { this.rotationTime = 0f; this.startRot = this.smoothRot; this.startRotY = this.startRot.eulerAngles.y; this.turning = true; this.savedRot = this.rot; float num9 = this.AngleDir(this.tr.forward, this.rot * Vector3.forward, Vector3.up); float num10 = this.angleRemaining; if (num10 <= 45f) { Vector3 eulerAngles = this.smoothRot.eulerAngles; this.intervalY = eulerAngles.y + num10 * num9; this.intervalRot = this.rot; } else { Vector3 eulerAngles2 = this.smoothRot.eulerAngles; this.intervalY = eulerAngles2.y + 45f * num9; this.intervalRot = Quaternion.Euler(new Vector3(eulerAngles2.x, this.intervalY, eulerAngles2.z)); } } if (this.turning) { this.rotating = false; Vector3 vector9 = this.tr.position + this.tr.forward * 1f; bool flag8; if ((vector9 - (Vector3)this.node.position).sqrMagnitude > 1f) { GraphNode graphNode2 = this.NearNode(vector9, true, 0, -1); if (graphNode2 != null) { if (((Vector3)graphNode2.position - vector9).sqrMagnitude < 1f) { flag8 = true; this.ClaimNode(graphNode2, (Vector3)graphNode2.position, false); MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); } else { flag8 = false; } } else { flag8 = false; } } else { flag8 = true; } if (flag8) { if (this.navigator.npc) { this.rbody.AddForce(this.tr.forward * this.GetSpeed() * 0.5f * Time.fixedDeltaTime, ForceMode.Force); } else { this.rbody.AddForce(this.tr.forward * this.GetSpeed() * 8f * Time.fixedDeltaTime, ForceMode.Force); } } else { this.rbody.linearVelocity *= 0.8f; } } } if (!this.closeToPoint && !this.turning) { if (sqrMagnitude > 1f && !this.closeToPoint && sqrMagnitude < this.prevDist) { this.rotating = true; this.rbody.AddForce(this.look * Vector3.forward * this.GetSpeed() * Time.fixedDeltaTime, ForceMode.Acceleration); this.prevDist = sqrMagnitude; } else { this.rotating = false; this.closeToPoint = true; } } if (!Records.x.pocketPause) { if (this.turning) { this.rbody.useGravity = true; float num11 = 2f; this.rotationTime += Time.deltaTime * num11; float num12 = Mathf.Lerp(this.startRotY, this.intervalY, this.rotationTime); this.smoothRot = Quaternion.Euler(new Vector3(0f, num12, 0f)); } else if (this.rotating && !this.turning) { this.rbody.useGravity = true; this.smoothRot = Quaternion.Slerp(this.smoothRot, this.rot, Time.deltaTime * this.turnSpeed); } Vector3 eulerAngles3 = this.tr.rotation.eulerAngles; if (this.turning || this.rotating) { float num13 = Quaternion.Angle(this.rot, this.tr.rotation); if (num13 > 7f || this.turning) { bool flag9 = false; Vector3 vector10 = this.movePoint - this.tr.position; if (this.AngleDir(this.tr.forward, Vector3.Normalize(vector10), this.tr.up) < 0f) { flag9 = true; this.turningLeft = true; } else { this.turningLeft = false; } float num14 = 0.5f; if (this.navigator.npc) { num14 = 0.3f; } float num15 = Mathf.Clamp(Mathf.Abs(num13) / 180f, num14, 1f); float num16 = 90f * num15; if (flag9) { num16 *= -1f; } this.rbody.AddTorque(new Vector3(0f, num16, 0f) * this.turnSpeed * 10f * Time.fixedDeltaTime); return; } this.rotating = false; return; } } } else if (this.movePoint == Vector3.zero && (!this.partyBoat || (this.partyBoat && !this.physicsMove))) { this.turning = false; this.movePoint = Vector3.zero; } } } } } // Token: 0x0600021F RID: 543 RVA: 0x0002E5B0 File Offset: 0x0002C7B0 public void StopBoat() { this.movePoint = Vector3.zero; if (this.navigator) { this.navigator.sphere.transform.position = this.tr.position; this.navigator.TargetReached(); } } // Token: 0x06000220 RID: 544 RVA: 0x0002E600 File Offset: 0x0002C800 private float GetSpeed() { if (this.partyBoat) { float num = 0f; float num2 = 0f; float num3 = 0f; float num4 = 0f; return (this.speed + Links.x.fellowship.GetSailingSpeed(out num, out num2, out num3, out num4)) * 100f; } return this.speed; } // Token: 0x06000221 RID: 545 RVA: 0x0002E658 File Offset: 0x0002C858 private void EndTurning() { if (this.turning) { this.turning = false; Vector3 vector = this.movePoint; vector.y = this.tr.position.y; Vector3 vector2 = vector - this.tr.position; Vector3 vector3 = this.tr.TransformDirection(Vector3.forward); Vector3 vector4 = Vector3.Normalize(vector2); if (Vector3.Dot(vector3, vector4) < 0.5f) { this.navigator.EarlyFinish(false); if (!this.navigator.npc) { this.navigator.showWaypoint = true; } if (Time.timeSinceLevelLoad > this.timeSincePath + 0.25f || this.timeSincePath == 0f) { this.navigator.MakePath(this.savedTargetNode, 500, false, false, true); this.timeSincePath = Time.timeSinceLevelLoad; return; } } else { this.prevDist = vector2.sqrMagnitude + 0.2f; } } } // Token: 0x06000222 RID: 546 RVA: 0x0002E748 File Offset: 0x0002C948 public void TargetReached() { this.movePoint = Vector3.zero; } // Token: 0x06000223 RID: 547 RVA: 0x0002E758 File Offset: 0x0002C958 public void HoverIn() { for (int i = 0; i < this.renderers.Length; i++) { if (this.renderers[i] && this.renderers[i].gameObject.layer != 29) { this.mats = this.renderers[i].materials; Material[] array = this.mats; for (int j = 0; j < array.Length; j++) { array[j].SetFloat("_Hover", 1f); } } } } // Token: 0x06000224 RID: 548 RVA: 0x0002E7D8 File Offset: 0x0002C9D8 public void HoverOut() { for (int i = 0; i < this.renderers.Length; i++) { if (this.renderers[i] && this.renderers[i].gameObject.layer != 29) { this.mats = this.renderers[i].materials; Material[] array = this.mats; for (int j = 0; j < array.Length; j++) { array[j].SetFloat("_Hover", 0f); } } } } // Token: 0x06000225 RID: 549 RVA: 0x0002E858 File Offset: 0x0002CA58 public bool CanEnterLeaveBoat() { bool flag = true; this.party = Links.x.portraitOrder; for (int i = 0; i < this.party.Count; i++) { if (this.party[i] && !this.party[i].summoned && !this.party[i].isBoro && (!this.party[i].IsSentient() || this.party[i].isHit || this.party[i].stats.pinned || this.party[i].stats.pinning || this.party[i].stats.Stuck() != 0 || this.party[i].stats.Confuse() != 0)) { flag = false; break; } } return flag; } // Token: 0x06000226 RID: 550 RVA: 0x0002E960 File Offset: 0x0002CB60 public bool CanSail(out bool onBeach) { bool flag = true; onBeach = false; this.party = Links.x.portraitOrder; for (int i = 0; i < this.party.Count; i++) { if (this.party[i] && flag && !this.party[i].summoned && !this.party[i].isBoro && this.party[i].IsSentient() && !this.party[i].mainSelected && (this.party[i].tr.position - Links.x.main.tr.position).sqrMagnitude > 400f) { flag = false; } } if (this.party.Count == 0) { return false; } if (Records.x.InCombat(false)) { flag = false; } return flag; } // Token: 0x06000227 RID: 551 RVA: 0x0002EA64 File Offset: 0x0002CC64 public void GetOnWater() { bool flag = false; if (!this.CanSail(out flag)) { Links.x.gameFeed.AddFeed("Cannot sail right now, party is busy"); return; } if (Links.x.gaia.pathfindingReady && this.startSailCoroutine == null) { base.enabled = true; base.gameObject.SetActive(true); this.boat.SetActive(false); this.startSailCoroutine = this.BoatToWater(); base.StartCoroutine(this.startSailCoroutine); } } // Token: 0x06000228 RID: 552 RVA: 0x0002EAE3 File Offset: 0x0002CCE3 private IEnumerator BoatToWater() { this.settingPosition = false; if (Records.x.circle) { Links.x.fellowship.BreakCircle(false); } Records.x.RemoveControls(true); Records.x.holdCombat = true; if (Records.x.paused) { Links.x.gameplay.TogglePause(false); } if (!this.tr) { this.tr = base.transform; } this.rbody.isKinematic = true; if (this.useBuoyancy) { this.bouyancy.enabled = false; } for (int l = 0; l < this.states.Length; l++) { this.states[l] = ""; } Character boro = Links.x.gaia.boro; bool boroMovesToWater = false; float radius = 20f; GraphNode centerNode = Links.x.main.node; this.SetNodeConstraint(null, false); this.SetNodeConstraint(null, false); this.nodeConstraint.checkConnections = 0; this.nodeConstraint.constrainWalkability = false; centerNode = Links.x.gaia.exteriorGraph.GetNearestForce(Links.x.main.tr.position, this.nodeConstraint).node; this.nodeConstraint.constrainToEnvironment = -1; this.nodeConstraint.constrainWalkability = false; ConstantPath constPath = ConstantPath.ConstructFast(centerNode, Records.x.GetConstantPathRadius((int)radius), null); constPath.nnConstraint = this.nodeConstraint; AstarPath.StartPath(constPath, false); yield return base.StartCoroutine(constPath.WaitForPath()); constPath.Claim(this); this.allNodes = constPath.allNodes; int num = this.allNodes.Count; Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; Vector3 zero3 = Vector3.zero; Vector3 zero4 = Vector3.zero; Vector3 forward = Vector3.forward; Vector3 zero5 = Vector3.zero; Vector3 zero6 = Vector3.zero; this.SetNodeConstraint(boro, true); this.nodeConstraint.uniqueID = 0; int count = 0; this.suitableNodes.Clear(); this.moveNodes.Clear(); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = this.connections; this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = true; this.nodeConstraint.checkCircleID = 0; this.nodeConstraint.passID = boro.nodeStationaryID; this.nodeConstraint.passID2 = boro.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; for (int m = 0; m < num; m++) { GraphNode graphNode = this.allNodes[m]; if (((Vector3)graphNode.position - (Vector3)centerNode.position).sqrMagnitude < radius * radius && this.nodeConstraint.Suitable(graphNode)) { this.suitableNodes.Add(graphNode); } } Vector3 position = boro.tr.position; Quaternion rot = Links.x.gaia.boro.tr.rotation; Vector3 vector = rot.eulerAngles; vector.y += 87f; rot = Quaternion.Euler(vector); this.tr.rotation = rot; GraphNode graphNode2 = null; GraphNode boatTargetNode = null; new Vector3(0f, this.boatOpenJumpPosition.y, 0f); Links.x.rtsCamera.ignoreRemoveControls = true; Links.x.rtsCamera.EndFollow(); num = this.suitableNodes.Count; float num2 = float.PositiveInfinity; Vector3 currentPosition = Links.x.main.currentPosition; for (int n = 0; n < num; n++) { GraphNode graphNode = this.suitableNodes[n]; float sqrMagnitude = ((Vector3)graphNode.position - currentPosition).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; graphNode2 = graphNode; boatTargetNode = graphNode; } } bool flag; if (graphNode2 == null) { flag = false; Links.x.gameFeed.ShowNotice("No place for boat"); } else { flag = true; } if (flag && Links.x.gaia.pathfindingReady) { Records.x.StartUIFade(true, false); this.SetSailingState(boro, true); Quaternion quaternion = Quaternion.LookRotation((Vector3)boatTargetNode.position - boro.tr.position); boro.SetRotation(quaternion, false, false); Links.x.gaia.boro.meshAlwaysOff = true; Links.x.gaia.boro.SetMeshState(false); rot = quaternion; vector = rot.eulerAngles; vector.y += 87f; rot = Quaternion.Euler(vector); this.rbody.isKinematic = true; if (this.useBuoyancy) { this.bouyancy.enabled = false; } this.tr.position = (Vector3)boatTargetNode.position; this.tr.rotation = rot; this.boatFollow.position = this.tr.position; float timeToLerp = 0.25f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = (Vector3)boatTargetNode.position; this.tr.rotation = rot; this.boatFollow.position = this.tr.position; yield return null; } this.boat.SetActive(true); this.rbody.isKinematic = false; this.rbody.useGravity = true; timeToLerp = 0.5f; percentage = 0f; startTime = Time.time; while (percentage < 0.25f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = (Vector3)boatTargetNode.position; this.tr.rotation = rot; this.boatFollow.position = this.tr.position; yield return null; } this.ChangeTimeOfDay(); this.animator.Play(this.animationOpenName, 0, 1f); this.node = boatTargetNode; this.lastNode = boatTargetNode; this.SetNodeID(false, false); this.BoatFollow(); this.rbody.isKinematic = false; this.rbody.useGravity = true; if (this.useBuoyancy) { this.bouyancy.enabled = true; } boro.ignoreRemoveControls = false; boro.ignoreNodeIDs = false; this.partyNodes.Clear(); this.partyBoatNodes.Clear(); MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); int partyCounts = 4; if (boroMovesToWater) { partyCounts = this.party.Count + 1; } else { partyCounts = this.party.Count; } constPath.Release(this, false); centerNode = Links.x.main.node; this.SetNodeConstraint(null, false); this.nodeConstraint.constrainWalkability = false; this.nodeConstraint.constrainToEnvironment = 1; ConstantPath constPath2 = ConstantPath.ConstructFast(centerNode, 20000, null); constPath2.nnConstraint = this.nodeConstraint; AstarPath.StartPath(constPath2, false); yield return base.StartCoroutine(constPath2.WaitForPath()); constPath2.Claim(this); this.allNodes = constPath.allNodes; if (true) { int num8; for (int i = 0; i < partyCounts; i = num8 + 1) { num = this.allNodes.Count; Character sailor = null; if (i == this.party.Count) { sailor = Links.x.gaia.boro; } else { sailor = this.party[i]; } Vector3 spot = this.standingSpots[i].position; this.nodeConstraint.constrainToEnvironment = 1; this.SetNodeConstraint(sailor, true); count = 0; this.suitableNodes.Clear(); this.bestNodes.Clear(); this.moveNodes.Clear(); bool foundNode = false; if ((spot - sailor.tr.position).sqrMagnitude < 225f) { this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = sailor.ConnectionNumber(); this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.checkCircleID = 0; this.nodeConstraint.uniqueID = 0; this.nodeConstraint.passID = sailor.nodeStationaryID; this.nodeConstraint.passID2 = sailor.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; GraphNode graphNode3 = Links.x.gaia.exteriorGraph.GetNearestForce(spot, this.nodeConstraint).node; if (graphNode3 != null) { this.partyBoatNodes.Add(graphNode3); } else { this.partyBoatNodes.Add(null); } this.partyNodes.Add(sailor.node); foundNode = true; } if (!foundNode) { this.nodeConstraint.constrainToEnvironment = 1; this.SetNodeConstraint(sailor, true); for (int num3 = num - 1; num3 >= 0; num3--) { GraphNode graphNode = this.allNodes[num3]; if (this.SubtractVectors((Vector3)graphNode.position, spot).sqrMagnitude < 100f) { this.nodeConstraint.constrainTags = true; if (this.nodeConstraint.Suitable(graphNode)) { this.moveNodes.Add(graphNode); } } } } int start = 0; for (int j = 0; j < 3; j = num8 + 1) { if (!foundNode) { for (int num4 = 0; num4 < 10; num4++) { if (!foundNode) { float num5 = float.PositiveInfinity; int num6 = -1; for (int num7 = 0; num7 < this.moveNodes.Count; num7++) { float sqrMagnitude2 = this.SubtractVectors((Vector3)this.moveNodes[num7].position, spot).sqrMagnitude; if (sqrMagnitude2 < num5) { bool flag2 = num4 == 0; if (num4 > 0 && !this.bestNodes.Contains(this.moveNodes[num7])) { flag2 = true; } if (flag2) { num5 = sqrMagnitude2; num6 = num7; } } } if (num6 > -1) { this.bestNodes.Add(this.moveNodes[num6]); } } } yield return new WaitForEndOfFrame(); for (int k = start; k < this.bestNodes.Count; k = num8 + 1) { if (!foundNode) { ABPath p = ABPath.ConstructFast(sailor.node, this.bestNodes[k], null); this.nodeConstraint.constrainToEnvironment = 1; this.nodeConstraint.constrainTags = false; this.nodeConstraint.checkConnections = sailor.ConnectionNumber(); p.nnConstraint = this.nodeConstraint; AstarPath.StartPath(p, false); yield return base.StartCoroutine(p.WaitForPath()); p.Claim(this); num8 = count; count = num8 + 1; if (!p.error) { foundNode = true; this.partyNodes.Add(this.bestNodes[k]); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = sailor.ConnectionNumber(); this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.uniqueID = 0; this.nodeConstraint.passID = sailor.nodeStationaryID; this.nodeConstraint.passID2 = sailor.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; GraphNode graphNode4 = Links.x.gaia.exteriorGraph.GetNearestForce(spot, this.nodeConstraint).node; if (graphNode4 != null) { this.partyBoatNodes.Add(graphNode4); } else { this.partyBoatNodes.Add(null); } } p.Release(this, false); p = null; } num8 = k; } start = this.bestNodes.Count; } num8 = j; } if (!foundNode) { string text = "no node path for "; Character character = sailor; Debug.Log(text + ((character != null) ? character.ToString() : null)); this.partyNodes.Add(sailor.node); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = sailor.ConnectionNumber(); this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.uniqueID = 0; this.nodeConstraint.passID = sailor.nodeStationaryID; this.nodeConstraint.passID2 = sailor.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; GraphNode graphNode5 = Links.x.gaia.exteriorGraph.GetNearestForce(spot, this.nodeConstraint).node; this.partyBoatNodes.Add(graphNode5); } sailor = null; spot = default(Vector3); num8 = i; } } constPath2.Release(this, false); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = boro.ConnectionNumber(); this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.uniqueID = 0; this.nodeConstraint.passID = boro.nodeStationaryID; this.nodeConstraint.passID2 = boro.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; GraphNode graphNode6 = Links.x.gaia.exteriorGraph.GetNearestForce(this.standingSpots[4].position, this.nodeConstraint).node; Links.x.gaia.boro.tr.position = this.standingSpots[4].position; Links.x.gaia.boro.FirstPosition(graphNode6); Links.x.gaia.boro.ToggleBoat(false); Links.x.gaia.boro.SetRotation(this.tr.rotation, false, true); Links.x.gaia.boro.stats.model = Records.x.GetBoroModel(Records.x.boroID, false, true); Links.x.gaia.boro.SetupBody(); Links.x.gaia.boro.meshAlwaysOff = false; Links.x.gaia.boro.SetMeshState(true); Links.x.gaia.boro.body.SetMeshState(true, true); this.SetSailingState(Links.x.gaia.boro, true); Links.x.gaia.boro.ignoreRemoveControls = false; Links.x.gaia.boro.ignoreNodeIDs = false; Links.x.gaia.boro.ClearNodeIDs(); MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); Links.x.gaia.boro.tr.SetParent(this.tr, true); if (Links.x.gaia.boro.circleTr) { Links.x.gaia.boro.circleTr.SetParent(this.tr, true); } Links.x.gaia.boro.tr.position = this.standingSpots[4].position; if (boroMovesToWater) { while (this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 0.5f) { yield return null; } } this.BoatFollow(); int num9; if (boroMovesToWater) { num9 = this.party.Count + 1; } else { num9 = this.party.Count; } for (int num10 = 0; num10 < num9; num10++) { Character character2; if (num10 < this.party.Count) { character2 = this.party[num10]; } else { character2 = Links.x.gaia.boro; } Vector3 position2 = this.standingSpots[num10].position; character2.ignoreRemoveControls = true; character2.ignoreNodeIDs = true; if (num10 < this.partyNodes.Count && this.partyNodes[num10] != null) { if (this.partyNodes[num10] != character2.node) { character2.MakePath(this.partyNodes[num10], 1000, false, false, true); this.states[num10] = "Moving"; } else { this.states[num10] = "Moving"; } this.stateTimes[num10] = Time.timeSinceLevelLoad; } } this.RemoveSummons(1); this.removeSummonsTime = Time.timeSinceLevelLoad; while (this.WaitingForPartyMovement(boroMovesToWater)) { yield return null; } if (this.removeSummonsTime != 0f) { this.RemoveSummons(2); this.removeSummonsTime = 0f; } boro.FindCurrentNode(false); if (boro.circleTr) { boro.circleTr.gameObject.SetActive(false); } this.ReturnOarSplashes(); this.sailors.Clear(); for (int num11 = 0; num11 < this.party.Count; num11++) { if (this.party[num11] && !this.party[num11].summoned) { this.SetSailingState(this.party[num11], true); this.sailors.Add(this.party[num11]); this.AddOarSplash(); } } this.ChangeTimeOfDay(); this.sailing = true; Records.x.partySailing = true; Links.x.gaia.boro.boatNavigator = true; this.navigator = Links.x.gaia.boro; Links.x.gaia.boro.boat = this; rot = this.tr.rotation; this.smoothRot = rot; this.AddSplashes(); Links.x.rtsCamera.Follow(Links.x.main.tr, Links.x.main, false); this.setup = true; Records.x.StartUIFade(false, false); Links.x.beachCollider.SetActive(true); Links.x.partyColliderAdventure.beachCollector.SwitchBeachCollider(); this.noiseUpdateTime = Time.timeSinceLevelLoad; Links.x.rtsCamera.ToggleSailing(); constPath2 = null; } Links.x.rtsCamera.ignoreRemoveControls = false; Links.x.gameplay.SetDomeSize(); Records.x.RemoveControls(false); Records.x.holdCombat = false; this.startSailCoroutine = null; yield break; } // Token: 0x06000229 RID: 553 RVA: 0x0002EAF4 File Offset: 0x0002CCF4 private bool WaitingForPartyMovement(bool boroMovesToWater) { bool flag = false; int num; if (boroMovesToWater) { num = this.party.Count + 1; } else { num = this.party.Count; } if (this.removeSummonsTime != 0f && Time.timeSinceLevelLoad > this.removeSummonsTime + 0.4f) { this.RemoveSummons(2); this.removeSummonsTime = 0f; } for (int i = 0; i < num; i++) { Character character; if (i < this.party.Count) { character = this.party[i]; } else { character = Links.x.gaia.boro; } if (character) { if (this.states[i] != "Done") { if (this.states[i] == "NeedsNode" && !character.jumping) { this.SetSailingState(character, true); character.tr.position = Vector3.Lerp(character.tr.position, this.standingSpots[i].position, Time.deltaTime * 10f); if (!character.isBoro) { character.tr.rotation = this.standingSpots[i].rotation; character.rot = this.standingSpots[i].rotation; character.smoothRot = this.standingSpots[i].rotation; } character.ignoreRemoveControls = false; character.ignoreNodeIDs = false; character.ClearNodeIDs(); this.states[i] = "Done"; character.PlayAnimation("Idle", Random.Range(0f, 1f)); MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); if (character == Links.x.gaia.boro) { character.body.SetMeshState(false, true); } } else if (character.moving || character.waitingForNewPath) { flag = true; if (this.states[i] == "Repathing" && Time.timeSinceLevelLoad > this.stateTimes[i] + 1f) { this.states[i] = "Moving"; this.stateTimes[i] = Time.timeSinceLevelLoad; } } else if (this.partyNodes[i] != null) { if ((character.tr.position - (Vector3)this.partyNodes[i].position).sqrMagnitude < 9f && (this.states[i] == "Repathing" || this.states[i] == "Moving")) { if (this.partyBoatNodes[i] != null) { if ((i == 4 && Time.timeSinceLevelLoad > this.stateTimes[i] + 0.01f) || i < 4) { character.TargetReached(); character.ClearNodePath(); this.SetSailingState(character, true); character.ignoreRemoveControls = true; character.ignoreNodeIDs = true; character.alwaysJump = true; character.Jump(this.partyBoatNodes[i], this.standingSpots[i].position, false, false); this.states[i] = "Jumping"; this.stateTimes[i] = Time.timeSinceLevelLoad; } flag = true; } else { character.TargetReached(); this.SetSailingState(character, true); character.tr.SetParent(this.tr, true); if (character.circleTr) { character.circleTr.SetParent(this.tr, true); } character.SetPosition(this.standingSpots[i].position, null); character.SetRotation(this.standingSpots[i].rotation, false, false); if (!character.isBoro) { character.tr.rotation = this.standingSpots[i].rotation; character.rot = this.standingSpots[i].rotation; character.smoothRot = this.standingSpots[i].rotation; } character.ClaimNode(null, character.tr.position, false); character.ignoreRemoveControls = false; character.ignoreNodeIDs = false; this.states[i] = "Done"; } } else if (this.states[i] == "Jumping" && (Time.timeSinceLevelLoad > this.stateTimes[i] + 1f || (character.tr.position - this.standingSpots[i].position).sqrMagnitude < 0.0625f || ((character.tr.position - this.standingSpots[i].position).sqrMagnitude < 4f && !character.jumping))) { if (character.tr.parent != this.tr) { this.SetSailingState(character, true); character.tr.SetParent(this.tr, true); character.tr.position = Vector3.Lerp(character.tr.position, this.standingSpots[i].position, Time.deltaTime * 10f); if (character.circleTr) { character.circleTr.SetParent(this.tr, true); } this.states[i] = "NeedsNode"; flag = true; } } else { if ((this.states[i] == "Moving" || this.states[i] == "Repathing") && Time.timeSinceLevelLoad > this.stateTimes[i] + 0.5f) { character.MakePath(this.partyNodes[i], 1000, false, false, true); this.states[i] = "Repathing"; this.stateTimes[i] = Time.timeSinceLevelLoad; } flag = true; } } else { string[] array = new string[5]; int num2 = 0; Character character2 = character; array[num2] = ((character2 != null) ? character2.ToString() : null); array[1] = " not moving node is: "; int num3 = 2; GraphNode graphNode = character.node; array[num3] = ((graphNode != null) ? graphNode.ToString() : null); array[3] = " to : "; int num4 = 4; GraphNode graphNode2 = this.partyNodes[i]; array[num4] = ((graphNode2 != null) ? graphNode2.ToString() : null); Debug.Log(string.Concat(array)); flag = true; } } else if (!character.isBoro && i < this.standingSpots.Length) { character.tr.position = Vector3.Lerp(character.tr.position, this.standingSpots[i].position, Time.deltaTime * 10f); if (!character.inAction) { character.SetRotation(this.standingSpots[i].rotation, false, true); } } } } Links.x.gaia.boro.SetPosition(this.standingSpots[4].position, null); Links.x.gaia.boro.SetRotation(this.standingSpots[4].rotation, false, true); return flag; } // Token: 0x0600022A RID: 554 RVA: 0x0002F214 File Offset: 0x0002D414 public void GetOffBoat() { Debug.Log("Get off boat"); if (this.startSailCoroutine == null) { base.enabled = true; this.startSailCoroutine = this.BoatToLand(); base.StartCoroutine(this.startSailCoroutine); return; } if (Links.x.gaia.pathfindingReady) { Links.x.gameFeed.AddFeed("Busy"); } } // Token: 0x0600022B RID: 555 RVA: 0x0002F279 File Offset: 0x0002D479 private IEnumerator BoatToLand() { this.settingPosition = false; this.leavingBoat = true; Records.x.holdCombat = true; Records.x.RemoveControls(true); if (Records.x.paused) { Links.x.gameplay.TogglePause(false); } if (!this.tr) { this.tr = base.transform; } for (int j = 0; j < this.states.Length; j++) { this.states[j] = ""; } Links.x.rtsCamera.ignoreRemoveControls = true; Links.x.rtsCamera.Follow(Links.x.main.tr, Links.x.main, false); bool foundSpot = false; Character boro = Links.x.gaia.boro; boro.TargetReached(); this.movePoint = Vector3.zero; float radius = 15f; this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = false; this.nodeConstraint.checkCircleID = 0; this.nodeConstraint.passID = 0; this.nodeConstraint.passID2 = 0; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.checkConnections = 0; this.nodeConstraint.constrainToEnvironment = 1; this.nodeConstraint.constrainToArea = -1; GraphNode shoreNode = Links.x.gaia.exteriorGraph.GetNearestForce(this.tr.position, this.nodeConstraint).node; ConstantPath constPath = ConstantPath.ConstructFast(shoreNode, Records.x.GetConstantPathRadius((int)radius), null); this.SetNodeConstraint(null, true); this.nodeConstraint.constrainWalkability = false; this.nodeConstraint.constrainToEnvironment = 1; constPath.nnConstraint = this.nodeConstraint; AstarPath.StartPath(constPath, false); yield return base.StartCoroutine(constPath.WaitForPath()); constPath.Claim(this); this.allNodes = constPath.allNodes; int num = this.allNodes.Count; Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; Vector3 zero3 = Vector3.zero; Vector3 zero4 = Vector3.zero; Vector3 forward = Vector3.forward; Vector3 zero5 = Vector3.zero; Vector3 vector = Vector3.zero; this.SetNodeConstraint(boro, true); this.nodeConstraint.uniqueID = 0; this.nodeConstraint.checkConnections = this.connections; this.nodeConstraint.constrainToEnvironment = 1; this.nodeConstraint.constrainWalkability = true; this.suitableNodes.Clear(); this.moveNodes.Clear(); for (int k = 0; k < num; k++) { GraphNode graphNode = this.allNodes[k]; if (((Vector3)graphNode.position - (Vector3)shoreNode.position).sqrMagnitude < radius * radius && this.nodeConstraint.Suitable(graphNode)) { this.suitableNodes.Add(graphNode); } } num = this.suitableNodes.Count; int num2 = num - 1; Vector3 position = boro.tr.position; Vector3 vector2 = this.tr.rotation.eulerAngles; Quaternion quaternion = Quaternion.Euler(vector2); GraphNode boatTargetNode = null; for (int l = num2; l >= 0; l--) { if (!foundSpot) { GraphNode graphNode = this.suitableNodes[l]; vector = (Vector3)graphNode.position; RaycastHit raycastHit; if (Physics.Raycast(vector + new Vector3(0f, 30f, 0f), Vector3.up * -1f, 60f, 16384) && Physics.Raycast(vector + new Vector3(0f, 30f, 0f), Vector3.up * -1f, out raycastHit, 60f, 4194321) && (raycastHit.collider.gameObject.layer == 3 || raycastHit.collider.gameObject.layer == 0)) { boatTargetNode = graphNode; foundSpot = true; break; } } } if (boatTargetNode == null) { foundSpot = false; Links.x.gameFeed.AddFeed("The shore is blocked"); Links.x.gameFeed.ShowNotice("The shore is blocked"); } else { foundSpot = true; this.partyNodes.Clear(); this.partyBoatNodes.Clear(); boro.ClaimNode(boatTargetNode, (Vector3)boatTargetNode.position, true); for (int m = 0; m < this.party.Count; m++) { num = this.allNodes.Count; Character character = this.party[m]; this.nodeConstraint.constrainToEnvironment = 1; Vector3 position2 = this.standingSpots[m].position; this.SetNodeConstraint(character, true); this.nodeConstraint.uniqueID = 1; this.nodeConstraint.constrainToEnvironment = 1; this.suitableNodes.Clear(); this.bestNodes.Clear(); this.moveNodes.Clear(); for (int n = num - 1; n >= 0; n--) { GraphNode graphNode = this.allNodes[n]; if (this.SubtractVectors((Vector3)graphNode.position, position2).sqrMagnitude < 400f) { this.nodeConstraint.constrainTags = true; if (this.nodeConstraint.Suitable(graphNode)) { this.moveNodes.Add(graphNode); } } } float num3 = float.PositiveInfinity; int num4 = -1; for (int num5 = 0; num5 < this.moveNodes.Count; num5++) { float sqrMagnitude = this.SubtractVectors((Vector3)this.moveNodes[num5].position, position2).sqrMagnitude; if (sqrMagnitude < num3) { num3 = sqrMagnitude; num4 = num5; } } if (num4 > -1) { this.partyNodes.Add(this.moveNodes[num4]); this.moveNodes[num4].SetFlowerConnectionsPlanning(1, 1, 0); } else { Debug.Log("null nodes"); this.partyNodes.Add(null); } } bool flag = true; for (int num6 = 0; num6 < this.party.Count; num6++) { if (this.partyNodes[num6] == null) { flag = false; } } for (int num7 = 0; num7 < this.partyNodes.Count; num7++) { if (this.partyNodes[num7] != null) { this.partyNodes[num7].SetFlowerConnectionsPlanning(1, 0, 0); } } if (!flag) { foundSpot = false; Links.x.gameFeed.AddFeed("The path to shore is blocked"); Links.x.gameFeed.ShowNotice("The path to shore is blocked"); } } constPath.Release(this, false); if (foundSpot) { Links.x.gaia.boro.boatNavigator = false; Records.x.StartUIFade(true, false); int num8; for (int i = 0; i < this.party.Count; i = num8 + 1) { Character character2 = this.party[i]; character2.ignoreRemoveControls = true; character2.ignoreNodeIDs = true; if (this.partyNodes[i] != null) { character2.alwaysJump = true; character2.Jump(this.partyNodes[i], (Vector3)this.partyNodes[i].position, false, false); this.states[i] = "Jumping"; this.stateTimes[i] = Time.timeSinceLevelLoad; character2.NeedToUpdateSailingAnimator(true); MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); } yield return new WaitForSeconds(0.1f); num8 = i; } this.t = 0f; this.startDither = 1f; this.endDither = 0f; while (this.WaitingForPartyMovementOffBoat()) { yield return null; } this.RemoveBoatNode(); MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); boro.tr.SetParent(Links.x.gameplay.transform); boro.tr.SetParent(null); if (boro.circleTr) { boro.circleTr.SetParent(Links.x.gameplay.gameObject.transform, true); } Links.x.gaia.boro.stats.model = Records.x.GetBoroModel(Records.x.boroID, true, false); Links.x.gaia.boro.SetupBody(); boro.SetMeshState(false); boro.body.SetMeshState(false, false); yield return new WaitForSeconds(0.01f); boro.SetMeshState(true); vector2 = Quaternion.LookRotation(boro.tr.position - this.tr.position).eulerAngles; vector2.y += 87f; vector2.x = 0f; vector2.z = 0f; Quaternion quaternion2 = Quaternion.Euler(vector2); this.SetSailingState(boro, false); boro.ToggleBoat(true); boro.SetRotation(quaternion2, false, true); boro.SetPosition((Vector3)boatTargetNode.position, boatTargetNode); boro.FirstPosition(null); boro.ignoreRemoveControls = false; boro.ignoreNodeIDs = false; this.rbody.isKinematic = true; if (this.useBuoyancy) { this.bouyancy.enabled = false; } if (boro.circleTr) { boro.circleTr.gameObject.SetActive(true); } Records.x.boroLastBeachPoint = boro.tr.position; this.ReturnOarSplashes(); this.sailors.Clear(); this.sailing = false; this.ReturnSplashes(); Records.x.StartUIFade(false, false); boro.body.SetMeshState(true, false); this.SetSailingState(boro, false); for (int num9 = 0; num9 < this.party.Count; num9++) { this.party[num9].sailing = false; this.party[num9].NeedToUpdateSailingAnimator(true); } Records.x.partySailing = false; Links.x.partyColliderAdventure.beachCollector.SwitchBeachCollider(); Links.x.rtsCamera.ToggleSailing(); this.ReturnSummons(this.partyNodes[0]); } Links.x.rtsCamera.ignoreRemoveControls = false; Records.x.holdCombat = false; Records.x.RemoveControls(false); this.startSailCoroutine = null; Links.x.gameplay.SetDomeSize(); if (foundSpot) { base.gameObject.SetActive(false); } this.leavingBoat = false; yield break; } // Token: 0x0600022C RID: 556 RVA: 0x0002F288 File Offset: 0x0002D488 private bool WaitingForPartyMovementOffBoat() { bool flag = false; for (int i = 0; i < this.party.Count; i++) { Character character = this.party[i]; if (character && this.states[i] != "Done") { if (this.states[i] == "NeedsNode" && !character.jumping) { character.tr.SetParent(Links.x.gameplay.transform); character.tr.SetParent(null); if (character.circleTr) { character.circleTr.SetParent(Links.x.gameplay.gameObject.transform, true); } this.SetSailingState(character, false); character.ignoreRemoveControls = false; character.ignoreNodeIDs = false; this.states[i] = "Done"; } else if (character.moving || character.waitingForNewPath) { flag = true; if (this.states[i] == "Repathing" && Time.timeSinceLevelLoad > this.stateTimes[i] + 1f) { this.states[i] = "Jumping"; this.stateTimes[i] = Time.timeSinceLevelLoad; } } else if (character.node != null && this.partyNodes[i] != null) { if (((Vector3)character.node.position - (Vector3)this.partyNodes[i].position).sqrMagnitude < 4f && (this.states[i] == "Repathing" || this.states[i] == "Jumping")) { if (character.tr.parent == this.tr) { this.states[i] = "NeedsNode"; flag = true; } } else { if ((this.states[i] == "Jumping" || this.states[i] == "Repathing") && Time.timeSinceLevelLoad > this.stateTimes[i] + 1f) { this.SetSailingState(character, false); character.alwaysJump = true; character.Jump(this.partyNodes[i], (Vector3)this.partyNodes[i].position, false, false); this.states[i] = "Repathing"; this.stateTimes[i] = Time.timeSinceLevelLoad; } flag = true; } } else { flag = true; } } } return flag; } // Token: 0x0600022D RID: 557 RVA: 0x0002F520 File Offset: 0x0002D720 public void ChangeScenes(Vector3 exitPoint) { this.tr.position = exitPoint; this.ResetNode(); if (this.node != null) { this.tr.position = (Vector3)this.node.position; exitPoint = (Vector3)this.node.position; } this.settingPosition = true; base.StartCoroutine(this.SetPosition(exitPoint)); } // Token: 0x0600022E RID: 558 RVA: 0x0002F589 File Offset: 0x0002D789 private IEnumerator SetPosition(Vector3 pt) { this.rbody.isKinematic = true; float timeToLerp = 0.25f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f && this.settingPosition) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = pt; this.boatFollow.position = this.tr.position; yield return null; } this.rbody.isKinematic = false; this.settingPosition = false; yield break; } // Token: 0x0600022F RID: 559 RVA: 0x0002F5A0 File Offset: 0x0002D7A0 public void PartySetupFromLoad() { this.party = Links.x.portraitOrder; this.boat.SetActive(true); this.animator.Play(this.animationOpenName, 0, 1f); base.StartCoroutine(this.ParytSetupFromLoadFinish()); this.noiseUpdateTime = Time.timeSinceLevelLoad; } // Token: 0x06000230 RID: 560 RVA: 0x0002F5F8 File Offset: 0x0002D7F8 private IEnumerator ParytSetupFromLoadFinish() { this.settingPosition = false; yield return new WaitForSeconds(0.05f); while (!Links.x.gaia.boro) { yield return null; } for (int i = 0; i < this.party.Count + 1; i++) { Character character; if (i == 4) { character = Links.x.gaia.boro; } else { if (this.party[i]) { this.sailors.Add(this.party[i]); this.AddOarSplash(); } character = this.party[i]; } if (character) { this.SetSailingState(character, true); character.SetPosition(this.standingSpots[i].position, null); character.tr.rotation = this.standingSpots[i].rotation; character.rot = this.standingSpots[i].rotation; character.smoothRot = this.standingSpots[i].rotation; character.ClaimNode(null, character.tr.position, false); character.tr.SetParent(this.tr, true); if (character.circleTr) { character.circleTr.SetParent(this.tr, true); } character.ClearNodeIDs(); } } Links.x.gaia.boro.SetMeshState(true); this.sailing = true; float timeToLerp = 0.25f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = Records.x.boatPosition; this.tr.rotation = this.rot; this.boatFollow.position = this.tr.position; yield return null; } this.boat.SetActive(true); this.rbody.isKinematic = false; this.rbody.useGravity = true; timeToLerp = 0.5f; percentage = 0f; startTime = Time.time; while (percentage < 0.25f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = Records.x.boatPosition; this.tr.rotation = this.rot; this.boatFollow.position = this.tr.position; yield return null; } this.rbody.isKinematic = false; if (this.useBuoyancy) { this.bouyancy.enabled = true; } Records.x.partySailing = true; Links.x.partyColliderAdventure.beachCollector.SwitchBeachCollider(); Links.x.rtsCamera.ToggleSailing(); this.AddSplashes(); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = this.connections; this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = true; this.nodeConstraint.checkCircleID = 0; this.nodeStationaryID = Records.x.currentPathNode; this.nodeMovingID = this.nodeStationaryID + 100; this.nodeConstraint.passID = this.nodeStationaryID; this.nodeConstraint.passID2 = this.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; this.node = Links.x.gaia.exteriorGraph.GetNearestForce(this.tr.position, this.nodeConstraint).node; this.lastNode = this.node; this.SetNodeID(false, false); Links.x.gaia.boro.boatNavigator = true; this.navigator = Links.x.gaia.boro; Links.x.gaia.boro.boat = this; if (Links.x.gaia.boro.circleTr) { Links.x.gaia.boro.circleTr.gameObject.SetActive(false); } Links.x.gaia.boro.ToggleBoat(false); this.rot = this.tr.rotation; this.smoothRot = this.rot; this.setup = true; this.rbody.useGravity = true; Links.x.beachCollider.SetActive(true); this.ChangeTimeOfDay(); Links.x.gameplay.SetDomeSize(); yield break; } // Token: 0x06000231 RID: 561 RVA: 0x0002F608 File Offset: 0x0002D808 public void RemoveBoat() { if (this) { this.sailing = false; this.turning = false; this.rotating = false; this.navigator = null; this.ReturnOarSplashes(); this.sailors.Clear(); this.movePoint = Vector3.zero; this.ReturnSplashes(); if (base.gameObject) { base.gameObject.SetActive(false); Links.x.archives.RecycleBoat(base.gameObject, this.model, ""); } } } // Token: 0x06000232 RID: 562 RVA: 0x0002F694 File Offset: 0x0002D894 public void ClearPartyBoat() { this.rbody.isKinematic = true; this.sailing = false; this.turning = false; this.rotating = false; this.navigator = null; this.ReturnOarSplashes(); this.sailors.Clear(); this.movePoint = Vector3.zero; this.ReturnSplashes(); this.setup = false; base.gameObject.SetActive(false); } // Token: 0x06000233 RID: 563 RVA: 0x0002F6FE File Offset: 0x0002D8FE public void ClearBoatForRespawn() { this.sailing = false; this.turning = false; this.rotating = false; this.navigator = null; this.ReturnOarSplashes(); this.sailors.Clear(); this.movePoint = Vector3.zero; this.ReturnSplashes(); } // Token: 0x06000234 RID: 564 RVA: 0x0002F73E File Offset: 0x0002D93E public void NPCSetupFromLoad(Vector3 pt, Quaternion r) { this.ClearBoatForRespawn(); Links.x.ChangeBoatList(this, true); this.boat.SetActive(true); base.StartCoroutine(this.NPCSetupFromLoadFinish(pt, r)); } // Token: 0x06000235 RID: 565 RVA: 0x0002F76D File Offset: 0x0002D96D private IEnumerator NPCSetupFromLoadFinish(Vector3 pt, Quaternion r) { yield return new WaitForSeconds(0.05f); this.settingPosition = false; this.sailing = true; float timeToLerp = 0.25f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = pt; this.tr.rotation = r; yield return null; } this.boat.SetActive(true); this.rbody.isKinematic = false; this.rbody.useGravity = true; timeToLerp = 0.5f; percentage = 0f; startTime = Time.time; while (percentage < 0.25f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = pt; this.tr.rotation = r; yield return null; } this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = this.connections; this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = true; this.nodeStationaryID = Records.x.currentPathNode; this.nodeMovingID = this.nodeStationaryID + 100; this.nodeConstraint.passID = this.nodeStationaryID; this.nodeConstraint.passID2 = this.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; this.node = Links.x.gaia.exteriorGraph.GetNearestForce(this.tr.position, this.nodeConstraint).node; this.lastNode = this.node; this.SetNodeID(false, false); this.noiseUpdateTime = Time.timeSinceLevelLoad; this.ChangeTimeOfDay(); this.AddSplashes(); this.rot = this.tr.rotation; this.smoothRot = this.rot; this.rbody.useGravity = true; for (int i = 0; i < this.sailors.Count; i++) { this.sailors[i].NeedToUpdateSailingAnimator(true); } yield break; } // Token: 0x06000236 RID: 566 RVA: 0x0002F78A File Offset: 0x0002D98A public void TimeJump(Vector3 pt, Quaternion r) { base.StartCoroutine(this.TimeJumpWait(pt, r)); } // Token: 0x06000237 RID: 567 RVA: 0x0002F79B File Offset: 0x0002D99B private IEnumerator TimeJumpWait(Vector3 pt, Quaternion r) { this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = this.connections; this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = true; this.nodeStationaryID = Records.x.currentPathNode; this.nodeMovingID = this.nodeStationaryID + 100; this.nodeConstraint.passID = this.nodeStationaryID; this.nodeConstraint.passID2 = this.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; GraphNode graphNode = Links.x.gaia.exteriorGraph.GetNearestForce(pt, this.nodeConstraint).node; if (graphNode != null) { this.node = graphNode; this.lastNode = this.node; pt = (Vector3)graphNode.position; float timeToLerp = 0.25f; float percentage = 0f; float startTime = Time.time; while (percentage < 1f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = pt; this.tr.rotation = r; yield return null; } timeToLerp = 0.5f; percentage = 0f; startTime = Time.time; while (percentage < 0.25f) { percentage = (Time.time - startTime) / timeToLerp; this.tr.position = pt; this.tr.rotation = r; yield return null; } this.SetNodeID(false, false); this.ChangeTimeOfDay(); this.rot = this.tr.rotation; this.smoothRot = this.rot; this.rbody.useGravity = true; } yield break; } // Token: 0x06000238 RID: 568 RVA: 0x0002F7B8 File Offset: 0x0002D9B8 public void AddSailor(Character sailor, int i) { if (!this.navigator) { this.SetBoatNavigator(sailor, true); } this.sailors.Add(sailor); this.AddOarSplash(); if (sailor) { this.SetSailingState(sailor, true); sailor.SetPosition(this.standingSpots[i].position, null); sailor.tr.rotation = this.standingSpots[i].rotation; sailor.rot = this.standingSpots[i].rotation; sailor.smoothRot = this.standingSpots[i].rotation; sailor.ClaimNode(null, sailor.tr.position, false); sailor.tr.SetParent(this.tr, true); if (sailor.circleTr) { sailor.circleTr.SetParent(this.tr, true); } sailor.ClearNodeIDs(); sailor.NeedToUpdateSailingAnimator(true); } } // Token: 0x06000239 RID: 569 RVA: 0x0002F8A4 File Offset: 0x0002DAA4 public void SetBoatNavigator(Character sailor, bool fromLoad) { if (sailor) { this.sailing = true; sailor.boatNavigator = true; this.navigator = sailor; sailor.boat = this; return; } bool flag = false; this.navigator = null; for (int i = 0; i < this.sailors.Count; i++) { if (this.sailors[i] && !flag && !this.sailors[i].dead && !this.sailors[i].stunned) { this.sailors[i].boatNavigator = true; this.navigator = this.sailors[i]; this.sailors[i].boat = this; if (!fromLoad) { MasterAudio.PlaySound3DAtVector3AndForget("Splash", this.tr.position, Random.Range(0.8f, 1f), new float?(Random.Range(0.95f, 1f)), 0f, "", null); } flag = true; } } if (!flag) { for (int j = 0; j < this.sailors.Count; j++) { if (this.sailors[j] && !flag && !this.sailors[j].dead) { this.sailors[j].boatNavigator = true; this.navigator = this.sailors[j]; this.sailors[j].boat = this; flag = true; } } } this.sailing = flag; if (!flag) { this.rotating = false; this.turning = false; if (!fromLoad) { this.AllDead(); } } } // Token: 0x0600023A RID: 570 RVA: 0x0002FA68 File Offset: 0x0002DC68 public bool IsSailorLeft(Character sailor) { if (sailor.party) { int num = this.party.IndexOf(sailor); if (num > -1 && num < this.rowLeft.Length) { return this.rowLeft[num]; } } else if (sailor.npc) { int num2 = this.sailors.IndexOf(sailor); if (num2 > -1 && num2 < this.rowLeft.Length) { return this.rowLeft[num2]; } } return false; } // Token: 0x0600023B RID: 571 RVA: 0x0002FAD0 File Offset: 0x0002DCD0 public void PlayOarSplash(Character sailor) { int num = -1; if (sailor.party) { num = this.party.IndexOf(sailor); } else if (sailor.npc) { num = this.sailors.IndexOf(sailor); } if (num > -1 && num < this.oarSplashes.Count) { GameObject gameObject = this.oarSplashes[num]; Vector3 position = sailor.oar.transform.position; position.y = Links.x.diorama.waterY + 0.6f; gameObject.transform.position = position; gameObject.SetActive(true); foreach (ParticleSystem particleSystem in gameObject.GetComponentsInChildren(true)) { particleSystem.Clear(); particleSystem.Play(); } } } // Token: 0x0600023C RID: 572 RVA: 0x0002FB8C File Offset: 0x0002DD8C private void ReturnOarSplashes() { for (int i = 0; i < this.oarSplashes.Count; i++) { if (this.oarSplashes[i]) { Links.x.cellar.ReturnPooledGameObject(140, this.oarSplashes[i]); } } this.oarSplashes.Clear(); } // Token: 0x0600023D RID: 573 RVA: 0x0002FBF0 File Offset: 0x0002DDF0 private void AddOarSplash() { GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(140); pooledGameObject.SetActive(false); pooledGameObject.transform.parent = this.tr; pooledGameObject.transform.parent = null; this.oarSplashes.Add(pooledGameObject); } // Token: 0x0600023E RID: 574 RVA: 0x0002FC44 File Offset: 0x0002DE44 private void AddSplashes() { if (!this.splashBack) { GameObject pooledGameObject = Links.x.cellar.GetPooledGameObject(138); pooledGameObject.SetActive(false); pooledGameObject.transform.parent = this.tr; pooledGameObject.transform.parent = null; this.splashBack = pooledGameObject; foreach (object obj in pooledGameObject.transform) { ParticleSystem component = ((Transform)obj).gameObject.GetComponent(); if (component) { this.splashParticles.Add(component); } } } if (!this.splashFront) { GameObject pooledGameObject2 = Links.x.cellar.GetPooledGameObject(139); pooledGameObject2.SetActive(false); pooledGameObject2.transform.parent = this.tr; pooledGameObject2.transform.parent = null; this.splashFront = pooledGameObject2; foreach (object obj2 in pooledGameObject2.transform) { ParticleSystem component2 = ((Transform)obj2).gameObject.GetComponent(); if (component2) { this.splashParticles.Add(component2); } } } } // Token: 0x0600023F RID: 575 RVA: 0x0002FDBC File Offset: 0x0002DFBC private void ReturnSplashes() { this.splashParticles.Clear(); if (this.splashBack) { Links.x.cellar.ReturnPooledGameObject(138, this.splashBack); this.splashBack = null; } if (this.splashFront) { Links.x.cellar.ReturnPooledGameObject(139, this.splashFront); this.splashFront = null; } } // Token: 0x06000240 RID: 576 RVA: 0x0002FE30 File Offset: 0x0002E030 public void OpenBag() { Links.x.characterSheet.merchant = true; Links.x.characterSheet.blacksmith = false; Links.x.characterSheet.pagan = false; Links.x.merchant.isBoat = true; Links.x.merchant.boat = this; Links.x.merchant.merchantCharacter = null; Links.x.merchant.creature = this.leadCreature; Links.x.characterSheet.peddler = this.model; Links.x.merchant.SetUpItems(); Links.x.characterSheet.boat = this; Links.x.characterSheet.StartMenu(false); } // Token: 0x06000241 RID: 577 RVA: 0x0002FEF8 File Offset: 0x0002E0F8 public void AllDead() { this.RemoveBoatNode(); if (!base.gameObject.GetComponent()) { base.gameObject.AddComponent().boat = this; } this.ReturnSplashes(); this.ReturnOarSplashes(); base.gameObject.layer = 19; } // Token: 0x06000242 RID: 578 RVA: 0x0002FF48 File Offset: 0x0002E148 public void NewNPC() { if (base.gameObject.layer == 19) { for (int i = 0; i < this.sailors.Count; i++) { if (this.sailors[i] && this.sailors[i].body) { this.sailors[i].body.EndDead(2); } } this.sailors.Clear(); this.ClearBoatForRespawn(); Links.x.ChangeBoatList(this, true); this.boat.SetActive(true); this.sailing = true; this.boat.SetActive(true); this.rbody.isKinematic = false; this.rbody.useGravity = true; this.RemoveBoatNode(); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.checkConnections = this.connections; this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = true; this.nodeStationaryID = Records.x.currentPathNode; this.nodeMovingID = this.nodeStationaryID + 100; this.nodeConstraint.passID = this.nodeStationaryID; this.nodeConstraint.passID2 = this.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainToArea = -1; this.node = Links.x.gaia.exteriorGraph.GetNearestForce(this.tr.position, this.nodeConstraint).node; this.lastNode = this.node; this.SetNodeID(false, false); this.noiseUpdateTime = Time.timeSinceLevelLoad; this.AddSplashes(); this.rot = this.tr.rotation; this.smoothRot = this.rot; this.rbody.useGravity = true; base.gameObject.layer = 18; } } // Token: 0x06000243 RID: 579 RVA: 0x0003013E File Offset: 0x0002E33E public void EndStunNPC() { } // Token: 0x06000244 RID: 580 RVA: 0x00030140 File Offset: 0x0002E340 public void AddSounds() { for (int i = 0; i < this.sailors.Count; i++) { if (this.sailors[i] && this.sailors[i].IsSentient()) { Links.x.sensory.AddFootstep(this.sailors[i]); } } } // Token: 0x06000245 RID: 581 RVA: 0x000301A4 File Offset: 0x0002E3A4 public void RemoveSummons(int pass) { this.allParty = Links.x.party; for (int i = 0; i < this.allParty.Count; i++) { Character character = this.allParty[i]; if (character && character.summoned && !character.pipeSummons) { if (pass == 1) { character.meshAlwaysOff = true; character.SetMeshState(false); character.TargetReached(); } else if (pass == 2) { character.RemoveLastNode(true); character.TurnScriptsOff(); } } } } // Token: 0x06000246 RID: 582 RVA: 0x00030228 File Offset: 0x0002E428 public void ReturnSummons(GraphNode n) { this.allParty = Links.x.party; for (int i = 0; i < this.allParty.Count; i++) { Character character = this.allParty[i]; if (character && character.summoned && !character.dead && !character.pipeSummons) { GraphNode formationPosition = Links.x.fellowship.GetFormationPosition(n, character, false); if (formationPosition != null) { character.tr.position = (Vector3)formationPosition.position; character.FirstPosition(formationPosition); } else { float num = (float)i - 3f; num /= 2f; if (num > 3f) { num = 3f; } if (Random.Range(0, 2) == 0) { num *= -1f; } float num2 = num; if (Random.Range(0, 2) == 0) { num2 *= -1f; } character.tr.position = Links.x.main.tr.position + new Vector3(num, 0f, num); character.FirstPosition(null); } character.meshAlwaysOff = false; character.SetMeshState(true); character.TurnScriptsOn(); } } } // Token: 0x06000247 RID: 583 RVA: 0x00030360 File Offset: 0x0002E560 public void SetSailingState(Character character, bool state) { character.sailing = state; character.body.SetMagicaClothMode(); character.NeedToUpdateSailingAnimator(true); character.stats.UpdateAbilityTriggers(); } // Token: 0x06000248 RID: 584 RVA: 0x00030388 File Offset: 0x0002E588 public void EndCombat() { for (int i = 0; i < this.sailors.Count; i++) { if (this.sailors[i] && this.sailors[i].hasActions) { this.sailors[i].actions.EndActions(); } } this.ResetNode(); } // Token: 0x06000249 RID: 585 RVA: 0x000303ED File Offset: 0x0002E5ED public void ResetNode() { this.RemoveBoatNode(); this.ClaimNode(null, Vector3.zero, false); } // Token: 0x0600024A RID: 586 RVA: 0x00030404 File Offset: 0x0002E604 public void ChangeTimeOfDay() { if (this.navigator || this.partyBoat) { if (!Links.x.gameplay.IsDay()) { for (int i = 0; i < this.nightObjects.Length; i++) { if (!this.nightObjects[i].activeSelf) { this.nightObjects[i].SetActive(true); } } for (int j = 0; j < this.dayObjects.Length; j++) { if (this.dayObjects[j].activeSelf) { this.dayObjects[j].SetActive(false); } } return; } for (int k = 0; k < this.nightObjects.Length; k++) { if (this.nightObjects[k].activeSelf) { this.nightObjects[k].SetActive(false); } } for (int l = 0; l < this.dayObjects.Length; l++) { if (!this.dayObjects[l].activeSelf) { this.dayObjects[l].SetActive(true); } } } } // Token: 0x0600024B RID: 587 RVA: 0x000304FC File Offset: 0x0002E6FC public void ZeroPreviousNode() { this.CheckForNodeID(); if (this.lastNode != null && this.lastNode != this.node) { this.lastNode.SetFlowerConnections(0, this.nodeMovingID, this.connections); this.lastNode.SetFlowerConnections(0, this.nodeStationaryID, this.connections); } this.lastNode = null; } // Token: 0x0600024C RID: 588 RVA: 0x0003055C File Offset: 0x0002E75C public void RemoveBoatNode() { this.CheckForNodeID(); this.ZeroPreviousNode(); this.lastNode = null; if (this.node != null) { this.node.SetFlowerConnections(0, this.nodeMovingID, this.connections); this.node.SetFlowerConnections(0, this.nodeStationaryID, this.connections); } this.node = null; } // Token: 0x0600024D RID: 589 RVA: 0x000305BC File Offset: 0x0002E7BC public void CheckInTile() { if (!Links.x.gaia.sceneLoaded) { return; } this.CheckForNodeID(); if (this.node != null) { float sqrMagnitude = ((Vector3)this.node.position - this.tr.position).sqrMagnitude; GraphNode graphNode = this.node; float num = Records.x.nodeSize * Records.x.nodeSize; if (this.navigator && sqrMagnitude > num && !this.navigator.moving && this.navigator.NodesCount() == 0 && this.navigator.blockedTime == 0f && !this.navigator.waitingForNewPath) { GraphNode graphNode2 = this.NearNode(this.tr.position, true, 0, -1); if (graphNode2 != null) { this.ClaimNode(graphNode2, (Vector3)graphNode2.position, false); } } } } // Token: 0x0600024E RID: 590 RVA: 0x000306A8 File Offset: 0x0002E8A8 public void ClaimNode(GraphNode curr, Vector3 pos, bool snap) { if (Links.x.gaia.noAstar) { Debug.Log("no astar"); return; } this.CheckForNodeID(); if (curr == null && pos != Vector3.zero) { GraphNode graphNode = this.NearNode(pos, true, 0, -1); if (graphNode != null) { if (this.node != graphNode) { } this.node = graphNode; pos = (Vector3)graphNode.position; } else { this.RemoveBoatNode(); this.node = null; } } if (curr == null && pos == Vector3.zero) { if (this.tr.position != Vector3.zero) { this.node = this.NearNode(this.tr.position, true, 0, -1); if (this.node != null) { pos = (Vector3)this.node.position; } } else { this.RemoveBoatNode(); this.node = null; } } if (curr != null) { if (this.node != curr) { } this.node = curr; } this.ZeroPreviousNode(); if (this.node != null) { if (this.sailing) { if (!this.navigator) { this.SetNodeID(false, false); } else { this.SetNodeID(false, this.navigator.moving); } } else { this.SetNodeID(false, false); } this.lastNode = this.node; return; } this.lastNode = null; } // Token: 0x0600024F RID: 591 RVA: 0x00030808 File Offset: 0x0002EA08 public GraphNode NearNode(Vector3 pos, bool checkEmpty, int uniqueID, int graphIndex) { this.CheckForNodeID(); if (Links.x.gaia.noAstar) { return null; } this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainTags = checkEmpty; this.nodeConstraint.checkCircleID = 0; this.nodeConstraint.passID = this.nodeStationaryID; this.nodeConstraint.passID2 = this.nodeMovingID; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.checkConnections = this.ConnectionNumber(); this.nodeConstraint.constrainToEnvironment = 2; this.nodeConstraint.constrainToArea = -1; return Links.x.gaia.exteriorGraph.GetNearestForce(pos, this.nodeConstraint).node; } // Token: 0x06000250 RID: 592 RVA: 0x000308D5 File Offset: 0x0002EAD5 public void CheckForNodeID() { if (this.nodeMovingID == 0) { this.nodeStationaryID = Records.x.currentPathNode; this.nodeMovingID = this.nodeStationaryID + 100; } } // Token: 0x06000251 RID: 593 RVA: 0x00030900 File Offset: 0x0002EB00 public void SetNodeID(bool overrideDefaults, bool moving) { this.CheckForNodeID(); int num = this.nodeMovingID; if (!moving) { num = this.nodeStationaryID; } if (overrideDefaults) { if (moving) { num = this.nodeMovingID; } else { num = this.nodeStationaryID; } } if (this.node != null) { if (num == this.nodeStationaryID) { this.node.SetFlowerConnections(num, this.nodeMovingID, this.connections); return; } this.node.SetFlowerConnections(num, this.nodeStationaryID, this.connections); } } // Token: 0x06000252 RID: 594 RVA: 0x0003097C File Offset: 0x0002EB7C public void SetNodeConstraint(Character pathfinder, bool constrainTags) { this.nodeConstraint.constrainWalkability = true; this.nodeConstraint.walkable = true; this.nodeConstraint.constrainPenalty = 0; this.nodeConstraint.constrainTags = constrainTags; if (!pathfinder) { this.nodeConstraint.passID = 0; this.nodeConstraint.passID2 = 0; this.nodeConstraint.checkConnections = 0; this.nodeConstraint.constrainPenalty = 0; } else { this.nodeConstraint.passID = pathfinder.nodeStationaryID; this.nodeConstraint.passID2 = pathfinder.nodeMovingID; this.nodeConstraint.checkConnections = pathfinder.ConnectionNumber(); this.nodeConstraint.constrainPenalty = 2; } this.nodeConstraint.constrainToArea = -1; } // Token: 0x06000253 RID: 595 RVA: 0x00030A3E File Offset: 0x0002EC3E public int ConnectionNumber() { return this.connections; } // Token: 0x06000254 RID: 596 RVA: 0x00030A48 File Offset: 0x0002EC48 public Vector3 SubtractVectors(Vector3 a, Vector3 b) { Vector3 vector; vector.x = a.x - b.x; vector.y = a.y - b.y; vector.z = a.z - b.z; return vector; } // Token: 0x06000255 RID: 597 RVA: 0x00030A94 File Offset: 0x0002EC94 public float AngleDir(Vector3 fwd, Vector3 targetDir, Vector3 up) { float num = Vector3.Dot(Vector3.Cross(fwd, targetDir), up); if (num > 0f) { return 1f; } if (num <= 0f) { return -1f; } return 1f; } // Token: 0x040003E5 RID: 997 [Header("Set up")] public Transform[] standingSpots = new Transform[0]; // Token: 0x040003E6 RID: 998 public string[] states = new string[0]; // Token: 0x040003E7 RID: 999 public float[] stateTimes = new float[0]; // Token: 0x040003E8 RID: 1000 public Renderer[] renderers = new Renderer[0]; // Token: 0x040003E9 RID: 1001 public bool[] rowLeft = new bool[0]; // Token: 0x040003EA RID: 1002 public string animationOpenName = "Boat_open"; // Token: 0x040003EB RID: 1003 public int connections = 8; // Token: 0x040003EC RID: 1004 public float speed = 1000f; // Token: 0x040003ED RID: 1005 public float turnSpeed = 6f; // Token: 0x040003EE RID: 1006 public bool partyBoat; // Token: 0x040003EF RID: 1007 public bool useBuoyancy; // Token: 0x040003F0 RID: 1008 public float waveMultiplier; // Token: 0x040003F1 RID: 1009 [Header("Time of Day")] public GameObject[] nightObjects = new GameObject[0]; // Token: 0x040003F2 RID: 1010 public GameObject[] dayObjects = new GameObject[0]; // Token: 0x040003F3 RID: 1011 [Header("Sailing")] public bool sailing; // Token: 0x040003F4 RID: 1012 public Character navigator; // Token: 0x040003F5 RID: 1013 public CreatureActions leadCreature; // Token: 0x040003F6 RID: 1014 public List sailors = new List(); // Token: 0x040003F7 RID: 1015 public Rigidbody rbody; // Token: 0x040003F8 RID: 1016 public RamBuoyancy bouyancy; // Token: 0x040003F9 RID: 1017 public GraphNode node; // Token: 0x040003FA RID: 1018 public GraphNode lastNode; // Token: 0x040003FB RID: 1019 public int nodeMovingID; // Token: 0x040003FC RID: 1020 public int nodeStationaryID; // Token: 0x040003FD RID: 1021 private float updateTime; // Token: 0x040003FE RID: 1022 private float moveDistance; // Token: 0x040003FF RID: 1023 public Vector3 movePoint; // Token: 0x04000400 RID: 1024 public bool closeToPoint; // Token: 0x04000401 RID: 1025 private Quaternion look; // Token: 0x04000402 RID: 1026 private Quaternion savedRot; // Token: 0x04000403 RID: 1027 private Quaternion rot; // Token: 0x04000404 RID: 1028 private Quaternion smoothRot; // Token: 0x04000405 RID: 1029 private Quaternion intervalRot; // Token: 0x04000406 RID: 1030 private Quaternion startRot; // Token: 0x04000407 RID: 1031 private float prevDist; // Token: 0x04000408 RID: 1032 private float intervalY; // Token: 0x04000409 RID: 1033 private float startRotY; // Token: 0x0400040A RID: 1034 private float rotationTime; // Token: 0x0400040B RID: 1035 private float noiseUpdateTime; // Token: 0x0400040C RID: 1036 private float angleRemaining; // Token: 0x0400040D RID: 1037 private float intervalAngleRemaining; // Token: 0x0400040E RID: 1038 public bool turning; // Token: 0x0400040F RID: 1039 public bool rotating; // Token: 0x04000410 RID: 1040 private GraphNode savedTargetNode; // Token: 0x04000411 RID: 1041 public Transform boatFollow; // Token: 0x04000412 RID: 1042 public GameObject boat; // Token: 0x04000413 RID: 1043 public bool setup; // Token: 0x04000414 RID: 1044 public Transform tr; // Token: 0x04000415 RID: 1045 public Transform moveFollow; // Token: 0x04000416 RID: 1046 private Material[] mats; // Token: 0x04000417 RID: 1047 public string model; // Token: 0x04000418 RID: 1048 private int updateTimeCount; // Token: 0x04000419 RID: 1049 public bool canExit; // Token: 0x0400041A RID: 1050 public bool leavingBoat; // Token: 0x0400041B RID: 1051 private Vector3 originalScale; // Token: 0x0400041C RID: 1052 private bool moving; // Token: 0x0400041D RID: 1053 private bool mainTurning; // Token: 0x0400041E RID: 1054 private bool physicsMove; // Token: 0x0400041F RID: 1055 private Vector3 savedAngularVelocity; // Token: 0x04000420 RID: 1056 private Vector3 savedVelocity; // Token: 0x04000421 RID: 1057 private bool pocket; // Token: 0x04000422 RID: 1058 private bool previouslyMoving; // Token: 0x04000423 RID: 1059 private float previouslyMovingStartTime; // Token: 0x04000424 RID: 1060 private float timeSincePath; // Token: 0x04000425 RID: 1061 private Quaternion targetRotation; // Token: 0x04000426 RID: 1062 private Quaternion startCapsizedRot; // Token: 0x04000427 RID: 1063 private bool isCapsized; // Token: 0x04000428 RID: 1064 private bool turningLeft; // Token: 0x04000429 RID: 1065 private bool settingPosition; // Token: 0x0400042A RID: 1066 public GameObject splashBack; // Token: 0x0400042B RID: 1067 public GameObject splashFront; // Token: 0x0400042C RID: 1068 private List splashParticles = new List(); // Token: 0x0400042D RID: 1069 public List oarSplashes = new List(); // Token: 0x0400042E RID: 1070 [Header("Animation")] public Animator animator; // Token: 0x0400042F RID: 1071 public Vector3 boatOpenJumpPosition; // Token: 0x04000430 RID: 1072 public bool inMenu; // Token: 0x04000431 RID: 1073 private float waveValue; // Token: 0x04000432 RID: 1074 private float t1; // Token: 0x04000433 RID: 1075 private float startValue1; // Token: 0x04000434 RID: 1076 private float targetValue1; // Token: 0x04000435 RID: 1077 [Header("Boro")] public Transform sheepSpot; // Token: 0x04000436 RID: 1078 private float t; // Token: 0x04000437 RID: 1079 private float startDither; // Token: 0x04000438 RID: 1080 private float endDither; // Token: 0x04000439 RID: 1081 private float removeSummonsTime; // Token: 0x0400043A RID: 1082 private IEnumerator startSailCoroutine; // Token: 0x0400043B RID: 1083 private List party; // Token: 0x0400043C RID: 1084 private List allParty; // Token: 0x0400043D RID: 1085 private NNConstraint nodeConstraint = new NNConstraint(); // Token: 0x0400043E RID: 1086 private List allNodes; // Token: 0x0400043F RID: 1087 private List suitableNodes = new List(); // Token: 0x04000440 RID: 1088 private List moveNodes = new List(); // Token: 0x04000441 RID: 1089 private List bestNodes = new List(); // Token: 0x04000442 RID: 1090 private List partyNodes = new List(); // Token: 0x04000443 RID: 1091 private List partyBoatNodes = new List(); }