BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / GAME / Scripts / ModuleBase.cs

ModuleBase.cs

92128f09 History
ModuleBase.cs 1016 B Download Raw
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public abstract class ModuleBase : MonoBehaviour
6{
7 protected abstract bool TestCorrectness();
8 public bool ModuleFinalized { get; private set; }
9 [SerializeField] private ModuleStatusLight StatusLight;
10
11 public void EjectComponents()
12 {
13 Connector[] connected = GetComponentsInChildren<Connector>();
14
15 foreach (Connector conn in connected)
16 {
17 conn.Eject();
18 }
19 }
20
21 void LateUpdate()
22 {
23 if(!ModuleFinalized)
24 {
25 ModuleFinalized = TestCorrectness();
26
27 if(ModuleFinalized)
28 {
29 Connector[] connected = GetComponentsInChildren<Connector>();
30
31 foreach(Connector conn in connected)
32 {
33 if(conn.Connected != null)
34 conn.Connected.Locked = true;
35 }
36
37 StatusLight.SetStatus(true);
38 }
39 }
40 }
41}