Ejemplo n.º 1
0
        public void AvatarCanEat()
        {
            AvatarLoosingEnergy();

            m_eater.Interact = true;

            // Act
            m_eater.Update(m_worldPickupWorld.Atlas, It.IsAny <TilesetTable>());

            // Assert
            Assert.Equal(m_eater.Energy, 1);
            ILayer <GameActor> obstacleInteractableLayer = m_worldPickupWorld.Atlas.GetLayer(LayerType.ObstacleInteractable);

            Assert.Null(obstacleInteractableLayer.GetActorAt(2, 0));
        }
Ejemplo n.º 2
0
        public void AvatarCanLayDown()
        {
            AvatarCanPickUp();

            m_avatarPickuper.PickUp = true;

            // Act
            m_avatarPickuper.Update(m_worldPickupWorld.Atlas, It.IsAny <TilesetTable>());

            // Assert
            Assert.Null(m_avatarPickuper.Tool);
            ILayer <GameActor> obstacleInteractableLayer = m_worldPickupWorld.Atlas.GetLayer(LayerType.ObstacleInteractable);

            Assert.IsType <Apple>(obstacleInteractableLayer.GetActorAt(2, 0));
            Assert.False(m_avatarPickuper.PickUp);
        }
Ejemplo n.º 3
0
        public void AvatarCanPickUp()
        {
            Stream tmxStream = FileStreams.SmallPickupTmx();
            StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream());

            TmxSerializer serializer = new TmxSerializer();
            Map map = serializer.Deserialize(tmxStream);
            m_worldPickupWorld = new ToyWorld(map, tilesetTableStreamReader);

            m_avatarPickuper = m_worldPickupWorld.GetAvatar(m_worldPickupWorld.GetAvatarsIds()[0]);
            m_avatarPickuper.PickUp = true;

            Assert.Equal(null, m_avatarPickuper.Tool);

            // Act
            m_avatarPickuper.Update(m_worldPickupWorld.Atlas, It.IsAny<TilesetTable>());

            // Assert
            Assert.IsType<Apple>(m_avatarPickuper.Tool);
            Assert.False(m_avatarPickuper.PickUp);
        }
Ejemplo n.º 4
0
        public void AvatarLoosingEnergy()
        {
            Stream       tmxStream = FileStreams.SmallPickupTmx();
            StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream());

            TmxSerializer serializer = new TmxSerializer();
            Map           map        = serializer.Deserialize(tmxStream);

            m_worldPickupWorld = new ToyWorld(map, tilesetTableStreamReader);

            m_eater = m_worldPickupWorld.GetAvatar(m_worldPickupWorld.GetAvatarsIds()[0]);

            // Act
            for (int i = 0; i < 100; i++)
            {
                m_eater.Update(m_worldPickupWorld.Atlas, It.IsAny <TilesetTable>());
            }

            // Assert
            Assert.True(m_eater.Energy < 1);
        }
Ejemplo n.º 5
0
        public void AvatarCanPickUp()
        {
            Stream       tmxStream = FileStreams.SmallPickupTmx();
            StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream());

            TmxSerializer serializer = new TmxSerializer();
            Map           map        = serializer.Deserialize(tmxStream);

            m_worldPickupWorld = new ToyWorld(map, tilesetTableStreamReader);

            m_avatarPickuper        = m_worldPickupWorld.GetAvatar(m_worldPickupWorld.GetAvatarsIds()[0]);
            m_avatarPickuper.PickUp = true;

            Assert.Equal(null, m_avatarPickuper.Tool);

            // Act
            m_avatarPickuper.Update(m_worldPickupWorld.Atlas, It.IsAny <TilesetTable>());

            // Assert
            Assert.IsType <Apple>(m_avatarPickuper.Tool);
            Assert.False(m_avatarPickuper.PickUp);
        }
Ejemplo n.º 6
0
        public void AvatarLoosingEnergy()
        {
            Stream tmxStream = FileStreams.SmallPickupTmx();
            StreamReader tilesetTableStreamReader = new StreamReader(FileStreams.TilesetTableStream());

            TmxSerializer serializer = new TmxSerializer();
            Map map = serializer.Deserialize(tmxStream);
            m_worldPickupWorld = new ToyWorld(map, tilesetTableStreamReader);

            m_eater = m_worldPickupWorld.GetAvatar(m_worldPickupWorld.GetAvatarsIds()[0]);

            // Act
            for (int i = 0; i < 100; i++)
            {
                m_eater.Update(m_worldPickupWorld.Atlas, It.IsAny<TilesetTable>());
            }

            // Assert
            Assert.True(m_eater.Energy < 1);
        }