private void OnCablePickedUpByOther() { // Remove cable from socket. if (this.insertedCable != null) { this.insertedCable.SetConnection(null, null); this.insertedCable = null; } }
private void OnTriggerEnter(Collider other) { if (this.insertedCable != null) { return; } // Atach cable to this socket. MoveableCableEnd cableEnd = other.GetComponent <MoveableCableEnd>(); if (cableEnd != null) { if (cableEnd == this.insertedCable) { return; } this.insertedCable = cableEnd; this.insertedCable.Pickup(this.transform, Vector3.zero, false, false, this.OnCablePickedUpByOther); this.insertedCable.SetConnection(this.controllerUnit, this); } }
private void InitialiseCableEnd(MoveableCableEnd cableEnd) { cableEnd.AddConnectionMadeCallback(this.OnConnectionMade); cableEnd.AddConnectionRemovedCallback(this.OnConnectionRemoved); }