public void Damage(float damage, Vector3 knockBackDir, float knockBack) { if (!isHurt) { isHurt = true; hurtVFX.BeginFlash(); currHealth -= damage; ObjectPoolManager.Spawn(deathVFX, transform.position, transform.rotation); IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>(); player.SetUpAudioSource(AudioManager.instance.GetSound("BugsSplat")); player.PlayAtRandomPitch(); DamageNumber dmgVFX = ObjectPoolManager.Spawn(hurtNumber, transform.position, Quaternion.identity).GetComponent <DamageNumber>(); if (dmgVFX != false) { dmgVFX.Init(); dmgVFX.SetTextValuesAtScale(damage, maxHealth, knockBackDir, 2f); } if (currHealth <= 0.0f) { DisableBroodDelegate(); } Invoke("ResetHurt", hurtTime); } }
public void Damage(float damage, Vector3 knockBackDir, float knockBack) { if (currentStage != BossStage.Transition) { if (!isHurt && !isDead) { hurtVFX.BeginFlash(); ObjectPoolManager.Spawn(deathVFX, transform.position, transform.rotation); IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>(); player.SetUpAudioSource(AudioManager.instance.GetSound("BugsSplat")); player.PlayAtRandomPitch(); isHurt = true; currHealth -= damage; if (currHealth < 0f) { currHealth = 0f; } DamageNumber dmgVFX = ObjectPoolManager.Spawn(hurtNumber, transform.position, Quaternion.identity).GetComponent <DamageNumber>(); if (dmgVFX != false) { dmgVFX.Init(); dmgVFX.SetTextValuesAtScale(damage, MaxHealth, knockBackDir, 10); } if (currHealth / MaxHealth <= currentStageTrigger) { currHealth = MaxHealth * currentStageTrigger; EnterTransition(); } healthBar.UpdateValue(currHealth); Invoke("ResetHurt", hurtTime); } } }