protected override void Awake() { base.Awake(); Debug.Log("In numbered output awake"); InConnectors.AddRange(Enumerable.Repeat <SPConnector>(null, 1)); // Set up connector InConnector = Instantiate(SPInConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(InConnector); InConnector.gameObject.name = "InConnector"; InConnector.transform.localPosition = new Vector3(-1, 0, -1); InConnector.Register(this, SPConnectorType.SPInConnector, 0); LogicComponent = new Output(); try { this.id = Canvas.AddNumberedComponent(this); } catch (NoMoreIdsException) { // Failed to add this component as a numbered component. // Just leave its id as 0. this.id = 0; Canvas.Circuit.AddComponent(LogicComponent); } }
protected override void Awake() { base.Awake(); InConnectors.AddRange(Enumerable.Repeat <SPConnector>(null, 1)); OutConnectors.AddRange(Enumerable.Repeat <SPConnector>(null, 2)); // Set up connectors InConnector = Instantiate(SPInConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(InConnector); InConnector.gameObject.name = "InConnector"; InConnector.transform.localPosition = new Vector3(-1, 0, -1); InConnector.Register(this, SPConnectorType.SPInConnector, 0); OutConnectorTop = Instantiate(SPOutConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(OutConnectorTop); OutConnectorTop.gameObject.name = "OutConnectorTop"; OutConnectorTop.transform.localPosition = new Vector3(1, 1, -1); OutConnectorTop.Register(this, SPConnectorType.SPOutConnector, 0); OutConnectorBottom = Instantiate(SPOutConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(OutConnectorBottom); OutConnectorBottom.gameObject.name = "OutConnectorBottom"; OutConnectorBottom.transform.localPosition = new Vector3(1, -1, -1); OutConnectorBottom.Register(this, SPConnectorType.SPOutConnector, 1); LogicComponent = new Splitter(); Canvas.Circuit.AddComponent(LogicComponent); }
protected override void Awake() { base.Awake(); InConnectors.AddRange(Enumerable.Repeat <SPConnector>(null, 1)); // Set up connector InConnector = Instantiate(SPInConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(InConnector); InConnector.gameObject.name = "InConnector"; InConnector.transform.localPosition = new Vector3(-1, 0, -1); InConnector.Register(this, SPConnectorType.SPInConnector, 0); LogicComponent = new Output(); Canvas.Circuit.AddComponent(LogicComponent); spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); }