Esempio n. 1
0
        public void BeltItemSlotProcessorCheck()
        {
            // Arrange
            List <List <BeltItemSlot> > dummyBeltItemSlotGroup = new List <List <BeltItemSlot> >();

            dummyBeltItemSlotGroup.Add(new List <BeltItemSlot>());
            dummyBeltItemSlotGroup[0].Add(new BeltItemSlot(Vector3.zero));
            dummyBeltItemSlotGroup[0].Add(new BeltItemSlot(Vector3.zero));
            BeltItemSlot.ConnectBeltItemSlots(dummyBeltItemSlotGroup[0][0], dummyBeltItemSlotGroup[0][1]);

            ObjectPoolSimple <BeltItem> dummyItemPool = new ObjectPoolSimple <BeltItem>(1, 1);

            dummyItemPool.SetUp();
            dummyBeltItemSlotGroup[0][0].myItem = dummyItemPool.Spawn();


            List <BeltPreProcessor.BeltGroup> dummyBeltGroup = new List <BeltPreProcessor.BeltGroup>();

            BeltPreProcessor.BeltGroup newGroup = new BeltPreProcessor.BeltGroup();
            newGroup.beltItemSlotGroups = dummyBeltItemSlotGroup;
            dummyBeltGroup.Add(newGroup);

            BeltItemSlotUpdateProcessor myBeltItemSlotUpdateProcessor = new BeltItemSlotUpdateProcessor(dummyItemPool, dummyBeltGroup);

            // Act
            myBeltItemSlotUpdateProcessor.UpdateBeltItemSlots();

            // Assert
            Assert.IsNull(dummyBeltItemSlotGroup[0][0].myItem);
            Assert.IsNotNull(dummyBeltItemSlotGroup[0][1].myItem);
        }
Esempio n. 2
0
        public void BeltItemSlotProcessorCheck()
        {
            // Arrange
            List <List <BeltItemSlot> > dummyBeltItemSlotGroup = new List <List <BeltItemSlot> >();

            dummyBeltItemSlotGroup.Add(new List <BeltItemSlot>());
            dummyBeltItemSlotGroup[0].Add(new BeltItemSlot(Vector3.zero));
            dummyBeltItemSlotGroup[0].Add(new BeltItemSlot(Vector3.zero));
            BeltItemSlot.ConnectBelts(dummyBeltItemSlotGroup[0][0], dummyBeltItemSlotGroup[0][1]);

            List <BeltItem> beltItems = new List <BeltItem>();

            beltItems.Add(new GameObject().AddComponent <BeltItem>().GetComponent <BeltItem>());
            dummyBeltItemSlotGroup[0][0].myItem = beltItems[0];
            beltItems[0].mySlot = dummyBeltItemSlotGroup[0][0];

            BeltItemSlotUpdateProcessor myBeltItemSlotUpdateProcessor = new BeltItemSlotUpdateProcessor(beltItems, dummyBeltItemSlotGroup);

            // Act
            myBeltItemSlotUpdateProcessor.UpdateBeltItemSlots();

            // Assert
            Assert.IsNull(dummyBeltItemSlotGroup[0][0].myItem);
            Assert.IsNotNull(dummyBeltItemSlotGroup[0][1].myItem);
        }
Esempio n. 3
0
    IEnumerator BeltItemSlotUpdateLoop()
    {
        while (true)
        {
            beltItemSlotProc.UpdateBeltItemSlots();

            yield return(new WaitForSeconds(1f / beltUpdatePerSecond));
        }
    }
Esempio n. 4
0
    IEnumerator BeltItemSlotUpdateLoop()
    {
        while (true)
        {
            beltItemSlotProc.UpdateBeltItemSlots();

            ApplyPositionsToEntities();

            CreateItems();

            DestroyItems();


            //BeltItemGfxUpdateProcessor.UpdateBeltItemPositions();

            yield return(new WaitForSeconds(1f / beltUpdatePerSecond));
        }
    }