Esempio n. 1
0
 private static void DealDamageToPosition(IZone zone, Position location, double damage)
 {
     using (new TerrainUpdateMonitor(zone))
     {
         zone.DamageToPlantOnArea(Area.FromRadius(location, 1), damage / 2);
     }
 }
Esempio n. 2
0
        public static void DoAoeDamage(this IZone zone, IBuilder <DamageInfo> damageBuilder)
        {
            var damageInfo = damageBuilder.Build();
            var units      = zone.Units.WithinRange(damageInfo.sourcePosition, damageInfo.Range);

            foreach (var unit in units)
            {
                var losResult = zone.IsInLineOfSight(damageInfo.attacker, unit, false);
                if (losResult.hit)
                {
                    continue;
                }

                unit.TakeDamage(damageInfo);
            }

            using (new TerrainUpdateMonitor(zone))
            {
                zone.DamageToPlantOnArea(damageInfo);
            }
        }