Ejemplo n.º 1
0
        public void Comportement()
        {
            Monde monde = new Monde(new FlatGenerateur(new Noise()));

            monde.GenerateChunk(0, 0);
            monde.SetBlock(1, 0, new Terre_Block());
            monde.SetBlock(2, 1, new Terre_Block());
            monde.SetBlock(2, 2, new Terre_Block());
            Zombie z = new Zombie(0, 0);
            Joueur j = new Joueur(10, 0);

            monde.Entites.Add(z);

            Assert.IsFalse(z.Comportement(monde));

            monde.Entites.Add(j);

            Assert.AreEqual(z.X, 0);
            Assert.AreEqual(z.Y, 0);

            Assert.IsTrue(z.Comportement(monde));

            Assert.AreEqual(z.X, 0.5f);
            Assert.AreEqual(z.Y, 0);

            Assert.IsTrue(z.Comportement(monde));

            Assert.AreEqual(z.X, 1);
            Assert.AreEqual(z.Y, 1);

            Assert.IsFalse(z.Comportement(monde));

            Assert.AreEqual(z.X, 1);
            Assert.AreEqual(z.Y, 1);
        }