DisconnectFromPylon() 개인적인 메소드

private DisconnectFromPylon ( Rot4 direction ) : void
direction Rot4
리턴 void
예제 #1
0
        private void TryToConnectToPylon(Building_LaserFencePylon linkedPylon, Rot4 direction, int fenceLength, bool forceConnection)
        {
            Rot4 linkedPylonDirection = direction;

            linkedPylonDirection.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction.
            linkedPylonDirection.Rotate(RotationDirection.Clockwise);
            // Check connection is allowed.
            if (forceConnection)
            {
                linkedPylon.connectionIsAllowedByUser[linkedPylonDirection.AsInt]       = true;
                linkedPylon.cachedConnectionIsAllowedByUser[linkedPylonDirection.AsInt] = true;
            }
            if (linkedPylon.connectionIsAllowedByUser[linkedPylonDirection.AsInt] == false)
            {
                this.connectionIsAllowedByUser[direction.AsInt]       = false;
                this.cachedConnectionIsAllowedByUser[direction.AsInt] = false;
                return;
            }
            // Check linkedPylon is powered.
            CompPowerTrader linkedPowerComp = linkedPylon.TryGetComp <CompPowerTrader>();

            if ((linkedPowerComp != null) &&
                linkedPowerComp.PowerOn)
            {
                if (linkedPylon.linkedPylons[linkedPylonDirection.AsInt] != null)
                {
                    // If linkedPylon is already connected to a third pylon, first disconnect from it.
                    linkedPylon.DisconnectFromPylon(linkedPylonDirection);
                }
                this.linkedPylons[direction.AsInt] = linkedPylon;
                this.ActivateFence(direction, fenceLength);
                linkedPylon.linkedPylons[linkedPylonDirection.AsInt] = this;
                linkedPylon.ActivateFence(linkedPylonDirection, fenceLength);
            }
        }
 private void TryToConnectToPylon(Building_LaserFencePylon linkedPylon, Rot4 direction, int fenceLength, bool forceConnection)
 {
     Rot4 linkedPylonDirection = direction;
     linkedPylonDirection.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction.
     linkedPylonDirection.Rotate(RotationDirection.Clockwise);
     // Check connection is allowed.
     if (forceConnection)
     {
         linkedPylon.connectionIsAllowedByUser[linkedPylonDirection.AsInt] = true;
         linkedPylon.cachedConnectionIsAllowedByUser[linkedPylonDirection.AsInt] = true;
     }
     if (linkedPylon.connectionIsAllowedByUser[linkedPylonDirection.AsInt] == false)
     {
         this.connectionIsAllowedByUser[direction.AsInt] = false;
         this.cachedConnectionIsAllowedByUser[direction.AsInt] = false;
         return;
     }
     // Check linkedPylon is powered.
     CompPowerTrader linkedPowerComp = linkedPylon.TryGetComp<CompPowerTrader>();
     if ((linkedPowerComp != null)
         && linkedPowerComp.PowerOn)
     {
         if (linkedPylon.linkedPylons[linkedPylonDirection.AsInt] != null)
         {
             // If linkedPylon is already connected to a third pylon, first disconnect from it.
             linkedPylon.DisconnectFromPylon(linkedPylonDirection);
         }
         this.linkedPylons[direction.AsInt] = linkedPylon;
         this.ActivateFence(direction, fenceLength);
         linkedPylon.linkedPylons[linkedPylonDirection.AsInt] = this;
         linkedPylon.ActivateFence(linkedPylonDirection, fenceLength);
     }
 }