コード例 #1
0
        public void BulletInteractionTest()
        {
            GunBullet testedBullet = new GunBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));

            GunBullet someGunBullet   = new GunBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));
            AEntity   someLaserBullet = new LaserBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));

            List <AEntity> gunBullIntRes   = testedBullet.Interaction(someGunBullet);
            List <AEntity> laserBullIntRes = testedBullet.Interaction(someLaserBullet);


            Assert.AreEqual(null, gunBullIntRes);
            Assert.AreEqual(null, laserBullIntRes);

            Assert.IsFalse(testedBullet.WasKilled);
        }
コード例 #2
0
        public void EnemyInteractionTest()
        {
            GunBullet firstTestedGunBullet  = new GunBullet(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));
            GunBullet secondTestedGunBullet = new GunBullet(new CoupleDouble(2, 2), new CoupleDouble(2, 2), new CoupleDouble(-1, -1));

            Ufo      someUfo      = new Ufo(new CoupleDouble(1, 1), new CoupleDouble(1, 1), new CoupleDouble(-1, -1));
            Asteroid someAsteroid = new Asteroid(new CoupleDouble(2, 2), new CoupleDouble(2, 2), new CoupleDouble(-1, -1));

            List <AEntity> interUfoResult    = firstTestedGunBullet.Interaction(someUfo);
            List <AEntity> interaAsterResult = secondTestedGunBullet.Interaction(someAsteroid);

            Assert.AreEqual(null, interUfoResult);
            Assert.AreEqual(null, interaAsterResult);

            Assert.IsTrue(firstTestedGunBullet.WasKilled);
            Assert.IsTrue(secondTestedGunBullet.WasKilled);
        }