From 8e0d1874dc8a7e351227fe9b9b3248b3dfed83f6 Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sun, 3 Apr 2022 20:09:07 -0400 Subject: [PATCH] Don't screen shake when throwing minion --- Assets/Scripts/AIEntity.cs | 4 ++-- Assets/Scripts/Entity.cs | 2 +- Assets/Scripts/MinionThrower.cs | 2 +- Assets/Scripts/PlayerMovement.cs | 2 +- Assets/Scripts/VampireEntity.cs | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/AIEntity.cs b/Assets/Scripts/AIEntity.cs index 3bf8eb3..8539882 100644 --- a/Assets/Scripts/AIEntity.cs +++ b/Assets/Scripts/AIEntity.cs @@ -78,12 +78,12 @@ public class AIEntity : Entity { return enemies.HasFlag(other.entityType) && other.IsAlive(); } - override public bool TakeDamage(float amount, Entity other, bool sound=true) { + override public bool TakeDamage(float amount, Entity other, bool sound = true, bool intentional = false) { //TODO Should we warn if target is null here? if (target != null && target.GetComponent() is { }) target = other.transform; - return base.TakeDamage(amount, other, sound); + return base.TakeDamage(amount, other, sound, intentional); } #region Flip diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 9067f12..1480d39 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -93,7 +93,7 @@ public class Entity : MonoBehaviour { } //Apply damage to the entity, returns true if it is still alive - public virtual bool TakeDamage(float amount, Entity other, bool sound = true) { + public virtual bool TakeDamage(float amount, Entity other, bool sound = true, bool intentional = false) { Health -= amount; healthBar.SetHealthFraction(Health / initialHealth); diff --git a/Assets/Scripts/MinionThrower.cs b/Assets/Scripts/MinionThrower.cs index aaf0dc7..76fc4c7 100644 --- a/Assets/Scripts/MinionThrower.cs +++ b/Assets/Scripts/MinionThrower.cs @@ -81,7 +81,7 @@ public class MinionThrower : MonoBehaviour { if (minionHealthCost >= vampireEntity.Health) { return; } - vampireEntity.TakeDamage(minionHealthCost, vampireEntity); + vampireEntity.TakeDamage(minionHealthCost, vampireEntity, intentional: true); currentCooldownTimer = playerStats.currentInitialCooldown; diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 933b0c3..9168fc4 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -196,7 +196,7 @@ public class PlayerMovement : MonoBehaviour { // playerMovement.animator.SetBool("Jumping", true); playerMovement.animator.Play("Player_Jump"); playerMovement.soundManager.PlaySound(playerMovement.jumpSource, playerMovement.jumpSounds, randomPitch: true, createTempSourceIfBusy: true); - playerMovement.screenShaker.Shake(); + playerMovement.screenShaker.Shake(rumbleLowFreq:0f, rumbleHighFreq:0f); } public override void LeaveState() { // playerMovement.animator.SetBool("Jumping", false); diff --git a/Assets/Scripts/VampireEntity.cs b/Assets/Scripts/VampireEntity.cs index 81355e6..85aae01 100644 --- a/Assets/Scripts/VampireEntity.cs +++ b/Assets/Scripts/VampireEntity.cs @@ -30,12 +30,12 @@ public class VampireEntity : Entity { TakeDamage(playerStats.bloodLossRate * Time.deltaTime, this, sound: false); } - public override bool TakeDamage(float amount, Entity other, bool sound = true) { - if (sound) { + public override bool TakeDamage(float amount, Entity other, bool sound = true, bool intentional = false) { + if (sound && !intentional) { screenShaker.Shake(); } - return base.TakeDamage(amount, other, sound); + return base.TakeDamage(amount, other, sound, intentional); } public bool IsInSafeZone() => playerMovement.IsInSafeZone;