예제 #1
0
        public void Update_Walking_Right_Colliding_Go_Down()
        {
            var enemy1            = new Enemy1((centerCell + Directions.Right) * ENEMY_CELL_SIZE, 0);
            var contentHelperMock = new Mock <IContentHelper>();

            enemy1.LoadContent(contentHelperMock.Object);

            var onScreenEnemies = new List <IEnemy>();
            var gameMap         = GetDummyMap();

            enemy1.PixelsPerSec = ENEMY_PIXEL_SIZE;
            enemy1.Direction    = Directions.Right;
            enemy1.Update(new GameTime(TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(0)), 0, 0f, onScreenEnemies, gameMap);
            enemy1.Update(new GameTime(TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(1000)), 0, 0f, onScreenEnemies, gameMap);
            Assert.AreEqual(Directions.Down, enemy1.Direction);
        }
예제 #2
0
        public void Update_Walking_Left_Position_Changes()
        {
            var enemy1            = new Enemy1(centerCell * ENEMY_CELL_SIZE, 0);
            var contentHelperMock = new Mock <IContentHelper>();

            enemy1.LoadContent(contentHelperMock.Object);

            var onScreenEnemies = new List <IEnemy>();
            var gameMap         = GetDummyMap();

            enemy1.PixelsPerSec = ENEMY_PIXEL_SIZE;
            enemy1.Direction    = Directions.Left;
            Assert.AreEqual(centerCell * enemy1.Size, enemy1.Position);
            enemy1.Update(new GameTime(TimeSpan.FromMilliseconds(0), TimeSpan.FromMilliseconds(0)), 0, 0f, onScreenEnemies, gameMap);
            Assert.AreEqual(centerCell * enemy1.Size, enemy1.Position);
            enemy1.Update(new GameTime(TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(1000)), 0, 0f, onScreenEnemies, gameMap);
            Assert.AreEqual((centerCell + Directions.Left) * enemy1.Size, enemy1.Position);
        }
예제 #3
0
        public void Update_UpdateScrollRows()
        {
            var enemy1            = new Enemy1(centerCell * ENEMY_CELL_SIZE, 0);
            var contentHelperMock = new Mock <IContentHelper>();

            enemy1.LoadContent(contentHelperMock.Object);

            var onScreenEnemies = new List <IEnemy>();
            var gameMap         = GetDummyMap();

            Assert.AreEqual(0, enemy1.ScrollRows);
            enemy1.Update(new GameTime(new TimeSpan(0), new TimeSpan(0)), 0, 0f, onScreenEnemies, gameMap);
            Assert.AreEqual(0, enemy1.ScrollRows);
            enemy1.Update(new GameTime(new TimeSpan(0), new TimeSpan(0)), 0, 1.7f, onScreenEnemies, gameMap);
            Assert.AreEqual(1.7f, enemy1.ScrollRows);
            enemy1.Update(new GameTime(new TimeSpan(0), new TimeSpan(0)), 0, 49.3f, onScreenEnemies, gameMap);
            Assert.AreEqual(49.3f, enemy1.ScrollRows);
        }
예제 #4
0
        public void Update()
        {
            var enemy1            = new Enemy1(centerCell, 0);
            var contentHelperMock = new Mock <IContentHelper>();

            enemy1.LoadContent(contentHelperMock.Object);
            enemy1.Update(new GameTime(new TimeSpan(0), new TimeSpan(0)), 0, 0f);
            Assert.AreEqual(CharacterState.Alive, enemy1.State);
        }