public override void Clear() { if (target == null) { return; } for (int i = 0; i < stacks; i++) { target.health -= poisonDmg; DamagePopUpManager.RequestDamagePopUp(poisonDmg, false, GetComponentInParent <Transform>()); } for (int i = 0; i < timers.Length; i++) { timers[i] = 0; } target.renderer.color = initialColor; particleLight.SetActive(false); var e = particles.emission; e.enabled = false; this.enabled = false; }
protected override void Update() { if (target == null) { return; } for (int i = 0; i < timers.Length; i++) { if (timers[i] > 0) { timers[i] -= Time.deltaTime; if (timers[i] < 0) { target.health -= poisonDmg; DamagePopUpManager.RequestDamagePopUp(poisonDmg, false, GetComponentInParent <Transform>()); } if (stacks <= 0) { target.renderer.color = initialColor; particleLight.SetActive(false); var e = particles.emission; e.enabled = false; this.enabled = false; } } } }
//! A bit messy to have both a public health property and `TakeDamage`, but unsure how to address public virtual void TakeDamage(float damage, bool isCritical) { if (!isInvulnerable) { health -= damage; DamagePopUpManager.RequestDamagePopUp(damage, isCritical, transform); iframes?.TriggerInvulnerability(); } }
private IEnumerator TakeAoeDamage(Character hit) { while (charactersInAreaList.Contains(hit)) { if (hit != null) { DamagePopUpManager.RequestDamagePopUp(tickDamage, hit.transform); hit.health -= tickDamage; yield return(new WaitForSeconds(tickDuration)); Debug.Log("Character took dmg from AOE"); } } }
private IEnumerator DamageOverTimeCo(Character hit) { DamagePopUpManager.RequestDamagePopUp(tickDamage, hit.transform); hit.health -= tickDamage; // Tick once on hit for (int i = 1; i < ticks; i++) { if (hit != null) { yield return(new WaitForSeconds(tickDuration)); DamagePopUpManager.RequestDamagePopUp(tickDamage, hit.transform); hit.health -= tickDamage; } } }
protected override IEnumerator TakeAoeDamage(Character hit) { while (charactersInAreaList.Contains(hit)) { if (hit != null) { hit.health -= tickDamage; // This means DMG WITHOUT ARMOR and No iFrames! DamagePopUpManager.RequestDamagePopUp(tickDamage, hit.transform); hit.RequestGotHitSound(); yield return(new WaitForSeconds(tickDuration)); Debug.Log("Character took dmg from AOE"); } } }
public override void Trigger() { if (target == null) { return; } particleLight.SetActive(true); var e = particles.emission; e.enabled = true; if (stacks < maxStacks) { for (int i = 0; i < timers.Length; i++) { if (timers[i] <= 0) { timers[i] = duration; break; } } target.health -= poisonDmg; DamagePopUpManager.RequestDamagePopUp(poisonDmg, false, GetComponentInParent <Transform>()); if (target.renderer.color != colorChange) { target.renderer.color = colorChange; } } if (stacks > 0) { this.enabled = true; } }