Ejemplo n.º 1
0
        public void TestCollisionResponse_Megaman_Block_FromLeft(Megaman megaMan, Block block)
        {
            megaMan = new Megaman(new Vector2(50, 240), megamanGame.Content);
            block = new Block(new Vector2(100, 240), BlockState.Question, megaMan, megamanGame.Content);

            megaMan.RightCommand();
            megaMan.ActionState.UpdatePosition(new Vector2(105, 240), gameTime);
        }
Ejemplo n.º 2
0
        public StageFactory(MegamanGame game)
        {
            this.content = game.Content;
            this.game = game;
            this.megaman = game.Megaman;

            enemySpriteFactory = new EnemySpriteFactory(content);
            itemSpriteFactory = new ItemSpriteFactory(content);
        }
Ejemplo n.º 3
0
 protected override void collect(Megaman megaman)
 {
     megaman.Coins++;
     megaman.Points += pointValue;
     if (megaman.Health < megaman.MaxHealth)
     {
         megaman.Health++;
     }
 }
Ejemplo n.º 4
0
        public ControllerFactory(Scene scene, MegamanGame game, Megaman megaman)
        {
            this.scene = scene;
            this.game = game;
            this.megaman = megaman;
            bindings = new Dictionary<Tuple<Keys, Buttons>, ICommand>();

            Reset();
        }
Ejemplo n.º 5
0
        protected override void Initialize()
        {
            Megaman = new Megaman(Content);
            sceneFactory = new StageFactory(this);
            sceneFactory.GetScene("start").Enter();

            highscore = new HighScore(Megaman, graphics);

            base.Initialize();
        }
Ejemplo n.º 6
0
        public void TestMethod1()
        {
            Megaman mm = new Megaman(mmGame.Content);
            Block block = new Block(new Vector2(0, 0), BlockState.Pyramid, mm, mmGame.Content);

            block.Collide(mm);

            BlockState state = BlockState.Colliding;
            Assert.AreEqual(state, block.CurrentState);
        }
Ejemplo n.º 7
0
        public HUD(ContentManager content, Megaman megaman, Stage stage)
        {
            characterTexture = content.Load<Texture2D>("items/megaman_helmet");
            font = content.Load<SpriteFont>("Fonts/HUD_Font");
            fullHealthbarTexture = content.Load<Texture2D>("HUD/full_health");
            lifeTankTexture = content.Load<Texture2D>("items/life_tank");
            emptyHealthbarTexture = content.Load<Texture2D>("HUD/no_health");

            this.megaman = megaman;
            this.stage = stage;
        }
 protected override void collect(Megaman megaman)
 {
     megaman.Lives++;
     if (megaman.MaxHealth - megaman.Health < 10)
     {
         megaman.Health = megaman.MaxHealth;
     }
     else
     {
         megaman.Health += 10;
     }
 }
Ejemplo n.º 9
0
 public override void Reveal(Megaman megaman)
 {
     base.Reveal(megaman);
     if (megaman.Velocity.X >= 0)
     {
         this.acceleration.X = 30;
     }
     else
     {
         this.acceleration.X = -30;
     }
 }
Ejemplo n.º 10
0
        public void ETankCollideZeroMegaman()
        {
            ETank tank = new ETank(mmGame.Content, new Vector2(0, 0));
            Megaman mm = new Megaman(mmGame.Content);
            mm.CurrentPowerUpState = mm.PowerUpStateMachine.getState(MegamanState.Zero);
            mm.StateChanged();

            tank.Collide(mm);

            IMegamanPowerUpState expectedState = mm.PowerUpStateMachine.getState(MegamanState.Zero);
            Assert.AreEqual(expectedState, mm.CurrentPowerUpState);
        }
Ejemplo n.º 11
0
        public Block(Vector2 position, BlockState initialType, Megaman megaman, ContentManager content)
        {
            spriteFactory = new BlockSpriteFactory(content);
            stateMachine = new BlockStateMachine(this, megaman);
            currentState = stateMachine.GetState(BlockState.Normal);
            currentType = initialType;
            currentSprite = spriteFactory.GetSprite(BlockStateHelper.GetState(currentType, currentState));
            currentSprite.Position = position;

            initialPosition = position;
            this.initialType = initialType;
        }
Ejemplo n.º 12
0
        public void TestCollisionResponse_Megaman_Met_FromLeft()
        {
            megaMan = new Megaman(new Vector2(300, 354), megamanGame.Content);
            metWalking = new MetWalking(megamanGame.Content);
            metWalking.Position = new Vector2(400, 354);

            megaMan.ActionState.UpdatePosition(new Vector2(401, 354), gameTime);

            IMegamanPowerUpState actualState = megaMan.PowerUpState;
            IMegamanPowerUpState expectedState = megaMan.PowerUpStateMachine.getState(MegamanState.Dead);

            Assert.AreEqual(expectedState, actualState);
        }
