void Awake() { if (transform.parent != null && transform.parent.gameObject.layer == 5) { return; } // don't do this in the UI cuz it won't be visible ChildInputs = GetComponentsInChildren <CircuitInput>(); if (GetComponentInChildren <Wire>()) { return; } // if it's on a cloned board it'll already have a wire InputInputConnection connection = Instantiate(References.Prefabs.Wire, transform).AddComponent <InputInputConnection>(); connection.Input1 = ChildInputs[0]; connection.Input2 = ChildInputs[1]; connection.DrawWire(); connection.unbreakable = true; StuffConnector.LinkConnection(connection); DestroyImmediate(connection.GetComponent <BoxCollider>()); }
protected override void CircuitLogicUpdate() { var ChildInputs = GetComponentsInChildren <CircuitInput>(); if (!this.Inputs[2].On && IIC != null) { StuffDeleter.DestroyIIConnection(IIC); IIC = null; } if (GetComponentsInChildren <Wire>().Length < 1 && this.Inputs[2].On) { InputInputConnection inputInputConnection = Instantiate(Prefabs.Wire, base.transform).AddComponent <InputInputConnection>(); inputInputConnection.Input1 = ChildInputs[0]; inputInputConnection.Input2 = ChildInputs[1]; inputInputConnection.DrawWire(); inputInputConnection.unbreakable = true; StuffConnector.LinkConnection(inputInputConnection); IIC = inputInputConnection; } }