示例#1
0
 public Level(Game game, GraphicsDeviceManager graphics, String levelLoadFile, MarioPowerLevel origPower)
 {
     this.OriginalPowerLevel = origPower;
     this.LevelLoadString    = levelLoadFile;
     this.UndergroundDict    = new Dictionary <Vector2, Vector2>();
     this.CurrentGame        = game;
     this.Graphics           = graphics;
     this.Updater            = new LevelUpdater(this, game);
     this.Drawer             = new LevelDrawer(this);
     this.Time = Level1Config.LevelTime;
     this.LoadContent();
 }
示例#2
0
        public JumpingMario(IMario mario, bool rightFacing, MarioPowerLevel powerLevel)
        {
            switch (powerLevel)
            {
            case MarioPowerLevel.Fire:
            case MarioPowerLevel.Metal:
                this.Texture = SpriteHolder.FireMario;
                break;

            case MarioPowerLevel.Big:
                this.Texture = SpriteHolder.BigMario;
                break;

            case MarioPowerLevel.Small:
                this.Texture = SpriteHolder.SmallMario;
                break;
            }

            if (powerLevel == MarioPowerLevel.Metal)
            {
                this.Color    = MarioConfig.MetalMarioColor;
                OriginalColor = this.Color;
            }

            this.Mario = mario;
            this.Frame = SpriteHolder.JumpingMarioFrame;

            if (rightFacing)
            {
                this.Flip = SpriteEffects.None;
            }
            else
            {
                this.Flip = SpriteEffects.FlipHorizontally;
            }

            //mario should have a y velocity of 0 when jumping off something. if he is jumping and collides with
            //something, this check ensures that he does not "double jump" by resetting the velocity.
            if (this.Mario.CurrentVelocity.Y == 0)
            {
                this.Mario.CurrentVelocity = new Vector2(this.Mario.CurrentVelocity.X, (float)(MarioConfig.JumpVelocity));
            }

            if (MarioPowerLevelGeneralizer.IsBig(powerLevel))
            {
                this.Width = SpriteHolder.BigMarioWidth;
            }
            else
            {
                this.Width = SpriteHolder.SmallMarioWidth;
            }
            this.Height = this.Texture.Height;
        }
示例#3
0
        public RunningMario(IMario mario, bool rightFacing, MarioPowerLevel powerLevel)
        {
            switch (powerLevel)
            {
            case MarioPowerLevel.Fire:
            case MarioPowerLevel.Metal:
                this.Texture = SpriteHolder.FireMario;
                break;

            case MarioPowerLevel.Big:
                this.Texture = SpriteHolder.BigMario;
                break;

            case MarioPowerLevel.Small:
                this.Texture = SpriteHolder.SmallMario;
                break;
            }

            if (powerLevel == MarioPowerLevel.Metal)
            {
                this.Color    = MarioConfig.MetalMarioColor;
                OriginalColor = this.Color;
            }

            this.StartFrame            = SpriteHolder.TraversingMarioStartFrame;
            this.CurrentFrame          = this.StartFrame;
            this.EndFrame              = SpriteHolder.TraversingMarioEndFrame;
            this.Mario                 = mario;
            this.Mario.CurrentVelocity = new Vector2(this.Mario.CurrentVelocity.X, 0);
            this.counter               = 0;

            if (rightFacing)
            {
                this.Flip = SpriteEffects.None;
                this.PositionIncrement = MarioConfig.SideSpeed;
            }
            else
            {
                this.Flip = SpriteEffects.FlipHorizontally;
                this.PositionIncrement = -1 * MarioConfig.SideSpeed;
            }

            if (MarioPowerLevelGeneralizer.IsBig(powerLevel))
            {
                this.Width = SpriteHolder.BigMarioWidth;
            }
            else
            {
                this.Width = SpriteHolder.SmallMarioWidth;
            }
            this.Height = this.Texture.Height;
        }
示例#4
0
        public IdleMario(IMario mario, bool rightFacing, MarioPowerLevel powerLevel)
        {
            switch (powerLevel)
            {
            case MarioPowerLevel.Fire:
            case MarioPowerLevel.Metal:
                this.Texture = SpriteHolder.FireMario;
                break;

            case MarioPowerLevel.Big:
                this.Texture = SpriteHolder.BigMario;
                break;

            case MarioPowerLevel.Small:
                this.Texture = SpriteHolder.SmallMario;
                break;
            }

            if (powerLevel == MarioPowerLevel.Metal)
            {
                this.Color    = MarioConfig.MetalMarioColor;
                OriginalColor = this.Color;
            }

            this.Mario = mario;
            this.Frame = SpriteHolder.IdleMarioFrame;
            this.Mario.CurrentVelocity = new Vector2(0, 0);

            if (rightFacing)
            {
                this.Flip = SpriteEffects.None;
            }
            else
            {
                this.Flip = SpriteEffects.FlipHorizontally;
            }

            if (MarioPowerLevelGeneralizer.IsBig(powerLevel))
            {
                this.Width = SpriteHolder.BigMarioWidth;
            }
            else
            {
                this.Width = SpriteHolder.SmallMarioWidth;
            }
            this.Height = this.Texture.Height;
        }
示例#5
0
 public static bool IsBig(MarioPowerLevel powerLevel)
 {
     return(powerLevel == MarioPowerLevel.Big || powerLevel == MarioPowerLevel.Fire || powerLevel == MarioPowerLevel.Metal);
 }