Exemplo n.º 1
0
 // Assign a vacuous target when none others are selected.
 // If target is null, stop vacuously targeting.
 protected void SetVacuousTarget(Magnetic target, bool usingIron = true)
 {
     if (target == null)
     {
         if (usingIron)
         {
             RemovePullTargetAt(0);
             VacuousPullTarget = null;
         }
         else
         {
             RemovePushTargetAt(0);
             VacuousPushTarget = null;
         }
     }
     else
     {
         if (usingIron)
         {
             RemovePullTargetAt(0);
             VacuousPullTarget = target;
             PullTargets.AddTarget(target, this);
         }
         else
         {
             RemovePushTargetAt(0);
             VacuousPushTarget = target;
             PushTargets.AddTarget(target, this);
         }
     }
 }
Exemplo n.º 2
0
    /*
     * Add a target
     * If it's a pushTarget, remove it from pushTargets and move it to pullTargets
     */
    public void AddPullTarget(Magnetic target)
    {
        StartBurning(true);
        if (HasIron)
        {
            if (VacuouslyPullTargeting)
            {
                SetVacuousTarget(null, iron);
            }

            if (PushTargets.IsTarget(target))
            {
                PushTargets.RemoveTarget(target, false);
            }
            if (target != null)
            {
                if (PullTargets.AddTarget(target, this))
                {
                    CalculateForce(target, PullTargets.NetCharge(), PullTargets.SumOfCharges(), iron);
                }
            }
        }
    }