Example #1
0
        public void Boss_UpdatePosition_Easy_IsEntering_Skip()
        {
            Boss_Easy boss = new Boss_Easy(3000, 80, 12, 2000, 2000);

            boss.UpdatePosition();

            Assert.IsTrue(boss.X == 2996);
            Assert.IsTrue(boss.Y == 80);
        }
Example #2
0
        public void Boss_Hit_StartupTrue_Success()
        {
            Boss_Easy boss = new Boss_Easy(600, 80, 12, 2000, 2000);

            boss.startup = true;
            boss.X       = 500;
            Assert.IsFalse(boss.Hit());
            Assert.IsFalse(boss.startup);
        }
Example #3
0
        public void Boss_UpdatePosition_Easy_AttackState_Success()
        {
            Boss_Easy boss = new Boss_Easy(100, 80, 2, 2000, 2000);

            boss.currentState = MState.Attack;

            Assert.IsTrue(boss.currentState == MState.Attack);
            Assert.IsTrue(boss.hitbox.X == Convert.ToInt32(boss.X));
            Assert.IsTrue(boss.hitbox.Y == Convert.ToInt32(boss.Y));
        }
Example #4
0
        public void Boss_UpdatePosition_Easy_MidState_Success()
        {
            Boss_Easy boss = new Boss_Easy(100, 80, 12, 2000, 2000);

            boss.isEntering = false;

            boss.currentState = MState.Mid;
            boss.UpdatePosition();

            Assert.IsTrue(boss.currentState == MState.Mid);
            Assert.IsTrue(boss.hitbox.X == Convert.ToInt32(boss.X));
            Assert.IsTrue(boss.hitbox.Y == Convert.ToInt32(boss.Y));
        }
Example #5
0
        public void Boss_Hit_Easy_Success()
        {
            Boss_Easy boss = new Boss_Easy(900, 80, 12, 2000, 2000);

            Assert.IsFalse(boss.Hit());

            boss.X       = 100;
            boss.startup = false;
            Assert.IsFalse(boss.Hit());
            Assert.IsTrue(boss.health == 11);

            boss.health = 1;
            Assert.IsTrue(boss.Hit());
            Assert.IsFalse(boss.alive);
        }
Example #6
0
        public void Boss_Easy_Mid_Success()
        {
            Boss_Easy boss = new Boss_Easy(100, 100, 20, 2000, 2000);

            boss.currentState = MState.Mid;

            boss.RecieveTrackerData(200, 200);
            boss.Y = 10;

            boss.UpdatePosition();

            Assert.IsTrue(boss.Y > 10);

            boss.Y = 300;

            boss.UpdatePosition();

            Assert.IsTrue(boss.Y < 300);
        }
Example #7
0
        public void Boss_Easy_Attack_Success()
        {
            Boss_Easy boss = new Boss_Easy(100, 100, 20, 2000, 2000);

            boss.currentState = MState.Attack;

            boss.UpdatePosition();

            Assert.IsTrue(boss.X < 100);
            Assert.IsFalse(boss.goingBackwards);

            boss.currentState = MState.Attack;

            boss.X = 0;
            boss.UpdatePosition();

            Assert.IsTrue(boss.goingBackwards);

            boss.currentState = MState.Attack;

            boss.X = 100;
            boss.UpdatePosition();

            Assert.IsTrue(boss.X > 100);

            boss.currentState = MState.Attack;

            boss.X = 1500;
            boss.UpdatePosition();

            Assert.IsFalse(boss.goingBackwards);
            Assert.IsTrue(boss.currentState == MState.Start);

            boss.currentState = MState.Attack;

            boss.health         = 5;
            boss.X              = 1500;
            boss.goingBackwards = true;
            boss.UpdatePosition();

            Assert.IsTrue(boss.currentState == MState.Mid);
        }
Example #8
0
        public void Boss_Easy_Start_Success()
        {
            Boss_Easy boss = new Boss_Easy(100, 100, 20, 2000, 2000);

            boss.UpdatePosition();

            Assert.IsTrue(boss.Y > 100);

            boss.Y = -1;
            boss.UpdatePosition();

            Assert.IsTrue(boss.Y < -1);
            Assert.IsTrue(boss.dir == -1);

            boss.Y = 2001;
            boss.UpdatePosition();

            Assert.IsTrue(boss.Y < 2001);
            Assert.IsTrue(boss.dir == -1);
        }
Example #9
0
        public void UpdateWorld_GC_Success()
        {
            if (Application.Current == null)
            {
                new Application {
                    ShutdownMode = ShutdownMode.OnExplicitShutdown
                };
            }

            GameController ctrl = new GameController();

            ctrl.player.X     = 100;
            ctrl.player.Y     = 100;
            ctrl.player.Lives = 5;
            ctrl.player.Bombs = 5;

            List <Entity> en = new List <Entity>();

            en.Add(new AI(10, 10, pattern.Straight));
            en.Add(new Mine(50, 10, pattern.Straight));
            en.Add(new Tracker(70, 10, pattern.Straight));
            en.Add(new Powerup(100, 100, PowerUp.RapidFire));
            en.Add(new Powerup(100, 100, PowerUp.ExtraLife));
            en.Add(new Powerup(100, 100, PowerUp.ExtraBomb));

            en.Add(new Powerup(200, 200, PowerUp.RapidFire));
            en.Add(new Powerup(200, 200, PowerUp.ExtraLife));
            en.Add(new Powerup(200, 200, PowerUp.ExtraBomb));
            Boss_Easy boss = new Boss_Easy(1000, 1000, 100, 2000, 2000);

            boss.action = true;
            en.Add(boss);


            AI shot = new AI(60, 60, pattern.Straight);

            shot.FiredABullet = true;
            en.Add(shot);

            Formation dead = new Formation(20, 20, pattern.Sin);

            dead.alive = false;
            en.Add(dead);

            en.Add(new AI(100, 100, pattern.Straight));//intersects with player

            ctrl.current_Enemies = en;

            List <Bullet> b = new List <Bullet>();

            b.Add(new Bullet(2, 9));
            b.Add(new Bullet(5, 9));
            b.Add(new Bullet(7, 9));
            b.Add(new Bullet(60, 60));   //shot enemy
            b.Add(new Bullet(200, 200)); //shot powerup
            Bullet deadbullet = new Bullet(20, 20);

            deadbullet.alive = false;
            b.Add(deadbullet);


            ctrl.player_fire = b;

            ctrl.UpdateWorld();

            Assert.IsTrue(ctrl.current_Enemies.Count == 1);
            Assert.IsTrue(ctrl.player_fire.Count == 0);
            Assert.IsTrue(ctrl.player.Lives == 6);
            Assert.IsTrue(ctrl.player.Bombs == 7);
        }