| 1 | using System.Collections; |
| 2 | using System.Collections.Generic; |
| 3 | using UnityEngine; |
| 4 | |
| 5 | public abstract class ModuleBase : MonoBehaviour |
| 6 | { |
| 7 | protected abstract bool TestCorrectness(); |
| 8 | public bool ModuleFinalized { get; private set; } |
| 9 | [SerializeField] private ModuleStatusLight StatusLight; |
| 10 | |
| 11 | void LateUpdate() |
| 12 | { |
| 13 | if(!ModuleFinalized) |
| 14 | { |
| 15 | ModuleFinalized = TestCorrectness(); |
| 16 | |
| 17 | if(ModuleFinalized) |
| 18 | { |
| 19 | Connector[] connected = GetComponentsInChildren<Connector>(); |
| 20 | |
| 21 | foreach(Connector conn in connected) |
| 22 | { |
| 23 | if(conn.Connected != null) |
| 24 | conn.Connected.Locked = true; |
| 25 | } |
| 26 | |
| 27 | StatusLight.SetStatus(true); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | } |