public void HitMinion(TDMinion unit, float dmgMultiplier = 1f) { if (unit.ApplyDmg(dmg * dmgMultiplier, _elementList)) { ResourceOverview.Instance.Gold.Value += 5 * moneyOnKill; } unit.ApplySlow(slowIntesity); ResourceOverview.Instance.Gold.Value += (int)moneyOnHit; }
private void AttackUnits(List <TDMinion> minionsInRange) { var thurisaz = Marker.GetUpgradeRunes().OfType <Thurisaz>().ToList(); var sowilo = Marker.GetUpgradeRunes().OfType <Sowilo>().ToList(); if (thurisaz.Any()) //ground attack { var rangeMultiplier = Mathf.Pow(1.5f, thurisaz.Count); minionsInRange = minionsInRange.Where(minion => (minion.transform.position - transform.position).magnitude < Range * rangeMultiplier * 0.2f).ToList(); foreach (var minion in minionsInRange) { HitMinion(minion); } currentCooldown *= 2; var proj = GameObject.CreatePrimitive(PrimitiveType.Cylinder); proj.name = "AoE"; proj.transform.position = transform.position + Vector3.up * 3; proj.transform.localScale = new Vector3(Range * rangeMultiplier * 0.2f * 2, 0.1f, Range * rangeMultiplier * 0.2f * 2); proj.AddComponent <AoE>(); } else if (sowilo.Any()) { if (BeamTarget == null) { BeamTarget = minionsInRange.OrderByDescending(m => m.DistanceMoved).First(); BeamMultiplier = 0.5f; } HitMinion(BeamTarget, BeamMultiplier); BeamMultiplier *= Mathf.Pow(1.1f, sowilo.Count); currentCooldown *= 0.2f; } else // projectile { var tdMinion = minionsInRange.OrderByDescending(m => m.DistanceMoved).First(); var proj = GameObject.CreatePrimitive(PrimitiveType.Sphere); proj.name = "Projectile"; proj.transform.position = transform.position + Vector3.up * 15; proj.transform.localScale = Vector3.one * 0.7f; proj.AddComponent <Projectile>().Init(tdMinion.gameObject, this, splashRadius, atkspeed); } }