Пример #1
0
 /*
  * Remove a target, regardless of it being a pull or push target.
  */
 public bool RemoveTarget(Magnetic target, bool startWithPullTargets = false)
 {
     // Try to remove target from both arrays, if necessary
     if (startWithPullTargets)
     {
         if (PullTargets.RemoveTarget(target))
         {
             return(true);
         }
         else
         {
             return(PushTargets.RemoveTarget(target));
         }
     }
     else
     {
         if (PushTargets.RemoveTarget(target))
         {
             return(true);
         }
         else
         {
             return(PullTargets.RemoveTarget(target));
         }
     }
 }
Пример #2
0
    /*
     * Add a target
     * If it's a pullTarget, remove it from pullTargets and move it to pushTargets
     */
    public void AddPushTarget(Magnetic target)
    {
        StartBurning(false);
        if (HasSteel)
        {
            if (VacuouslyPushTargeting)
            {
                SetVacuousTarget(null, steel);
            }

            if (PullTargets.IsTarget(target))
            {
                PullTargets.RemoveTarget(target, false);
            }
            if (target != null)
            {
                if (PushTargets.AddTarget(target, this))
                {
                    CalculateForce(target, PushTargets.NetCharge(), PushTargets.SumOfCharges(), steel);
                }
            }
        }
    }
Пример #3
0
 public bool RemovePullTarget(Magnetic target)
 {
     return(PullTargets.RemoveTarget(target));
 }