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(); } }
public void SendRefreshSignal(PowerSocket requestSource) { oppositePlug.SendRefreshSignal(this); }