public void Update(GameTime gameTime) { float yAcceleration = GameValues.BlockItemInitialYAcceleration; BlockState.Update(gameTime, Position); if (IsMoving == true) { Position = new Vector2(Position.X, Position.Y + Velocity.Y); Velocity = new Vector2(Velocity.X, Velocity.Y + yAcceleration); if (Position.Equals(InitialPosition)) { IsMoving = false; Item.Spawning = true; if (Item.ItemState.ToString() != "SuperMario.ItemStates.RotatingCoin") { Item.Velocity = GameValues.BlockItemInitialSpawnVelocity; } else { Item.Velocity = GameValues.BlockRotatingCoinSpawningVelocity; } } CollisionRectangle = new Rectangle((int)this.Position.X, (int)this.Position.Y, (int)this.CollisionRectangle.Width, (int)this.CollisionRectangle.Height); } Item.Update(gameTime); }
public override void Update(GameTime gameTime) { if (BlockState is BrickBlockStateDestroyed) { foreach (ISprite sprite in brokenParts) { sprite.Update(gameTime); } } else { BlockState.Update(gameTime); } }
public override void Update(GameTime gameTime) { if (!(BlockState is BlockStateUsed)) { if (lastChange > Frame / 2) { ChangeSource(); lastChange = 0; } else { lastChange += (int)gameTime.ElapsedGameTime.TotalMilliseconds; } BlockState.Update(gameTime); } }