Ejemplo n.º 1
0
 public override void Update()
 {
     base.Update();
     foreach (Unit unit in Game.Unit_List)
     {
         if (unit == Caster)
         {
             continue;
         }
         IPair delta  = Pos - unit.Pos;
         int   radius = (RADIUS + unit.Radius) * GameDef.PIXEL_SCALE;
         if (delta.LengthSquare() > radius * radius || delta.Zero())
         {
             continue;
         }
         delta.ChangeLength(STRENGTH);
         unit.AddRepulse(delta);
     }
     foreach (Missile missile in Game.Missile_List)
     {
         if (missile.Caster == Caster)
         {
             continue;
         }
         IPair delta  = Pos - missile.Pos;
         int   radius = (RADIUS + missile.Radius) * GameDef.PIXEL_SCALE;
         if (delta.LengthSquare() > radius * radius || delta.Zero())
         {
             continue;
         }
         delta.ChangeLength(STRENGTH);
         missile.AddRepulse(delta);
     }
 }