Esempio n. 1
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;
        }
Esempio n. 2
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;
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
 public bool IsBig()
 {
     return(MarioPowerLevelGeneralizer.IsBig(this.CurrentState.PowerLevel()));
 }