public override void TakeDamage(float damage) { base.TakeDamage(damage); if (currentHealth <= MaxHealth.GetValue() / 2 && !secondPhase) { SecondPhase(); secondPhase = true; } }
protected override void OnEnable() { if (isInitialized) { audioSource.Play(); ReduceSpawns(); gameManager.StartCoroutine(gameManager.RUIManager.ShowBossText(BossEnterText, TextColor, TextMaterial)); gameManager.RUIManager.InitializeBossBar(MaxHealth.GetValue(), BossIcon); } base.OnEnable(); }
public override void TakeDamage(float damage) { if (Random.Range(0, 100) >= Agility.GetValue()) { damage -= Defence.GetValue(); damage = Mathf.Clamp(damage, 0, int.MaxValue); CurrentHealth -= damage; Healthbar.fillAmount = CurrentHealth / MaxHealth.GetValue(); Debug.Log("Damage has been taken " + damage); } }
//Set currentvalues to start values private void Start() { currentMana = Mathf.RoundToInt(maxMana.GetValue()); currentStamina = Mathf.RoundToInt(MaxStamina.GetValue()); currentHealth = Mathf.RoundToInt(MaxHealth.GetValue()); }