/// <summary> /// Bypasses armor and damages player /// </summary> public void DamagePlayerDirectly(int damage) { base.TakeDamage(damage); DamageCounter instance = Instantiate(damageCounterPrefab, transform); instance.SetText(damage.ToString()); animator.SetTrigger("damage"); UpdateStats(); }
/// <summary> /// Applies damage effects to indicate to the player that damage is happening! /// </summary> /// <param name="damage"></param> public void ApplyDamageEffects(int damage) { SpawnDamageParticles(); if (damage >= maxHealth.GetValue() / 2f) { CameraShaker.Instance.ShakeOnce(1f, 1f, 0.0f, 0.3f); SoundManager.Instance.PlayRandomizedPitch(SoundDatabase.Instance.PlayerHighAttack); } else { SoundManager.Instance.PlayRandomizedPitch(SoundDatabase.Instance.PlayerAttack); } DamageCounter instance = Instantiate(damageCounterPrefab); instance.SetText(damage.ToString()); instance.transform.position = transform.position; animator.SetTrigger("damage"); healthSlider.value = health / maxHealth.GetValue() * 100; }