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