UpdateItems() public method

public UpdateItems ( IAtlas atlas, TilesetTable table ) : void
atlas IAtlas
table World.GameActors.Tiles.TilesetTable
return void
示例#1
0
        //
        // TODO: methods below will be moved to some physics class
        //


        #region Updating

        public void Update()
        {
            UpdateTime();
            UpdateScheduled();
            UpdateLayers();
            UpdateAvatars();
            UpdateCharacters();
            AutoupdateRegister.UpdateItems(Atlas, TilesetTable);
            UpdatePhysics();
            UpdateAtmosphere();
            //Log.Instance.Debug("World.ToyWorldCore.ToyWorld: ===================Step performed======================");
        }
示例#2
0
 private void UpdateScheduled()
 {
     TileDetectorRegister.Update();
     AutoupdateRegister.UpdateItems(Atlas);
     AutoupdateRegister.Tick();
 }
        public void TestUpdateItems()
        {
            Mock<IAtlas> mockAtlas = new Mock<IAtlas>();

            AutoupdateRegister register = new AutoupdateRegister();
            Mock<IAutoupdateableGameActor> mock1 = new Mock<IAutoupdateableGameActor>();
            mock1.Setup(x => x.Update(It.IsAny<IAtlas>(), It.IsAny<TilesetTable>()));
            Mock<IAutoupdateableGameActor> mock2 = new Mock<IAutoupdateableGameActor>();
            mock2.Setup(x => x.Update(It.IsAny<IAtlas>(), It.IsAny<TilesetTable>()));
            register.Register(mock1.Object, 1);
            register.Register(mock2.Object, 2);

            // Act
            register.Tick();
            register.UpdateItems(mockAtlas.Object, It.IsAny<TilesetTable>());

            // Assert
            mock1.Verify(x => x.Update(It.IsAny<IAtlas>(), It.IsAny<TilesetTable>()));
            mock2.Verify(x => x.Update(It.IsAny<IAtlas>(), It.IsAny<TilesetTable>()), Times.Never());

            // Act
            register.Tick();
            register.UpdateItems(mockAtlas.Object, It.IsAny<TilesetTable>());

            // Assert
            mock2.Verify(x => x.Update(It.IsAny<IAtlas>(), It.IsAny<TilesetTable>()));
        }