Ejemplo n.º 1
0
 public override void dequip()
 {
     if (base.channel.isOwner)
     {
         for (int i = 0; i < this.chargesInRadius.Count; i++)
         {
             InteractableCharge interactableCharge = this.chargesInRadius[i];
             interactableCharge.unhighlight();
         }
     }
 }
Ejemplo n.º 2
0
 public override void tick()
 {
     if (base.channel.isOwner)
     {
         if ((base.transform.position - this.chargePoint).sqrMagnitude > 1f)
         {
             this.chargePoint = base.transform.position;
             this.foundInRadius.Clear();
             PowerTool.checkInteractables <InteractableCharge>(this.chargePoint, 64f, this.foundInRadius);
             for (int i = this.chargesInRadius.Count - 1; i >= 0; i--)
             {
                 InteractableCharge interactableCharge = this.chargesInRadius[i];
                 if (interactableCharge == null)
                 {
                     this.chargesInRadius.RemoveAtFast(i);
                 }
                 else if (!this.foundInRadius.Contains(interactableCharge))
                 {
                     interactableCharge.unhighlight();
                     this.chargesInRadius.RemoveAtFast(i);
                 }
             }
             for (int j = 0; j < this.foundInRadius.Count; j++)
             {
                 InteractableCharge interactableCharge2 = this.foundInRadius[j];
                 if (!(interactableCharge2 == null))
                 {
                     if (interactableCharge2.hasOwnership)
                     {
                         if (!this.chargesInRadius.Contains(interactableCharge2))
                         {
                             interactableCharge2.highlight();
                             this.chargesInRadius.Add(interactableCharge2);
                         }
                     }
                 }
             }
         }
         InteractableCharge interactableCharge3 = null;
         float num = 0.98f;
         for (int k = 0; k < this.chargesInRadius.Count; k++)
         {
             InteractableCharge interactableCharge4 = this.chargesInRadius[k];
             if (!(interactableCharge4 == null))
             {
                 float num2 = Vector3.Dot((interactableCharge4.transform.position - MainCamera.instance.transform.position).normalized, MainCamera.instance.transform.forward);
                 if (num2 > num)
                 {
                     interactableCharge3 = interactableCharge4;
                     num = num2;
                 }
             }
         }
         if (interactableCharge3 != this.target)
         {
             if (this.target != null)
             {
                 this.target.untarget();
             }
             this.target = interactableCharge3;
             if (this.target != null)
             {
                 this.target.target();
             }
         }
     }
 }