Пример #1
0
 public void Bumping()
 {
     IsBumping     = true;
     currentbState = bStates[2];
     MinY          = Parameters.Position.Y - base.GetHeightAndWidth.X;
     MaxY          = Parameters.Position.Y; SoundFactory.Instance.HitQuestionBlock();
 }
 public override void Enter(IBlockStates previousState)
 {
     Block.IsAnimated = false;
     CurrentState     = this;
     PreviousState    = previousState;
     Block.Texture    = Block.BlockSpriteFactory.GetBlockSprite("hidden");
 }
Пример #3
0
 public void ChangeToBrick()
 {
     BType = BlockType.BNormal;
     //Console.WriteLine("change to Bnormal");
     SpriteSheets  = BlockFactory.BlockTextures[0];
     currentbState = GenerateCurrentState();
 }
        public override void Enter(IBlockStates previousState)
        {
            CurrentState  = this;
            PreviousState = previousState;

            //Velocity that determines the blocks Explosion
            Block.Velocity = new Vector2(0, SpeedY);
        }
Пример #5
0
 public override void Enter(IBlockStates previousState)
 {
     Block.IsAnimated   = false;
     CurrentState       = this;
     PreviousState      = previousState;
     Block.Texture      = Block.BlockSpriteFactory.GetBlockSprite("flag");
     Block.CurrentFrame = 4;
     Block.TotalFrames  = 5;
 }
Пример #6
0
        public override void Enter(IBlockStates previousState)
        {
            CurrentState  = this;
            PreviousState = previousState;
            FixedPosition = Block.Position;

            //Velocity that determines the blocks bump
            Block.Velocity = new Vector2(0, -SpeedY);
        }
Пример #7
0
 public override void Enter(IBlockStates previousState)
 {
     Block.Time.Start();
     Block.IsAnimated = true;
     CurrentState     = this;
     //Velocity that determines the blocks bump
     Block.CurrentFrame = 4;
     Block.IsAnimated   = false;
     Block.TotalFrames  = 5;
 }
 public override void Enter(IBlockStates previousState)
 {
     FixedPosition = Block.Position;
     CurrentState  = this;
     //Velocity that determines the blocks bump
     Block.Velocity     = new Vector2(0, -SpeedY);
     Block.Texture      = Block.BlockSpriteFactory.GetBlockSprite("used");
     Block.CurrentFrame = 0;
     Block.IsAnimated   = false;
     Block.TotalFrames  = 1;
 }
Пример #9
0
        public override void Enter(IBlockStates previousState)
        {
            Block.IsAnimated = true;
            CurrentState     = this;
            PreviousState    = previousState;
            if (Block.Sprite != null)
            {
                FixedPosition = Block.Position;
            }

            Block.Texture  = Block.BlockSpriteFactory.GetBlockSprite("question");
            Block.Position = FixedPosition;
        }
Пример #10
0
 public Blocks(Texture2D sheet, MoveParameters moveParameters, Point rowAndColumn, BlockType type, ArrayList itemList)
     : base(sheet, rowAndColumn, moveParameters)
 {
     BType        = type;
     items        = itemList;
     containItems = itemList.Count != 0 ? true : false;
     bPosition    = moveParameters.Position;
     bStates      = new IBlockStates[4] {
         new HiddenState(), new NormalState(), new BumpingState(), new UsedOrDestroyedState()
     };
     currentbState = GenerateCurrentState();
     IsBumping     = false;
 }
        //CollisionGrid CollisionGrid;
        public BrickBlockWithItemModel(BlockSpriteFactory blockSpriteFactory, Vector2 coordinates, Vector2 velocity, ItemModelFactory itemModelFactory, string itemType, int numOfItems)
            : base(blockSpriteFactory)
        {
            //If the Brick block has an Item
            //Initialize state first
            CurrentState = new BrickBlockWithItemStandardState(this);
            CurrentState.Enter(null);

            IBlockStates previousState = CurrentState;

            CurrentState = new BlockHasItemState(this);
            CurrentState.Enter(previousState);
            //Define the characteristics of a brick block here
            Position     = coordinates;
            CurrentFrame = 0;
            Columns      = 1;
            Rows         = 1;
            LayerDepth   = 1;
            Scale        = new Vector2(10, 10);
            Width        = Texture.Width / Columns;
            Height       = Texture.Height / Rows;
            Velocity     = velocity;

            //Particles
            Texture2D        brickTexture = BlockSpriteFactory.GetBlockSprite("brick");
            List <Texture2D> textures     = new List <Texture2D>();

            textures.Add(brickTexture);
            ParticleEngine = new ParticleEngine(textures, Position);

            //Items
            ItemModelFactory = itemModelFactory;
            NumOfItems       = numOfItems;
            ItemType         = itemType;
            //CollisionGrid = collisionGrid;
            ItemModel           = itemModelFactory.GetItemModel(ItemType, coordinates, Velocity);
            ItemModel.IsVisible = false;
        }
Пример #12
0
 public override void Update(float frameTime)
 {
     //foreach (AnimatedSprite sprite in shownItems)
     //sprite.Update(frameTime);
     base.Update(frameTime);
     if (IsBumping)
     {
         bPosition.Y -= positionOffset.Y != 0 ? spriteSpeed.Y * frameTime : 0;
         if (bPosition.Y < MinY)
         {
             bPosition.Y = MinY;
             if (containItems)
             {
                 //Console.WriteLine("item bumps");
                 DiscloseItem();
                 RemoveItem();
             }
             else if (BType == BlockType.QNormal)
             {
                 ChangeToUsed();
             }
             spriteSpeed.Y *= -1;
         }
         if (bPosition.Y > MaxY)
         {
             IsBumping      = false;
             currentbState  = GenerateCurrentState();
             spriteSpeed.Y *= -1;
             bPosition.Y    = MaxY;
         }
         Parameters.SetPosition(Parameters.Position.X, bPosition.Y);
     }
     if (BType == BlockType.Destroyed && containItems)
     {
         DiscloseItem();
         RemoveItem();
     }
 }
Пример #13
0
 public override void StandardTransition(IBlockStates previousState)
 {
     CurrentState.ExitState();
     CurrentState = previousState;
     CurrentState.Enter(this);
 }
Пример #14
0
 private void ChangeToUsed()
 {
     BType = BlockType.Used;
     base.ResizeFrame(BlockFactory.BlockTextures[2], new Point(4, 1), 0);
     currentbState = GenerateCurrentState();
 }
 public override void Enter(IBlockStates previousState)
 {
     Block.IsAnimated = false;
     CurrentState     = this;
     PreviousState    = previousState;
 }
Пример #16
0
 public void ChangeToDestroyed()
 {
     BType         = BlockType.Destroyed;
     currentbState = GenerateCurrentState();
 }
Пример #17
0
 public override void Enter(IBlockStates previousState)
 {
     CurrentState     = this;
     Block.IsAnimated = false;
     //Pipe itself cannot teleport mario. mario must manually do that as of now
 }
Пример #18
0
 public virtual void StandardTransition(IBlockStates previousState)
 {
 }
Пример #19
0
 public virtual void Enter(IBlockStates previousState)
 {
     CurrentState  = this;
     PreviousState = previousState;
 }
Пример #20
0
        //public BlockHasItemState(BlockModel block, ItemModel item) : base(block) => ItemModel = item;

        public override void Enter(IBlockStates previousState)
        {
            CurrentState = previousState;
        }