예제 #1
0
 public UsedBlockEntity(ObstacleFactory factory, Vector2 position, Entity ItemEnt)
     : base(factory, ItemEnt)
 {
     Block             = (AbstractObstacle)SpriteFactory.getSprite((int)obstacleTypes.USEDBLOCK);
     Block.Position    = position;
     CurrentBlockState = new UsedBlockState(BlockSM, this);
 }
예제 #2
0
        public void UseBlock(bool marioFacingLeft)
        {
            IBlockState state = new UsedBlockState();

            state.StoreItem(storedItem);
            state.SetBlock(block);
            block.State = state;
            block.setSpriteFromState();
            block.State.UseBlock(marioFacingLeft);
            block.State.BumpBlock();
        }
 public BlockStateMachine(BlockForm block)
 {
     QuestionBlock = new QuestionBlockState(this, block);
     UsedBlock     = new UsedBlockState(this, block);
     BrickBlock    = new BrickBlockState(this, block);
     FloorBlock    = new FloorBlockState(this, block);
     PyramidBlock  = new PyramidBlockState(this, block);
     HiddenBlock   = new HiddenBlockState(this, block);
     VMovingBlock  = new VMovingBlockState(this, block);
     HMovingBlock  = new HMovingBlockState(this, block);
 }
예제 #4
0
 public void ProduceItem(bool MarioFacingLeft)
 {
     marioFacingLeft = MarioFacingLeft;
     if (storedItems.Count != 0)
     {
         IItem item = storedItems.Dequeue();
         item.GetProduced(marioFacingLeft);
         if (storedItems.Count == 0)
         {
             IBlockState state = new UsedBlockState();
             state.StoreItem(item);
             state.SetBlock(block);
             block.State = state;
             block.setSpriteFromState();
             block.State.UseBlock(marioFacingLeft);
             block.State.BumpBlock();
         }
     }
 }