示例#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;
     }
 }
示例#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
     }
 }
示例#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();
         }
     }
 }
示例#4
0
 public void Break(BrickBlock context)
 {
 }
示例#5
0
 public void Bump(BrickBlock context)
 {
 }
示例#6
0
 public void Update(BrickBlock context, GameTime gameTime)
 {
     context.Velocity = Vector2.Zero;
 }
示例#7
0
 public void Break(BrickBlock context)
 {
     context.State = new BrokenBrickBlock();
 }