コード例 #1
0
        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);
            }
        }