public SmallMarioFlagSlide(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     this.playableObject.StarPower = false;
     sprite = AnimatedSpriteFactory.Instance.BuildSmallFlagSlideMarioSprite();
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public BigRightCrouchingMario(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildBigRightCrouchingMarioSprite();
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
     crouchPressed = true;
 }
 public SmallRightToBig(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildSmallRightMarioToBigMarioSprite();
     growthBuffer = GameValues.MarioStateSmallToBigGrowthBuffer;
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
     GameStateMachine.Instance.GameState = new MarioFreezeGameAnimationState();
 }
예제 #4
0
        public King(IPlayableObject playableObject)
        {
            this.parent = playableObject;
            this.Position = parent.Position;

            sprite = AnimatedSpriteFactory.Instance.BuildKingSprite(parent.Position);
            this.CollisionRectangle = sprite.SpriteDestinationRectangle;
        }
        public FireLeftFireballThrowingMario(IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            sprite = AnimatedSpriteFactory.Instance.BuildFireLeftFireballThrowingMarioSprite();
            this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;

            this.playableObject.ThrowFireball();
            timer = GameValues.MarioStateFireThrowingTimer;
        }
예제 #6
0
        public Hand(IPlayableObject playableObject, bool isRight, string handState)
        {
            this.parent = playableObject;
            this.IsRight = isRight;
            this.IsActive = false;

            if (handState == "AttackHand")
            {
                HandState = new AttackHand(parent, this.IsRight);
            }
        }
        public BigLeftTongueMarioYoshi(IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            this.playableObject.ReverseYoshiSprites = false;
            frame = 0;
            sprite = AnimatedSpriteFactory.Instance.BuildBigLeftTongueStartMarioYoshi(playableObject.Position, frame);
            this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
            this.playableObject.IsYoshiTongueLeft = true;

            SoundManager.Instance.PlayYoshiTongueSound();
        }
        private bool SelectPlayableObject(IPlayableObject playableObject, Vector2 mousePosition)
        {
            if (mousePosition.X > playableObject.CollisionRectangle.Left && mousePosition.X < playableObject.CollisionRectangle.Right && mousePosition.Y < playableObject.CollisionRectangle.Bottom && mousePosition.Y > playableObject.CollisionRectangle.Top)
            {
                playableObject.IsSelected = true;
            }

            else
            {
                playableObject.IsSelected = false;
            }

            return playableObject.IsSelected;
        }
예제 #9
0
        public BigRightJumpingMario(IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            if (!this.playableObject.IsJumping)
            {
                SoundManager.Instance.BigJump.Play();
            }

            this.playableObject.IsJumping = true;
            this.playableObject.InAir     = true;
            jumpPressed = true;
            jumpTimer   = GameValues.MarioStateJumperTimer;

            sprite = AnimatedSpriteFactory.Instance.BuildBigRightJumpingMarioSprite();
            this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
        }
        public FireRightJumpingMario(IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            if (!this.playableObject.IsJumping)
            {
                SoundManager.Instance.BigJump.Play();
            }

            this.playableObject.IsJumping = true;
            this.playableObject.InAir = true;
            jumpPressed = true;
            jumpTimer = GameValues.MarioStateJumperTimer;

            sprite = AnimatedSpriteFactory.Instance.BuildFireRightJumpingMarioSprite();
            this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
        }
        public SmallLeftJumpingMarioYoshi(IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            if (!playableObject.IsJumping)
            {
                SoundManager.Instance.SmallJump.Play();
            }

            playableObject.IsJumping = true;
            playableObject.InAir = true;
            jumpPressed = true;
            jumpTimer = GameValues.MarioStateJumperTimer;

            sprite = AnimatedSpriteFactory.Instance.BuildSmallLeftJumpingMarioYoshiSprite(playableObject.Position);
            playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
        }
        public GamePadController(Game game, IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            buttonMap = new Dictionary<Buttons, ICommand> { };

            buttonMap.Add(Buttons.DPadRight, new MoveMarioRightCommand(playableObject));
            buttonMap.Add(Buttons.LeftThumbstickRight, new MoveMarioRightCommand(playableObject));
            buttonMap.Add(Buttons.DPadLeft, new MoveMarioLeftCommand(playableObject));
            buttonMap.Add(Buttons.LeftThumbstickLeft, new MoveMarioLeftCommand(playableObject));
            buttonMap.Add(Buttons.DPadDown, new MarioCrouchCommand(playableObject));
            buttonMap.Add(Buttons.LeftThumbstickDown, new MarioCrouchCommand(playableObject));
            buttonMap.Add(Buttons.Back, new ExitGameCommand(game));

            this.game = game;
            startPressed = false;
            jumpPressed = false;
        }
예제 #13
0
        public GamePadController(Game game, IPlayableObject playableObject)
        {
            this.playableObject = playableObject;
            buttonMap           = new Dictionary <Buttons, ICommand> {
            };

            buttonMap.Add(Buttons.DPadRight, new MoveMarioRightCommand(playableObject));
            buttonMap.Add(Buttons.LeftThumbstickRight, new MoveMarioRightCommand(playableObject));
            buttonMap.Add(Buttons.DPadLeft, new MoveMarioLeftCommand(playableObject));
            buttonMap.Add(Buttons.LeftThumbstickLeft, new MoveMarioLeftCommand(playableObject));
            buttonMap.Add(Buttons.DPadDown, new MarioCrouchCommand(playableObject));
            buttonMap.Add(Buttons.LeftThumbstickDown, new MarioCrouchCommand(playableObject));
            buttonMap.Add(Buttons.Back, new ExitGameCommand(game));

            this.game    = game;
            startPressed = false;
            jumpPressed  = false;
        }
        public void Execute(IPlayableObject playableObject)
        {
            if (playableObject.IsFire)
            {
                playableObject.PlayableObjectState = new FireRightWalkingMario(playableObject);
            }

            else if (playableObject.IsBig)
            {
                playableObject.PlayableObjectState = new BigRightWalkingMario(playableObject);
            }

            else
            {
                playableObject.PlayableObjectState = new SmallRightWalkingMario(playableObject);
            }

            playableObject.Position = new Vector2(playableObject.Position.X, playableObject.Position.Y - GameValues.FinishedCollisingWithFlagPoleYPositionOffset);
            playableObject.Velocity = new Vector2(1f, -1f);
            playableObject.MaxVelocity = new Vector2(1f, 1f);
            GameStateMachine.Instance.GameState = new EndLevelState();
        }
        public void Execute(IPlayableObject playableObject)
        {
            if (playableObject.IsFire)
            {
                playableObject.PlayableObjectState = new FireRightWalkingMario(playableObject);
            }

            else if (playableObject.IsBig)
            {
                playableObject.PlayableObjectState = new BigRightWalkingMario(playableObject);
            }

            else
            {
                playableObject.PlayableObjectState = new SmallRightWalkingMario(playableObject);
            }

            playableObject.Position             = new Vector2(playableObject.Position.X, playableObject.Position.Y - GameValues.FinishedCollisingWithFlagPoleYPositionOffset);
            playableObject.Velocity             = new Vector2(1f, -1f);
            playableObject.MaxVelocity          = new Vector2(1f, 1f);
            GameStateMachine.Instance.GameState = new EndLevelState();
        }
예제 #16
0
        public AttackHand(IPlayableObject playableObject, bool isRight)
        {
            this.parent = playableObject;
            this.IsRight = isRight;
            this.IsFirstFrame = false;

            // build the sprites.

            attackLeft1Sprite = AnimatedSpriteFactory.Instance.BuildAttackLeft1Sprite(parent.Position);
            attackLeft2Sprite = AnimatedSpriteFactory.Instance.BuildAttackLeft2Sprite(parent.Position);
            attackRight1Sprite = AnimatedSpriteFactory.Instance.BuildAttackRight1Sprite(parent.Position);
            attackRight2Sprite = AnimatedSpriteFactory.Instance.BuildAttackRight2Sprite(parent.Position);

            if (this.IsRight)
            {
                this.Position = new Vector2(parent.CollisionRectangle.Right, parent.CollisionRectangle.Top);
            }

            else
            {
                this.Position = new Vector2(parent.CollisionRectangle.Left - 16, parent.CollisionRectangle.Bottom);
            }
        }
예제 #17
0
        public AttackHand(IPlayableObject playableObject, bool isRight)
        {
            this.parent       = playableObject;
            this.IsRight      = isRight;
            this.IsFirstFrame = false;

            // build the sprites.

            attackLeft1Sprite  = AnimatedSpriteFactory.Instance.BuildAttackLeft1Sprite(parent.Position);
            attackLeft2Sprite  = AnimatedSpriteFactory.Instance.BuildAttackLeft2Sprite(parent.Position);
            attackRight1Sprite = AnimatedSpriteFactory.Instance.BuildAttackRight1Sprite(parent.Position);
            attackRight2Sprite = AnimatedSpriteFactory.Instance.BuildAttackRight2Sprite(parent.Position);

            if (this.IsRight)
            {
                this.Position = new Vector2(parent.CollisionRectangle.Right, parent.CollisionRectangle.Top);
            }

            else
            {
                this.Position = new Vector2(parent.CollisionRectangle.Left - 16, parent.CollisionRectangle.Bottom);
            }
        }
 public SmallLeftIdleMario(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildSmallLeftIdleMarioSprite();
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public MarioCollidesWithYoshi(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #20
0
 public MarioCrouchCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public MoveMarioRightCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #22
0
 public FireMarioFlagSlide(IPlayableObject playableObject)
 {
     this.playableObject           = playableObject;
     this.playableObject.StarPower = false;
     sprite = AnimatedSpriteFactory.Instance.BuildFireFlagSlideMarioSprite();
 }
예제 #23
0
 public PlayableObjectStateTransitionMachine(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     PipeBuffer          = GameValues.MarioStateMachinePipeBuffer;
 }
 public FireLeftIdleMario(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildFireLeftIdleMarioSprite();
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
예제 #25
0
 public SmallLeftWalkingMario(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildSmallLeftWalkingMarioSprite();
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public MarioCollidesWithMushroomCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #27
0
 public MarioCollidesWithStarCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public FireMarioFlagSlide(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     this.playableObject.StarPower = false;
     sprite = AnimatedSpriteFactory.Instance.BuildFireFlagSlideMarioSprite();
 }
 private void MoveSelectedPlayableObject(IPlayableObject playableObject, Vector2 mousePosition)
 {
     playableObject.SetFuturePosition(mousePosition);
 }
 public MarioCollidesWithGroundCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public MarioRunCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public MarioCollidesWithFlagPoleCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #33
0
 public BigMarioFlagSlideEnd(IPlayableObject playableObject)
 {
     this.playableObject           = playableObject;
     this.playableObject.StarPower = false;
     sprite = AnimatedSpriteFactory.Instance.BuildBigFlagSlideEndMarioSprite();
 }
 public MarioCollidesWithEnemyCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public BigLeftWalkingMario(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildBigLeftWalkingMarioSprite();
     this.playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public MoveMarioLeftCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #37
0
 public ItemIsConsumedCommand(IPlayableObject playableObject, IDynamicObject dynamicObject)
 {
     this.playableObject = playableObject;
     this.dynamicObject  = dynamicObject;
 }
예제 #38
0
 public MarioNoInputCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public MarioCollidesWithMushroomCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public MarioJumpCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public MarioCollidesWithYoshi(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #42
0
 private void MoveSelectedPlayableObject(IPlayableObject playableObject, Vector2 mousePosition)
 {
     playableObject.SetFuturePosition(mousePosition);
 }
예제 #43
0
 private void FindTarget()
 {
     target = Level.Instance.King;
 }
 public MarioNoInputCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
예제 #45
0
 private void FindTarget()
 {
     target = Level.Instance.King;
 }
예제 #46
0
 public MarioSlidesOnFlagPoleCommand(IPlayableObject playableObject, IDynamicObject dynamicObject)
 {
     this.dynamicObject  = dynamicObject;
     this.playableObject = playableObject;
 }
예제 #47
0
 public BigRightWalkingMarioYoshi(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildBigRightWalkingMarioYoshiSprite(playableObject.Position);
     playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public SmallLeftIdleMarioYoshi(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildSmallLeftIdleMarioYoshiSprite(playableObject.Position);
     playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public MarioCollidesWithFlagPoleCommand(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }
 public BigLeftIdleMarioYoshi(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
     sprite = AnimatedSpriteFactory.Instance.BuildBigLeftIdleMarioYoshiSprite(playableObject.Position);
     playableObject.CollisionRectangle = sprite.SpriteDestinationRectangle;
 }
 public MarioSlidesOnFlagPoleCommand(IPlayableObject playableObject, IDynamicObject dynamicObject)
 {
     this.dynamicObject = dynamicObject;
     this.playableObject = playableObject;
 }
예제 #52
0
 public MarioCollidesWithFireFlower(IPlayableObject playableObject)
 {
     this.playableObject = playableObject;
 }