예제 #1
0
 public void SendRefreshSignal(PowerPlug requestSource)
 {
     if (connectedSocket != null)
     {
         connectedSocket.SendRefreshSignal(this);
     }
 }
예제 #2
0
 public void FindGenerators(PowerPlug requestSource)
 {
     if (connectedSocket != null)
     {
         connectedSocket.FindGenerators(this);
     }
 }
예제 #3
0
 public void RemoveGenerator(PowerGenerator gen, PowerPlug requestSource)
 {
     if (connectedSocket != null)
     {
         connectedSocket.RemoveGenerator(gen, this);
     }
 }
예제 #4
0
    public override void Interact(CharacterInteraction target)
    {
        // Connecting the cable
        if (target.CurrentHeldItem != null && target.CurrentHeldItem is PowerPlug)
        {
            target.Equipment.PlaceItem(plugPivotPoint.position, plugPivotPoint.rotation, plugPivotPoint);
            connectedPlug = (PowerPlug)target.CurrentHeldItem;
            if (connectedPlug != null)
            {
                connectedPlug.SetConnectedSocket(this);
                connectedPlug.SendRefreshSignal(this);
                //connectedPlug.FindGenerators(this);
            }
            connectedConduit.FindGenerators();
        }

        // Disconnecting the cable
        if (target.CurrentHeldItem == null && connectedPlug != null)
        {
            connectedPlug.ResetComponents();
            connectedPlug.Interact(target);
            connectedPlug.RemoveGenerator(connectedConduit.powerSource, this);
            connectedPlug.SetConnectedSocket(null);
            connectedPlug.SendRefreshSignal(this);
            //connectedPlug.FindGenerators(this);
            connectedPlug = null;
            connectedConduit.FindGenerators();
            connectedConduit.SendRefreshSignal();
        }
    }
예제 #5
0
 public void FindGenerators(PowerConduit source, PowerPlug requestSource)
 {
     if (connectedConduit != source)
     {
         connectedConduit.FindGenerators(source, this);
     }
 }
예제 #6
0
 public void ReleaseSelectedEnd(PowerPlug tar)
 {
     if (tar.primaryEnd && !secondaryPlug.IsConnected)
     {
         secondaryPlug.transform.SetParent(transform);
     }
     else if (!tar.primaryEnd && !primaryPlug.IsConnected)
     {
         primaryPlug.transform.SetParent(transform);
     }
     lastSelectedPlug = tar;
 }
예제 #7
0
    }                                         // If any end is being held by the player


    public void SetSelectedEnd(PowerPlug tar)
    {
        if (tar.primaryEnd && !secondaryPlug.IsConnected)
        {
            secondaryPlug.transform.parent = null;
        }
        else if (!tar.primaryEnd && !primaryPlug.IsConnected)
        {
            primaryPlug.transform.parent = null;
        }
        transform.SetParent(null);
        lastSelectedPlug = tar;
    }
예제 #8
0
 public void RemoveGenerator(PowerGenerator gen, PowerPlug requestSource)
 {
     connectedConduit.RemoveGenerator(gen, this);
 }
예제 #9
0
 public void FindGenerators(PowerPlug requestSource)
 {
     //Debug.Log(gameObject.name + " Received request");
     connectedConduit.FindGenerators();
 }
예제 #10
0
 public void SendRefreshSignal(PowerPlug requestSource)
 {
     connectedConduit.ReceiveRefreshSignal(this);
 }