Exemplo n.º 1
0
 public void splashDamage(Vector3 position, float size, float damage)
 {
     foreach (Agent a in core.allAgents())
     {
         if (a.spawnTime > 0)
         {
             continue;
         }
         BoundingBox bb   = a.getBoundingBox();
         Vector3     cent = bb.Min + (bb.Max - bb.Min) * 0.5f;
         float       dist = Vector3.Distance(cent, position);
         if (dist < size)
         {
             //do hitscan check
             HitScan hs = hitscan(position, cent - position, null);
             if (hs == null || hs.Distance() > dist)
             {
                 a.health -= (int)Math.Ceiling(damage * Math.Pow(1 - dist / size, 0.5));
             }
         }
     }
 }