public void Damage(float dmg, Effect.AbilityEffect effect, bool crit, GameObject abilityOwner) { if (crit) { dmg *= 1.25f; } health -= dmg; // remove damage from health health = health < 0 ? 0f : health; // do not allow below 0 if (health <= 0 && !isDead) { // inform player that it was killed abilityOwner.GetComponent <Player>().AddExperience(1200000); // TODO int experience = 1200000; print("Killed " + name + ": Gained " + experience + " experience"); Kill(); } damageTaken?.Invoke(dmg, new Effect.AbilityEffect(), crit); // inform subscribers that HP has changed healthChanged?.Invoke(); _behaviorManager.Damaged(abilityOwner, dmg); if (effect.effectType != Effect.EffectType.Basic) { ApplyEffect(effect, abilityOwner); } }
private void ShowCombatText(float damage, Effect.AbilityEffect effect, bool crit) { if (UISettings.instance.CombatActive) { // show the combat text initCBT(damage, effect, crit); } }
public void SetVars(int damage_, float range, Effect.AbilityEffect effect_, GameObject owner, Ability.AbilityType aType) { damage = damage_; maxRange = range; effect = effect_; _owner = owner; abilityType = aType; startPosition = transform.position; }
IEnumerator ApplyDamageEffect(Effect.AbilityEffect effect, GameObject abilityOwner) { int ticksRemaining = effect.numTicks; while (ticksRemaining > 0) { SubsequentDamage(effect, abilityOwner); ticksRemaining--; yield return(new WaitForSeconds(1)); } }
public void ApplyEffect(Effect.AbilityEffect effect, GameObject abilityOwner) { switch (effect.effectType) { case Effect.EffectType.Bleed: case Effect.EffectType.Burn: case Effect.EffectType.Poison: { StartCoroutine(ApplyDamageEffect(effect, abilityOwner)); } break; case Effect.EffectType.Root: break; } }
void initCBT(float damage, Effect.AbilityEffect effect, bool crit) { GameObject temp = Instantiate(combatText) as GameObject; temp.GetComponent <CombatTextDestroy>().SetParentWorldTransform(transform); RectTransform tempRect = temp.GetComponent <RectTransform>(); temp.transform.SetParent(damageCanvas); tempRect.transform.localPosition = Vector3.zero; tempRect.transform.localScale = combatText.transform.localScale; switch (effect.effectType) { case Effect.EffectType.Basic: temp.GetComponent <TMPro.TextMeshProUGUI>().color = textColors[0]; break; case Effect.EffectType.Bleed: temp.GetComponent <TMPro.TextMeshProUGUI>().color = textColors[1]; break; case Effect.EffectType.Burn: temp.GetComponent <TMPro.TextMeshProUGUI>().color = textColors[2]; break; case Effect.EffectType.Poison: temp.GetComponent <TMPro.TextMeshProUGUI>().color = textColors[3]; break; } if (crit) { temp.GetComponent <TMPro.TextMeshProUGUI>().fontSize *= 1.2f; } temp.GetComponent <TMPro.TextMeshProUGUI>().text = ((int)damage).ToString(); temp.GetComponent <Animator>().SetTrigger("Hit"); }
void SubsequentDamage(Effect.AbilityEffect effect, GameObject abilityOwner) { if (isDead) { return; } int damage = effect.value; health -= damage; // remove damage from health health = health < 0 ? 0f : health; // do not allow below 0 if (health <= 0) { Kill(); } damageTaken?.Invoke(damage, effect, false); // inform subscribers that HP has changed healthChanged?.Invoke(); _behaviorManager.Damaged(abilityOwner, damage); }
public void Damage(float damage, Effect.AbilityEffect effect, bool crit, GameObject abilityOwner) { if (damage >= _health) { _health -= _health; TriggerDeath(); } else { _health -= (int)damage; D_HealthChanged?.Invoke(); switch (effect.effectType) { case Effect.EffectType.Basic: { } break; } } }
public void ApplyEffect(Effect.AbilityEffect effect, GameObject abilityOwner) { throw new NotImplementedException(); }