diff --git a/Assets/Prefabs/Characters/PlayerArmLeft.prefab b/Assets/Prefabs/Characters/PlayerArmLeft.prefab index 17ccd944b..af1778f44 100644 --- a/Assets/Prefabs/Characters/PlayerArmLeft.prefab +++ b/Assets/Prefabs/Characters/PlayerArmLeft.prefab @@ -956,7 +956,7 @@ SkinnedMeshRenderer: m_RootBone: {fileID: 7971391927095658884} m_AABB: m_Center: {x: -0.010198317, y: -0.0017878572, z: 0.04950676} - m_Extent: {x: 0.0062388154, y: 0.009813513, z: 0.0126058515} + m_Extent: {x: 0.01333882, y: 0.01581351, z: 0.02560585} m_DirtyAABB: 0 --- !u!1 &8321719110810010550 GameObject: diff --git a/Assets/Prefabs/Characters/PlayerArmRight.prefab b/Assets/Prefabs/Characters/PlayerArmRight.prefab index f8a487486..ee5ef355e 100644 --- a/Assets/Prefabs/Characters/PlayerArmRight.prefab +++ b/Assets/Prefabs/Characters/PlayerArmRight.prefab @@ -95,7 +95,7 @@ Transform: - {fileID: 5880885916632462744} - {fileID: 3535131488769462984} m_Father: {fileID: 0} - m_RootOrder: -1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &7601771935898208010 MonoBehaviour: @@ -631,8 +631,8 @@ SkinnedMeshRenderer: m_BlendShapeWeights: [] m_RootBone: {fileID: 7158862323430776054} m_AABB: - m_Center: {x: -0.010195851, y: 0.012608443, z: -0.0026928633} - m_Extent: {x: 0.006238593, y: 0.010776787, z: 0.0099769235} + m_Center: {x: -0.010195851, y: 0.01960844, z: -0.0026928633} + m_Extent: {x: 0.01538593, y: 0.01577679, z: 0.019976923} m_DirtyAABB: 0 --- !u!1 &4721697430436054245 GameObject: diff --git a/Assets/Prefabs/Gamestate/StaticInfo.prefab b/Assets/Prefabs/Gamestate/StaticInfo.prefab index 258e50c88..df2663ddc 100644 --- a/Assets/Prefabs/Gamestate/StaticInfo.prefab +++ b/Assets/Prefabs/Gamestate/StaticInfo.prefab @@ -67,4 +67,6 @@ MonoBehaviour: extensionAuction: {fileID: 11400000, guid: ad4a13bed7ceda243beb3334b23d48b0, type: 2} startingBody: {fileID: 11400000, guid: bf9666eedd80829a0a6b59278813ba72, type: 2} startingBarrel: {fileID: 11400000, guid: 89eab92daa1634e84ace980d00e1880e, type: 2} + startingExtension: {fileID: 0} secretNames: {fileID: 11400000, guid: 2f3309b3d89e8224e9bac1c33fd04eed, type: 2} + cameraFov: 90 diff --git a/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs b/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs index e6d57ac23..37600d419 100644 --- a/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs +++ b/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs @@ -50,7 +50,10 @@ public class DDRBody : GunBody [SerializeField] private Precision[] precisionsGoodToBad; - LTDescr arrowMover; + int arrowMoverTween; + int screenFlasherTween; + int screenPulseAnimatorTween; + int textAnimatorTween; private float secondsPerUnitHeight; private float musicPace; @@ -82,16 +85,16 @@ public override void Start() ? MusicTrackManager.Singleton.TrackOffset : secondsPerArrow - (MusicTrackManager.Singleton.TimeSinceTrackStart % secondsPerArrow); - arrowMover = LeanTween.value(gameObject, SetArrowHeigth, startHeight, screenHeight, secondsPerUnitHeight * (screenHeight - startHeight)) + arrowMoverTween = LeanTween.value(gameObject, SetArrowHeigth, startHeight, screenHeight, secondsPerUnitHeight * (screenHeight - startHeight)) .setDelay(delay) .setRepeat(-1) - .setOnComplete(ResetArrow); + .setOnComplete(ResetArrow).id; - LeanTween.value(gameObject, SetBackgroundZoom, 0.5f, 1.5f, musicPace) + screenPulseAnimatorTween = LeanTween.value(gameObject, SetBackgroundZoom, 0.5f, 1.5f, musicPace) .setDelay(delay) .setLoopPingPong() .setOnComplete( - () => animator.OnFire(gunController.stats)); + () => animator.OnFire(gunController.stats)).id; animator.OnInitialize(gunController.stats); @@ -118,16 +121,18 @@ protected override void Reload(GunStats stats) if (!precision.HasValue) return; - + if (LeanTween.isTweening(textAnimatorTween)) + LeanTween.cancel(textAnimatorTween); precisionText.enabled = true; precisionText.text = precision.Value.text; precisionText.color = precision.Value.color; - precisionText.gameObject.LeanScale(new Vector3(1.1f, 1.1f, 1.1f), 0.5f) + textAnimatorTween = LeanTween.scale(precisionText.gameObject, new Vector3(1.1f, 1.1f, 1.1f), 0.5f) .setEasePunch() .setOnComplete( - () => precisionText.enabled = false); - - LeanTween.value(gameObject, SetFlashFactor, 0, 50f, 0.5f).setEasePunch(); + () => precisionText.enabled = false).id; + if (LeanTween.isTweening(screenFlasherTween)) + LeanTween.cancel(screenFlasherTween); + screenFlasherTween = LeanTween.value(gameObject, SetFlashFactor, 0, 50f, 0.5f).setEasePunch().id; gunController.Reload(reloadEfficiencyPercentage * precision.Value.awardFactor); animator.OnReload(gunController.stats); @@ -169,11 +174,12 @@ private void ArrowSelect(InputAction.CallbackContext ctx) private void ResetAndStartArrowTween() { - LeanTween.cancel(arrowMover.id); + if (LeanTween.isTweening(arrowMoverTween)) + LeanTween.cancel(arrowMoverTween); ResetArrow(); - arrowMover = LeanTween.value(gameObject, SetArrowHeigth, arrowHeight, screenHeight, secondsPerUnitHeight * (screenHeight - arrowHeight)) + arrowMoverTween = LeanTween.value(gameObject, SetArrowHeigth, arrowHeight, screenHeight, secondsPerUnitHeight * (screenHeight - arrowHeight)) .setRepeat(-1) - .setOnComplete(ResetArrow); + .setOnComplete(ResetArrow).id; } private void SetArrowHeigth(float heigth) diff --git a/Assets/Scripts/Augment/GunController.cs b/Assets/Scripts/Augment/GunController.cs index 8d8242426..dcf414564 100644 --- a/Assets/Scripts/Augment/GunController.cs +++ b/Assets/Scripts/Augment/GunController.cs @@ -58,7 +58,8 @@ public void SetPlayer(PlayerManager player) private bool isFiring = false; - private LTDescr recoilTween; + private int recoilTween; + private int zoomTween; private void Start() { @@ -164,14 +165,14 @@ public void PlayRecoil() public void PlayRecoil(GunStats stats) { - if (recoilTween != null) + if (LeanTween.isTweening(recoilTween)) { - LeanTween.cancel(recoilTween.id); + LeanTween.cancel(recoilTween); transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, localGunZOffset); } var moveAmount = Player != null ? 0.3f : 0.6f; // TODO reduce tween time based on fire rate - recoilTween = gameObject.LeanMoveLocalZ(moveAmount, 0.2f).setEasePunch(); + recoilTween = gameObject.LeanMoveLocalZ(moveAmount, 0.2f).setEasePunch().id; } private void ShotFired() diff --git a/Assets/Scripts/Control&Input/PlayerMovement.cs b/Assets/Scripts/Control&Input/PlayerMovement.cs index 13c07e904..b6d5ebe14 100644 --- a/Assets/Scripts/Control&Input/PlayerMovement.cs +++ b/Assets/Scripts/Control&Input/PlayerMovement.cs @@ -117,6 +117,11 @@ public class PlayerMovement : MonoBehaviour public delegate void MovementEventBody(Rigidbody body); public MovementEventBody onMove; + private int gunCrouchPerformedTween; + private int cameraCrouchPerformedTween; + private int gunCrouchCanceledTween; + private int cameraCrouchCanceledTween; + void Start() { body = GetComponent(); @@ -142,7 +147,7 @@ public void SetPlayerInput(InputManager player) localGunHolderX = gunHolder.transform.localPosition.x; localGunHolderHeight = gunHolder.transform.localPosition.y; playerCamera = inputManager.GetComponent(); - startingFov = playerCamera.fieldOfView; + startingFov = StaticInfo.Singleton.CameraFov; if (MatchController.Singleton) MatchController.Singleton.onRoundEnd += ResetZoom; @@ -199,9 +204,17 @@ private void ResetZoom() private void OnCrouch(InputAction.CallbackContext ctx) { - if (LeanTween.isTweening(inputManager.gameObject)) + if (LeanTween.isTweening(cameraCrouchCanceledTween)) + { + LeanTween.cancel(cameraCrouchCanceledTween); + LeanTween.cancel(gunCrouchCanceledTween); + inputManager.transform.localPosition = new Vector3(inputManager.transform.localPosition.x, localCameraHeight, inputManager.transform.localPosition.z); + gunHolder.transform.localPosition = new Vector3(gunHolder.transform.localPosition.x, localGunHolderHeight, gunHolder.transform.localPosition.z); + } + if (LeanTween.isTweening(cameraCrouchPerformedTween)) { - LeanTween.cancel(inputManager.gameObject); + LeanTween.cancel(cameraCrouchPerformedTween); + LeanTween.cancel(gunCrouchPerformedTween); inputManager.transform.localPosition = new Vector3(inputManager.transform.localPosition.x, localCameraHeight, inputManager.transform.localPosition.z); gunHolder.transform.localPosition = new Vector3(gunHolder.transform.localPosition.x, localGunHolderHeight, gunHolder.transform.localPosition.z); } @@ -220,8 +233,8 @@ private void OnCrouch(InputAction.CallbackContext ctx) { animator.SetBool("Crouching", false); strafeForce = strafeForceGrounded; - inputManager.gameObject.LeanMoveLocalY(localCameraHeight, 0.2f); - gunHolder.LeanMoveLocalY(localGunHolderHeight, 0.2f); + cameraCrouchCanceledTween = inputManager.gameObject.LeanMoveLocalY(localCameraHeight, 0.2f).id; + gunCrouchCanceledTween = gunHolder.LeanMoveLocalY(localGunHolderHeight, 0.2f).id; isDashing = false; onLanding -= StartCrouch; } @@ -232,8 +245,8 @@ private void StartCrouch() { animator.SetBool("Crouching", true); strafeForce = strafeForceCrouched; - inputManager.gameObject.LeanMoveLocalY(localCameraHeight - crouchedHeightOffset, 0.2f); - gunHolder.LeanMoveLocalY(localGunHolderHeight - crouchedHeightGunOffset, 0.2f); + cameraCrouchPerformedTween = inputManager.gameObject.LeanMoveLocalY(localCameraHeight - crouchedHeightOffset, 0.2f).id; + gunCrouchCanceledTween = gunHolder.LeanMoveLocalY(localGunHolderHeight - crouchedHeightGunOffset, 0.2f).id; } private void EnableDash() diff --git a/Assets/Scripts/Gamestate/PlayerManager.cs b/Assets/Scripts/Gamestate/PlayerManager.cs index 6a34e0358..d1d6ddbf9 100644 --- a/Assets/Scripts/Gamestate/PlayerManager.cs +++ b/Assets/Scripts/Gamestate/PlayerManager.cs @@ -359,7 +359,7 @@ private void SetLayerOnSubtree(GameObject node, int layer) private void PlayOnHit() { - if (Random.Range(0, 1000) > 5) + if (Random.Range(0, 10000) > 5) { hitSounds.Play(audioSource); } diff --git a/Assets/Scripts/Gamestate/StaticInfo.cs b/Assets/Scripts/Gamestate/StaticInfo.cs index 626e9afdc..222bb083f 100644 --- a/Assets/Scripts/Gamestate/StaticInfo.cs +++ b/Assets/Scripts/Gamestate/StaticInfo.cs @@ -55,6 +55,11 @@ public class StaticInfo : MonoBehaviour public ReadOnlyArray Extensions; public ReadOnlyArray SecretNames; + [Header("Settings")] + [SerializeField] + private float cameraFov; + public float CameraFov => cameraFov; + void Start() { #region Singleton boilerplate diff --git a/Assets/Scripts/UI/PlayerHUDController.cs b/Assets/Scripts/UI/PlayerHUDController.cs index dea64470c..0ccafbb8e 100644 --- a/Assets/Scripts/UI/PlayerHUDController.cs +++ b/Assets/Scripts/UI/PlayerHUDController.cs @@ -30,6 +30,8 @@ public class PlayerHUDController : MonoBehaviour private const float ammoSpinDegrees = 30; private const float availableDegrees = 270; + private int ammoTween; + [Header("Death")] @@ -73,6 +75,7 @@ public class PlayerHUDController : MonoBehaviour [SerializeField] private RectTransform scopeZoom; + private int scopeTween; void Start() @@ -127,16 +130,16 @@ public void OnDamageTaken(float damage, float currentHealth, float maxHealth) public void UpdateOnFire(float ammoPercent) { - if (LeanTween.isTweening(ammoHud.gameObject)) + if (LeanTween.isTweening(ammoTween)) { - LeanTween.cancel(ammoHud.gameObject); + LeanTween.cancel(ammoTween); ammoBar.gameObject.transform.eulerAngles = new Vector3(ammoBar.gameObject.transform.eulerAngles.x, ammoBar.gameObject.transform.eulerAngles.y, 0); } ammoCapacityMaterial.SetFloat("_Arc2", (1 - ammoPercent) * availableDegrees); - ammoHud.gameObject.LeanRotateAroundLocal(Vector3.forward, ammoSpinDegrees, 0.5f).setEaseSpring() + ammoTween = ammoHud.gameObject.LeanRotateAroundLocal(Vector3.forward, ammoSpinDegrees, 0.5f).setEaseSpring() .setOnStart( - () => ammoBar.gameObject.transform.Rotate(new Vector3(0, 0, -ammoSpinDegrees))); + () => ammoBar.gameObject.transform.Rotate(new Vector3(0, 0, -ammoSpinDegrees))).id; } public void UpdateOnReload(float ammoPercent) @@ -160,7 +163,9 @@ private void SetHealthBar(float width) public void TweenScope(float alpha, float seconds) { - scopeZoom.LeanAlpha(alpha, seconds).setEaseInOutCubic(); + if (LeanTween.isTweening(scopeTween)) + LeanTween.cancel(scopeTween); + scopeTween = scopeZoom.LeanAlpha(alpha, seconds).setEaseInOutCubic().id; } public void UpdateDamageBorder(float intensity)