Ejemplo n.º 13
0
 protected override void collect(Megaman megaman)
 {
     megaman.ZeroTransition();
     megaman.Points += pointValue;
     if (megaman.MaxHealth - megaman.Health < 10)
     {
         megaman.Health = megaman.MaxHealth;
     }
     else
     {
         megaman.Health += 10;
     }
 }
Ejemplo n.º 14
0
 protected override void collect(Megaman megaman)
 {
     megaman.Points += pointValue;
     megaman.Points += 200;
     megaman.LargeTransition();
     if (megaman.MaxHealth - megaman.Health < 5)
     {
         megaman.Health = megaman.MaxHealth;
     }
     else
     {
         megaman.Health += 5;
     }
 }
Ejemplo n.º 15
0
        public override void Collide(ICollidable otherObject)
        {
            if (otherObject is Megaman && active)
            {
                sound.Play();

                megaman = otherObject as Megaman;
                megaman.Coins++;
                megaman.Points += 200;
                if (megaman.Health < megaman.MaxHealth)
                {
                    megaman.Health++;
                }
                active = false;
            }
        }
Ejemplo n.º 16
0
        public override void Collide(ICollidable otherObject)
        {
            if (otherObject is Megaman && active)
            {
                sound.Play();

                megaman = otherObject as Megaman;
                megaman.Lives++;

                if (megaman.MaxHealth - megaman.Health < 10)
                {
                    megaman.Health = megaman.MaxHealth;
                }
                else
                {
                    megaman.Health += 10;
                }

                active = false;
            }
        }
Ejemplo n.º 17
0
        public HighScore(Megaman megaman, GraphicsDeviceManager graphics)
        {
            this.megaman = megaman;
            this.graphics = graphics;
            isDead = false;

            try
            {
                FileStream fileStream = new FileStream(HIGH_SCORE_FILE, FileMode.Open, FileAccess.Read);
                BinaryReader binaryReader = new BinaryReader(fileStream);

                highScore = binaryReader.ReadInt32();

                binaryReader.Close();
                fileStream.Close();
            }
            catch (IOException)
            {
                highScore = 0;
            }
        }
Ejemplo n.º 18
0
        public override void Collide(ICollidable otherObject)
        {
            if (otherObject is Megaman && active)
            {
                sound.Play();

                megaman = otherObject as Megaman;
                megaman.LargeTransition();
                megaman.Points += 1000;
                megaman.Points += 200;
                if (megaman.MaxHealth - megaman.Health < 5)
                {
                    megaman.Health = megaman.MaxHealth;
                }
                else
                {
                    megaman.Health += 5;
                }
                active = false;
            }
        }
Ejemplo n.º 19
0
        public MMBullet2(ContentManager content, Rectangle mmBox, int direction, Megaman megaman)
            : base(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 64, 64), 0, Vector2.Zero, content.Load<Texture2D>("megaman/MMBullet3"))
        {
            sound = content.Load<SoundEffect>("Sounds/mm7/MMShot1");

            maxVelocity.X = 300;
            minVelocity.X = -300;
            velocity.X = 300 * direction;
            acceleration.X = 1 * direction;

            if (direction < 0)
            {
                position.X = mmBox.X - aabb.Width;
            }
            else
            {
                position.X = mmBox.X + mmBox.Width;
            }

            position.Y = mmBox.Y + (mmBox.Height / 2) - (aabb.Height / 2);

            this.megaman = megaman;
        }
Ejemplo n.º 20
0
 public virtual void Reveal(Megaman megaman)
 {
     this.megaman = megaman;
     active = true;
     position = new Vector2(block.CurrentSprite.Position.X, block.CurrentSprite.Position.Y - 32);
 }
Ejemplo n.º 21
0
 public void TestInitialize(Megaman megaMan, Block block)
 {
     this.megaMan = megaMan;
     this.block = block;
 }
Ejemplo n.º 22
0
 public UpCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Ejemplo n.º 23
0
 public LeftCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Ejemplo n.º 24
0
 public BusterCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Ejemplo n.º 25
0
 public LivesTextSource(Megaman megaman)
 {
     this.megaman = megaman;
 }
Ejemplo n.º 26
0
 public DownCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Ejemplo n.º 27
0
 protected abstract void collect(Megaman megaman);
Ejemplo n.º 28
0
 public RightCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Ejemplo n.º 29
0
 public Buster(Megaman megaman)
 {
     this.megaman = megaman;
 }