public void GoombaTestTop()
        {
            bool passed = true;

            EnemySpriteFactory.Load(game.Content);
            MarioSpriteFactory.Load(game.Content);
            IPlayer           mario             = new Mario(400, 400);
            IEnemyObject      enemy             = new Goomba(400, 415);
            CollisionDetector collisionDetector = new CollisionDetector();
            ICollision        side = collisionDetector.getCollision(mario.returnCollisionRectangle(), enemy.returnCollisionRectangle());

            if (passed && side.returnCollisionSide().Equals(CollisionSide.Top))
            {
                passed = true;
            }
            else
            {
                passed = false;
            }
            MarioEnemyCollisionHandler.handleCollision((Mario)mario, enemy, side, levelStorage);
            if (passed)
            {
                Console.WriteLine("Goomba Top Test Passed");
            }
            else
            {
                Console.WriteLine("Goomba Top Test failed");
            }
        }
        public void KoopaTestBottom()
        {
            bool passed = true;

            EnemySpriteFactory.Load(game.Content);
            MarioSpriteFactory.Load(game.Content);
            IPlayer           mario             = new Mario(400, 400);
            IEnemyObject      enemy             = new Koopa(400, 385);
            CollisionDetector collisionDetector = new CollisionDetector();
            ICollision        side = collisionDetector.getCollision(mario.returnCollisionRectangle(), enemy.returnCollisionRectangle());

            if (passed && side.returnCollisionSide().Equals(CollisionSide.Bottom))
            {
                passed = true;
            }
            else
            {
                passed = false;
            }
            MarioEnemyCollisionHandler.handleCollision((Mario)mario, enemy, side, levelStorage);
            if (((Mario)mario).StateStatus().Equals(MarioState.Die) && passed)
            {
                Console.WriteLine("Koopa Bottom Test Passed");
            }
            else
            {
                Console.WriteLine("Koopa Bottom Test failed");
            }
        }
示例#3
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     BlockSpriteTextureStorage.Load(this.Content);
     ItemSpriteTextureStorage.Load(this.Content);
     EnemySpriteFactory.Load(this.Content);
     MiscGameObjectTextureStorage.Load(this.Content);
     MarioSpriteFactory.Load(this.Content);
     GUISpriteFactory.Load(this.Content);
     SoundEffectFactory.Load(this.Content);
     MusicFactory.Load(this.Content);
     background         = Content.Load <Texture2D>(UtilityClass.background);
     background2        = Content.Load <Texture2D>(UtilityClass.background2);
     skyworldbackground = Content.Load <Texture2D>("skyworldbackground");
     deathbackground    = Content.Load <Texture2D>(UtilityClass.deathbackground);
     font           = Content.Load <SpriteFont>(UtilityClass.FontString);
     basicarialfont = Content.Load <SpriteFont>(UtilityClass.BasicArialFontString);
     LoadKeyBoardCommands();
     levelStore       = loader.LoadLevel();
     mario            = levelStore.player;
     cameraController = new CameraController(camera, mario);
     resetCommand     = new ResetLevelCommand(this);
     MusicFactory.MainTheme();
     ResetGui();
 }