예제 #1
0
        public static Item RandomSpeedBoostItem(int width, int height)
        {
            Tuple <int, int> randoms = randomXY(400, 600);
            SpeedBoostItem   item    = new SpeedBoostItem(randoms.Item1, randoms.Item2);

            return(item);
        }
예제 #2
0
        public override void ReleaseItem()
        {
            SpeedBoostItem greenMushroom = new SpeedBoostItem(new Vector2(this.block.Location().X, this.block.Location().Y - this.block.GetHitBox().Height));

            GameManager.Instance.AddToCollidables(greenMushroom);
            greenMushroom.Physics.xVelocity = Config.GetItemMovementSpeed();
            block.itemState = new EmptyItemState(block);
        }
 public void Handle(ICollidable object1, ICollidable object2, CollisionDirection.DirectionTag direction)
 {
     if (typeof(Mario).IsInstanceOfType(object1) && typeof(SpeedBoostItem).IsInstanceOfType(object2))
     {
         mario         = (Mario)object1;
         greenMushroom = (SpeedBoostItem)object2;
         //Mario should stay unchanged//
         //GreenMushroom disappear//
         this.greenMushroom.Collect();
         mario.GainLife();
     }
 }
예제 #4
0
 public void Handle(ICollidable object1, ICollidable object2, CollisionDirection.DirectionTag direction)
 {
     if (typeof(IMario).IsInstanceOfType(object1) && typeof(SpeedBoostItem).IsInstanceOfType(object2))
     {
         mario     = (IMario)object1;
         boostItem = (SpeedBoostItem)object2;
         //Mario should boost//
         mario.Boost();
         //boostItem disappear//
         this.boostItem.Collect();
         SoundEffectManager.Instance.PlaySoundEffect(SoundEffectManager.SoundEffectTag.GainExtraLife);
     }
 }