Esempio 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);
        }
Esempio 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);
        }
 protected override void collect(Megaman megaman)
 {
     megaman.Coins++;
     megaman.Points += pointValue;
     if (megaman.Health < megaman.MaxHealth)
     {
         megaman.Health++;
     }
 }
        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();
        }
Esempio 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();
        }
        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);
        }
Esempio 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;
     }
 }
Esempio 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;
     }
 }
Esempio 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);
        }
Esempio 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;
        }
Esempio 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);
        }
 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;
     }
 }
Esempio 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;
     }
 }
Esempio 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;
            }
        }
Esempio 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;
            }
        }
Esempio 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;
            }
        }
Esempio 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;
            }
        }
Esempio 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;
        }
Esempio 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);
 }
Esempio n. 21
0
 public void TestInitialize(Megaman megaMan, Block block)
 {
     this.megaMan = megaMan;
     this.block = block;
 }
Esempio n. 22
0
 public UpCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Esempio n. 23
0
 public LeftCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Esempio n. 24
0
 public BusterCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Esempio n. 25
0
 public LivesTextSource(Megaman megaman)
 {
     this.megaman = megaman;
 }
Esempio n. 26
0
 public DownCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Esempio n. 27
0
 protected abstract void collect(Megaman megaman);
Esempio n. 28
0
 public RightCommand(Megaman megaman)
 {
     this.megaman = megaman;
 }
Esempio n. 29
0
 public Buster(Megaman megaman)
 {
     this.megaman = megaman;
 }