Don't screen shake when throwing minion

This commit is contained in:
Jason Durand 01 2022-04-03 20:09:07 -04:00
parent f4ee5d0de1
commit 8e0d1874dc
5 changed files with 8 additions and 8 deletions

View File

@ -78,12 +78,12 @@ public class AIEntity : Entity {
return enemies.HasFlag(other.entityType) && other.IsAlive(); 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? //TODO Should we warn if target is null here?
if (target != null && target.GetComponent<VampireEntity>() is { }) if (target != null && target.GetComponent<VampireEntity>() is { })
target = other.transform; target = other.transform;
return base.TakeDamage(amount, other, sound); return base.TakeDamage(amount, other, sound, intentional);
} }
#region Flip #region Flip

View File

@ -93,7 +93,7 @@ public class Entity : MonoBehaviour {
} }
//Apply damage to the entity, returns true if it is still alive //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; Health -= amount;
healthBar.SetHealthFraction(Health / initialHealth); healthBar.SetHealthFraction(Health / initialHealth);

View File

@ -81,7 +81,7 @@ public class MinionThrower : MonoBehaviour {
if (minionHealthCost >= vampireEntity.Health) { if (minionHealthCost >= vampireEntity.Health) {
return; return;
} }
vampireEntity.TakeDamage(minionHealthCost, vampireEntity); vampireEntity.TakeDamage(minionHealthCost, vampireEntity, intentional: true);
currentCooldownTimer = playerStats.currentInitialCooldown; currentCooldownTimer = playerStats.currentInitialCooldown;

View File

@ -196,7 +196,7 @@ public class PlayerMovement : MonoBehaviour {
// playerMovement.animator.SetBool("Jumping", true); // playerMovement.animator.SetBool("Jumping", true);
playerMovement.animator.Play("Player_Jump"); playerMovement.animator.Play("Player_Jump");
playerMovement.soundManager.PlaySound(playerMovement.jumpSource, playerMovement.jumpSounds, randomPitch: true, createTempSourceIfBusy: true); 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() { public override void LeaveState() {
// playerMovement.animator.SetBool("Jumping", false); // playerMovement.animator.SetBool("Jumping", false);

View File

@ -30,12 +30,12 @@ public class VampireEntity : Entity {
TakeDamage(playerStats.bloodLossRate * Time.deltaTime, this, sound: false); TakeDamage(playerStats.bloodLossRate * Time.deltaTime, this, sound: false);
} }
public override bool TakeDamage(float amount, Entity other, bool sound = true) { public override bool TakeDamage(float amount, Entity other, bool sound = true, bool intentional = false) {
if (sound) { if (sound && !intentional) {
screenShaker.Shake(); screenShaker.Shake();
} }
return base.TakeDamage(amount, other, sound); return base.TakeDamage(amount, other, sound, intentional);
} }
public bool IsInSafeZone() => playerMovement.IsInSafeZone; public bool IsInSafeZone() => playerMovement.IsInSafeZone;