private void OnDisable() { this.StopEvent(); if (!this.netPrefab) { if (this.mainCollider) { this.mainCollider.enabled = false; } if (this.sawCollider) { this.sawCollider.enabled = false; } LocalPlayer.Inventory.CancelReloadDelay(); if (Scene.HudGui) { if (Scene.HudGui.FuelReserve.gameObject.activeSelf) { Scene.HudGui.FuelReserve.gameObject.SetActive(false); } if (Scene.HudGui.FuelReserveEmpty.activeSelf) { Scene.HudGui.FuelReserveEmpty.SetActive(false); } } Mood.StopConstantVibratation(); } }
private void OnDisable() { this.StopEvent(); if (!this.netPrefab) { if (this.mainCollider) { this.mainCollider.enabled = false; } if (this.sawCollider) { this.sawCollider.enabled = false; } LocalPlayer.Inventory.CancelReloadDelay(); if (!this.netPrefab) { Mood.StopConstantVibratation(); } } }
private void OnDisable() { this.StopPowerOnEvent(); this.StopPowerOffEvent(); this.StopPoweredUpEvent(); this.artifactAnimator.SetBool("pickup", false); if (this.effigyEffectGo) { this.effigyEffectGo.SetActive(false); } this.doingSetArtifact = false; base.StopAllCoroutines(); if (!this.remote) { if (Scene.HudGui) { Scene.HudGui.PlaceArtifactButton.SetActive(false); } this.playerAnimator.SetBool("firstTimePickup", false); Mood.StopConstantVibratation(); } }
private void OnEnable() { if (!this.iconSetup && Scene.HudGui) { this.iconSetup = Scene.HudGui.PlaceArtifactButton.GetComponent <artifactIconSetup>(); } if (!this.effectSetup) { this.effectSetup = base.transform.GetComponent <artifactBallEffectSetup>(); } if (!this.artifactAnimator) { this.artifactAnimator = base.transform.GetComponent <Animator>(); } if (!this.remote) { if (LocalPlayer.Animator.GetBool("firstTimePickup")) { this.artifactAnimator.SetBool("pickup", true); base.Invoke("resetPickup", 1f); Mood.StopConstantVibratation(); } else { this.artifactAnimator.SetBool("pickup", false); } } if (this._mode == artifactBallController.artifactMode.idle) { this.targetSpin = 1f; } if (this._mode == artifactBallController.artifactMode.attract || this._mode == artifactBallController.artifactMode.repel) { this.AffirmPoweredUpEvent(); } this.artifactAnimator.SetBool("open", false); this.artifactAnimator.CrossFade(this.idleHash, 0f, 0); }
private void Update() { if (!this.remote && Scene.HudGui.PlaceArtifactButton) { if (LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.RightHand, this._artifactId) && LocalPlayer.AnimControl.currLayerState1.shortNameHash == this.artifactIdleHash && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.World && !this.doingSetArtifact) { float x = LocalPlayer.MainCamTr.eulerAngles.x; bool flag = x > (float)((!Scene.HudGui.PlaceArtifactButton.activeSelf) ? 20 : 19) && x < 90f; if (Scene.HudGui.PlaceArtifactButton.activeSelf != flag) { Scene.HudGui.PlaceArtifactButton.SetActive(flag); } bool flag2; if (!LocalPlayer.AnimControl.wallSetup.atWallCheck && LocalPlayer.FpCharacter.Grounded && !LocalPlayer.FpCharacter.standingOnRaft && !LocalPlayer.FpCharacter.StandingOnDynamicObject) { if (!this.iconSetup.placeIcon.activeSelf) { this.iconSetup.placeIcon.SetActive(true); } if (!this.iconSetup.placeSprite.activeSelf) { this.iconSetup.placeSprite.SetActive(true); } flag2 = false; } else { if (this.iconSetup.placeIcon.activeSelf) { this.iconSetup.placeIcon.SetActive(false); } if (this.iconSetup.placeSprite.activeSelf) { this.iconSetup.placeSprite.SetActive(false); } flag2 = true; } if (artifactBallController.GetAttractInput()) { if (this._mode == artifactBallController.artifactMode.attract) { base.StartCoroutine(this.setArtifactStateRoutine(artifactBallController.artifactMode.idle)); } else { base.StartCoroutine(this.setArtifactStateRoutine(artifactBallController.artifactMode.attract)); } } else if (artifactBallController.GetRepelInput()) { if (this._mode == artifactBallController.artifactMode.repel) { base.StartCoroutine(this.setArtifactStateRoutine(artifactBallController.artifactMode.idle)); } else { base.StartCoroutine(this.setArtifactStateRoutine(artifactBallController.artifactMode.repel)); } } else if (artifactBallController.GetPlaceInput() && LocalPlayer.FpCharacter.Grounded && Scene.HudGui.PlaceArtifactButton.activeSelf && !flag2) { LocalPlayer.SpecialActions.SendMessage("placeArtifactRoutine", base.transform); } } else if (Scene.HudGui.PlaceArtifactButton.activeSelf) { Scene.HudGui.PlaceArtifactButton.SetActive(false); } } if (this.remote) { if (this.currentStateIndex != this.playerAnimator.GetInteger("artifactStateMP")) { this.setArtifactState(this.playerAnimator.GetInteger("artifactStateMP")); } if (this.playerAnimator.GetCurrentAnimatorStateInfo(2).shortNameHash == this.artifactPutDownHash) { this.artifactAnimator.SetBool("pickup", true); } else { this.artifactAnimator.SetBool("pickup", false); } } this.baseColor = Color.Lerp(this.baseColor, this.targetColor, Time.deltaTime / 5f); this.emission = Mathf.Lerp(this.emission, this.targetEmission, Time.deltaTime / 5f); Color emissionColorProperty = this.baseColor * Mathf.LinearToGammaSpace(this.emission); this.SetEmissionColorProperty(emissionColorProperty); this.spin = Mathf.Lerp(this.spin, this.targetSpin, Time.deltaTime / 2f); this.artifactAnimator.SetFloat("spinSpeed", this.spin); float num = this.spin / 2f; if (num < 0f) { num *= -1f; } if (num < 1f) { num = 1f; } if (!this.placedArtifact) { this.playerAnimator.SetFloat("artifactWobble", num); } if (!this.remote && !this.placedArtifact) { float num2 = this.spin / 50f; if (num2 < 0f) { num2 *= -1f; } if ((double)num2 > 0.03) { Mood.BeginConstantVibratation(num2, num2); } else { Mood.StopConstantVibratation(); } } if (this.effectSetup && Time.time > this.effectUpdateRate && this._mode == artifactBallController.artifactMode.repel) { this.effectSetup.sendEnemyState(false); this.effectUpdateRate = Time.time + 5f; } if (this.artifactLight) { this.baseColorLight = Color.Lerp(this.baseColorLight, this.targetColorLight, Time.deltaTime / 5f); this.artifactLight.color = this.baseColorLight; float intensity = this.emission / 5f; this.artifactLight.intensity = intensity; } }
private void Update() { float b = 0.2f; AnimatorStateInfo currentAnimatorStateInfo = this.playerAnimator.GetCurrentAnimatorStateInfo(1); AnimatorStateInfo currentAnimatorStateInfo2 = this.playerAnimator.GetCurrentAnimatorStateInfo(2); if (this.NeedleRotateGo && !this.netPrefab) { Vector3 zero = Vector3.zero; zero.z = LocalPlayer.Stats.Fuel.CurrentFuel * 1.4f; this.NeedleRotateGo.transform.localEulerAngles = zero; } if (currentAnimatorStateInfo.shortNameHash == this.toIdleHash) { if (!this.netPrefab) { LocalPlayer.Animator.SetLayerWeightReflected(3, 0f); } if (currentAnimatorStateInfo.normalizedTime > 0.5f) { b = 7f; if (!this.netPrefab) { Mood.BeginConstantVibratation(this.VibrateForceAttack, this.VibrateForceAttack); } } if (!this.netPrefab) { if (LocalPlayer.Stats.Fuel.CurrentFuel > 0f) { this.chainSawAnimator.CrossFade("Base Layer.toIdle", 0f, 0, currentAnimatorStateInfo.normalizedTime); } } else if (this.playerAnimator.GetFloat("fuel") > 0.1f) { this.chainSawAnimator.CrossFade("Base Layer.toIdle", 0f, 0, currentAnimatorStateInfo.normalizedTime); } if (!this.netPrefab) { this.playerAnimator.SetBool("cancelCheckArms", true); this.playerAnimator.SetBool("checkArms", false); } this.syncIdle = true; } else { this.syncIdle = false; if (!this.netPrefab) { this.playerAnimator.SetBool("cancelCheckArms", false); } } if (this.active) { if (currentAnimatorStateInfo2.shortNameHash == this.sawTreeHash || currentAnimatorStateInfo.shortNameHash == this.sawAttackHash) { if (Time.time > this.attackTimer && !this.netPrefab) { if (this.sawCollider.enabled) { this.sawCollider.enabled = false; if (this.mainCollider) { this.mainCollider.enabled = true; } } else { this.sawCollider.enabled = true; if (this.mainCollider) { this.mainCollider.enabled = false; } } if (currentAnimatorStateInfo.shortNameHash == this.sawAttackHash) { this.attackTimer = Time.time + 0.25f; } else { this.attackTimer = Time.time + 0.05f; } } b = 7f; } else { if (!this.netPrefab) { this.sawCollider.enabled = false; } if (this.mainCollider) { this.mainCollider.enabled = false; } } if (currentAnimatorStateInfo.shortNameHash == this.idleHash || currentAnimatorStateInfo.shortNameHash == this.toIdleHash) { if (this.netPrefab && this.netActive) { this.AffirmEventStarted(); } else if (!this.netPrefab) { this.AffirmEventStarted(); } } if (this.eventInstance != null) { if (currentAnimatorStateInfo2.shortNameHash == this.sawTreeHash || currentAnimatorStateInfo2.shortNameHash == this.toSawTreeHash || currentAnimatorStateInfo.shortNameHash == this.sawAttackHash || currentAnimatorStateInfo.shortNameHash == this.toSawAttackHash) { if (!this.cuttingObject) { this.SetCuttingParameter(0.5f); } if (this.cuttingObject) { this.SetCuttingParameter(0.8f); this.setCuttingTreeParameter(0.5f); if (this.cuttingFlesh) { this.setCuttingTreeParameter(0f); this.setCuttingFleshParameter(0.5f); } } } else { this.cuttingObject = false; this.cuttingFlesh = false; this.cuttingTree = false; this.SetCuttingParameter(0f); this.setCuttingFleshParameter(0f); this.setCuttingTreeParameter(0f); } if (!this.netPrefab && TheForest.Utils.Input.GetButton("AltFire")) { b = 8f; this.SetCuttingParameter(0.8f); } UnityUtil.ERRCHECK(this.eventInstance.set3DAttributes(base.transform.to3DAttributes())); } } if (!this.netPrefab) { bool flag = LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.World; if (LocalPlayer.Stats.Fuel.CurrentFuel <= 0f) { this.chainSawAnimator.SetBool("empty", true); b = 0f; if (this.active) { this.active = false; this.StopEvent(); this.sawCollider.enabled = false; this.playerAnimator.SetFloatReflected("fuel", 0f); this.playerAnimator.SetBool("attack", false); this.playerAnimator.SetBool("sawAttack", false); if (this.smokeGo) { this.smokeGo.SetActive(false); } } LocalPlayer.Inventory.SetReloadDelay(1f); Scene.HudGui.FuelReserve.fillAmount = 0f; Mood.StopConstantVibratation(); } else { if (!this.active) { this.active = true; } this.chainSawAnimator.SetBool("empty", false); LocalPlayer.Inventory.CancelReloadDelay(); if (!this.netPrefab) { this.playerAnimator.SetFloatReflected("fuel", 1f); } if (this.smokeGo) { this.smokeGo.SetActive(true); } if (this.mainCollider.enabled) { LocalPlayer.Stats.Fuel.CurrentFuel -= Time.deltaTime * 3f; Mood.BeginConstantVibratation(this.VibrateForceAttack, this.VibrateForceAttack); } else if (LocalPlayer.AnimControl.currLayerState1.shortNameHash != this.toIdleHash) { Mood.BeginConstantVibratation(this.VibrateForceIdle, this.VibrateForceIdle); } Scene.HudGui.FuelReserve.fillAmount = LocalPlayer.Stats.Fuel.CurrentFuel / LocalPlayer.Stats.Fuel.MaxFuelCapacity; } } if (this.netPrefab) { if (this.playerAnimator.GetFloat("fuel") <= 0.1f) { this.chainSawAnimator.SetBool("empty", true); b = 0f; if (this.netActive) { this.StopEvent(); if (this.smokeGo) { this.smokeGo.SetActive(false); } this.netActive = false; } } else if (!this.netActive) { if (this.smokeGo) { this.smokeGo.SetActive(true); } this.chainSawAnimator.SetBool("empty", false); this.netActive = true; } } this.chainSpeed = Mathf.Lerp(this.chainSpeed, b, Time.deltaTime * 2f); this.chainSawAnimator.SetFloatReflected("chainSpeed", this.chainSpeed); }