void ZombieDeath() { if (hasDiedBefore) { animation.Stop(); animation.Play("disappear"); return; } SlowEffect efx = GetComponent <SlowEffect>(); if (efx != null) { Destroy(efx); } PoisonEffect pfx = GetComponent <PoisonEffect>(); if (pfx != null) { Destroy(pfx); } hasDiedBefore = true; if (GameSession.Instance.isDefender) { showGoldGain(Constants.AlienDeathGold[this.GetType().Name]); } else { float total = routeManager.distToEnd[0]; showGoldGain(Mathf.FloorToInt(((total - distToEnd) / total) * (float)Cost)); } StartCoroutine(Reanimate()); }
protected override void InitializeInternal(SkillService skillService, IBattleUnit attacker) { _poisonEffect = new PoisonEffect() { Duration = Duration, ImageId = "PoisonEffect" }; }
public override void usePower(CombatChar caster, CombatChar[] targets) { for (int count = 0; count < 1; count++) { PoisonEffect effect = Instantiate(poisonEffect).GetComponent <PoisonEffect>(); effect.castDamage = 10; targets[count].AddEffect(effect as Effects); } }
protected override void ApplyHitEffects(Alien alien) { PoisonEffect efx = alien.gameObject.GetComponent <PoisonEffect>(); if (efx != null) { efx.PoisonDamage = Mathf.Max(PoisonDamage, efx.PoisonDamage); efx.EffectTime = Mathf.Max(PoisonTime, efx.EffectTime); } else { PoisonEffect fx = alien.gameObject.AddComponent <PoisonEffect>(); fx.Init(PoisonDamage, PoisonTime, PoisonTick); } }
private void Update() { if (GameState.Instance.IsPaused || GameState.Instance.IsGameOver) { return; } AllEffects.RemoveWhere(effect => !effect.IsConstant && (effect.Duration.Value -= Time.deltaTime) <= 0f); var statusColors = new SortedDictionary <string, Color>(); foreach (var effect in AllEffects) { if (effect.UpdateTimer(Time.deltaTime) && effect.Source is TowerBase tower) { var damage = effect switch { PoisonEffect _ => effect.Amount.Value, BleedEffect _ => Health *effect.Amount.Value / 100f, _ => 0f }; tower.EnemyAttacked(Math.Min(damage, Health)); if (UpdateHealth(-damage)) { tower.EnemyKilled(this); } } statusColors[effect.Name] = effect.StatusColor; } var index = 0; foreach (var statusColor in statusColors.Values) { _statusIndicators[index].color = statusColor; _statusIndicators[index].enabled = true; index++; } for (var i = index; i < _statusIndicators.Length; i++) { _statusIndicators[i].enabled = false; } }
void CreatePotionEffect(Vector3 position) { if (potionId == 0) { SmokeEffect smokepuff = Instantiate(GM.smokepuff) as SmokeEffect; smokepuff.transform.position = position; } if (potionId == 1) { FireballEffect fireball = Instantiate(GM.fireball) as FireballEffect; fireball.transform.position = position; if (enhancedRadius) { fireball.radius *= 2; } } if (potionId == 2) { TornadoEffect tornado = Instantiate(GM.tornado) as TornadoEffect; tornado.transform.position = position; if (enhancedRadius) { tornado.radius *= 2; } } if (potionId == 3) { BlizzardEffect blizzard = Instantiate(GM.blizzard) as BlizzardEffect; blizzard.transform.position = position; if (enhancedRadius) { blizzard.radius *= 2; } } if (potionId == 4) { LightningEffect lightning = Instantiate(GM.lightning) as LightningEffect; lightning.transform.position = position; if (enhancedRadius) { lightning.radius *= 2; } } if (potionId == 5) { ArcaneEffect arcane = Instantiate(GM.arcane) as ArcaneEffect; arcane.transform.position = position; if (enhancedRadius) { arcane.radius *= 2; } } if (potionId == 6) { PoisonEffect poison = Instantiate(GM.poison) as PoisonEffect; poison.transform.position = position; if (enhancedRadius) { poison.radius *= 2; } } PlaySound(source, sounds[1], true); StartCoroutine("DelayForDestroySelf"); foreach (Transform child in transform) { if (child.GetComponent <Renderer>()) { child.GetComponent <Renderer>().enabled = false; } } }
// Taken from DaggerfallWorkshop.Game.DaggerfallUI::CreateHealthStatusBox() private string GetActiveEffectsMessage() { // Show "You are healthy." if there are no diseases and no poisons int diseaseCount = GameManager.Instance.PlayerEffectManager.DiseaseCount; int poisonCount = GameManager.Instance.PlayerEffectManager.PoisonCount; if (diseaseCount > 0 || poisonCount > 0) { //Debug.Log(string.Format("ActiveEffects: {0} diseases, {1} poisons", diseaseCount, poisonCount)); List <string> messages = new List <string>(); EntityEffectManager playerEffectManager = GameManager.Instance.PlayerEffectManager; LiveEffectBundle[] bundles = playerEffectManager.EffectBundles; foreach (LiveEffectBundle bundle in bundles) { foreach (IEntityEffect effect in bundle.liveEffects) { if (effect is DiseaseEffect) { string diseaseType; DiseaseEffect disease = (DiseaseEffect)effect; if (effect is LycanthropyInfection) { diseaseType = "Lycanthropy"; } else if (effect is VampirismInfection) { diseaseType = "Vampirism"; } else { diseaseType = ((Diseases)((int)disease.ClassicDiseaseType)).ToString(); } if (disease.IncubationOver) { messages.Add( string.Format( "You have contracted {0}", diseaseType ) ); } else { messages.Add( string.Format( "{0} is slowly creeping over you", diseaseType ) ); } } else if (effect is PoisonEffect) { PoisonEffect poison = (PoisonEffect)effect; Poisons poisonType = (Poisons)poison.CurrentVariant + 128; if (poison.CurrentState != PoisonEffect.PoisonStates.Waiting) { messages.Add( string.Format( "You have {0} coursing through your veins", poisonType.ToString() ) ); } else { messages.Add( string.Format( "{0} is slowly seeping through your veins", poisonType.ToString() ) ); } } } } if (messages.Count > 0) { return(string.Join("\n", messages.ToArray())); } } return(""); }