protected override void Awake() { base.Awake(); OutConnectors.AddRange(Enumerable.Repeat <SPConnector>(null, 1)); // Set up renderer SpriteRenderer = gameObject.GetComponent <SpriteRenderer>(); CurrentSpriteIndex = 0; // Set up connectors OutConnector = Instantiate(SPOutConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(OutConnector); OutConnector.gameObject.name = "OutConnector"; OutConnector.transform.localPosition = new Vector3(1, 0, -1); OutConnector.Register(this, SPConnectorType.SPOutConnector, 0); MessageBoxFactory = new UIMessageBoxFactory(); // Load the message box config for save ciruit TextAsset configAsset = Resources.Load <TextAsset>(CLOCK_MESSAGE_BOX_CONFIG_RESOURCE); Assert.IsNotNull(configAsset); ClockMessageBoxConfig = JsonUtility.FromJson <MessageBoxConfig>(configAsset.text); LogicComponent = new Clock(DEFAULT_CLOCK_RATE); Canvas.Circuit.AddComponent(LogicComponent); Assert.AreEqual(CLOCK_SPRITES_COUNT, UnselectedClockSprites.Count); Assert.AreEqual(CLOCK_SPRITES_COUNT, SelectedClockSprites.Count); }
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(); Debug.Log("In numbered input awake"); OutConnectors.AddRange(Enumerable.Repeat <SPConnector>(null, 1)); // Set up connectors OutConnector = Instantiate(SPOutConnectorPrefab, gameObject.transform, false); Assert.IsNotNull(OutConnector); OutConnector.gameObject.name = "OutConnector"; OutConnector.transform.localPosition = new Vector3(1, 0, -1); OutConnector.Register(this, SPConnectorType.SPOutConnector, 0); LogicComponent = new InputComponent(); 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); } }