示例#1
0
 public override void CollisionResponseTop(ICollidable collidable)
 {
     if (collidable is MarioModel)
     {
         MarioModel mario = (MarioModel)collidable;
         mario.TakeDamage();
     }
 }
示例#2
0
 public Camera(Viewport viewport, MarioModel mario)
 {
     this.observers = new List <ICameraObserver>();
     this.mario     = mario;
     _viewport      = viewport;
     Origin         = new Vector2(_viewport.Width / 2.0f, _viewport.Height / 2.0f);
     Zoom           = 1.0f;
 }
示例#3
0
 public override void CollisionResponseSide(ICollidable collidable)
 {
     if (collidable is MarioModel && !HasCollided)
     {
         MarioModel marioModel = (MarioModel)collidable;
         RewardPointsByHeight(marioModel);
         CurrentState.BumpTransition();
         HasCollided = true;
         //Call Finalize Points
         ICommand com = new GoToCastleCommand(marioModel);
         com.Execute();
         winTime.Start();
     }
 }
示例#4
0
 public override void CollisionResponseTop(ICollidable collidable)
 {
     if (collidable is MarioModel && !HasCollided)
     {
         //If mario hits top of flag, give an extra life
         MarioModel marioModel = (MarioModel)collidable;
         marioModel.lives++;
         CurrentState.BumpTransition();
         HasCollided = true;
         //Call Finalize Points
         ICommand com = new GoToCastleCommand(marioModel);
         com.Execute();
         winTime.Start();
     }
 }
示例#5
0
        public override void CollisionResponseBottom(ICollidable collidable)
        {
            if (collidable is MarioModel)
            {
                MarioModel marioModel = (MarioModel)collidable;

                if (NumOfItems > 0)
                {
                    //Move the item
                    ItemModel = ItemModelFactory.GetItemModel(ItemType, Position, Velocity);
                    //AddItemsButCoinAsCollidable();
                    ItemModel.Move(Position, marioModel.leftFacing);
                    //If items still exist inside brick, bump the brick.
                    this.CurrentState.BumpTransition();
                    NumOfItems--;
                }
            }
        }
示例#6
0
        public void RewardPointsByHeight(MarioModel marioModel)
        {
            //Cooridnates start from top left of the flag
            float coorY  = Coordinates.Y;
            float marioY = marioModel.Position.Y;

            //Based on where the Y position of Mario is relative to flag's coordinates, award different points
            if (marioY <= coorY + 25)
            {
                //Top side of Flag pole (128-153 Pixels high). NOT TOP TOP of flag pole though.
                //Give 4000 Points
                marioModel.points += 4000;
            }
            else if (marioY <= coorY + 70)
            {
                //2nd Top side of Flag pole (82-127 Pixels high)
                //Give 2000 Points
                marioModel.points += 2000;
            }
            else if (marioY <= coorY + 93)
            {
                //3rd Top side of Flag pole (58-81 Pixels high)
                //Give 800 Points
                marioModel.points += 800;
            }
            else if (marioY <= coorY + 132)
            {
                //2nd Bottom side of Flag pole (18-57 Pixels high)
                //Give 400 Points
                marioModel.points += 400;
            }
            else if (marioY <= coorY + 153)
            {
                //Bottom side of Flag pole (0-17 Pixels high)
                //Give 100 Points
                marioModel.points += 100;
            }

            //Finally multiply the points by time remaining
            //MarioModel needs access to read time.
            marioModel.points += marioModel.time * 50;
            marioModel.time    = 400;
        }
示例#7
0
 public MoveLeftCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#8
0
 public StopJumpCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#9
0
 public FireCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }
示例#10
0
 public StopCrouchCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#11
0
 public GoToCastleCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }
示例#12
0
 public ToTestRoomCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }
示例#13
0
 public MarioFireState(MarioModel mario) : base(mario)
 {
 }
示例#14
0
 public MarioDeadState(MarioModel mario) : base(mario)
 {
 }
示例#15
0
 public MarioStandardState(MarioModel mario) : base(mario)
 {
 }
示例#16
0
 public SuperCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }
示例#17
0
 public StandardCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }
示例#18
0
 public StopRightCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#19
0
 public MoveRightCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#20
0
 public StopLeftCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#21
0
 public TakeDamageCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#22
0
 public FeatureToggleCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }
 public MarioPowerupStatesAbstract(MarioModel mario)
 {
     Mario = mario;
 }
示例#24
0
 public ToggleCrouchCommand(MarioModel mario)
 {
     this.mario = mario;
 }
示例#25
0
 public MarioSuperState(MarioModel mario) : base(mario)
 {
 }
示例#26
0
 public ToggleGravityCommand(MarioModel receiver)
 {
     this.receiver = receiver;
 }