| 1 | using System; |
| 2 | using System.Collections; |
| 3 | using System.Collections.Generic; |
| 4 | using UnityEngine; |
| 5 | |
| 6 | public class Connector : MonoBehaviour |
| 7 | { |
| 8 | public Connectable Connected { get; private set; } |
| 9 | public Transform ConnectionPoint; |
| 10 | |
| 11 | public void Connect(Connectable conn) |
| 12 | { |
| 13 | Connected = conn; |
| 14 | } |
| 15 | |
| 16 | public void Disconnect(Connectable conn) |
| 17 | { |
| 18 | if (conn != Connected) |
| 19 | throw new InvalidOperationException("Wrong object disconnected"); |
| 20 | |
| 21 | Connected = null; |
| 22 | } |
| 23 | } |