Example #1
0
 public void Update(BrickBlock context, GameTime gameTime)
 {
     if (context.Position.Y <= context.Level.MapHeight)
     {
         context.Velocity = new Vector2(context.Velocity.X, 1);
     }
     else
     {
         context.ToBeRemoved = true;
     }
 }
Example #2
0
 public void Break(BrickBlock context)
 {
     context.Velocity = new Vector2(context.Velocity.X, -1);
     if (context.Items.Count == 0)
     {
         context.State = new BumpedBrickBlock(false); // if it never had items to begin with, return to idle after
     }
     else
     {
         context.State = new BumpedBrickBlock(true); // else enable returning as a used block
     }
 }
Example #3
0
 public void Update(BrickBlock context, GameTime gameTime)
 {
     if (context.Position.Y + context.Velocity.Y <= context.minY)
     {
         context.Velocity = new Vector2(context.Velocity.X, -context.Velocity.Y);
         if (context.Items.Count > 0)
         {
             context.SpawnItem(); // spawn item at peak, so collision isn't messy
         }
     }
     else if (context.Position.Y + context.Velocity.Y >= context.maxY)
     {
         if (toUsedBlock && context.Items.Count == 0)
         {
             context.State = new UsedBrickBlock();
         }
         else
         {
             context.State = new IdleBrickBlock();
         }
     }
 }
Example #4
0
 public void Break(BrickBlock context)
 {
 }
Example #5
0
 public void Bump(BrickBlock context)
 {
 }
Example #6
0
 public void Update(BrickBlock context, GameTime gameTime)
 {
     context.Velocity = Vector2.Zero;
 }
Example #7
0
 public void Break(BrickBlock context)
 {
     context.State = new BrokenBrickBlock();
 }