Esempio n. 1
0
 /// <summary>
 /// Move a block based on a provided movement
 /// </summary>
 /// <param name="movement">A movement which will be applied to the block</param>
 public void Move(Movement movement)
 {
     this.movement = movement;
     Position = movement.End;
     state = MoveableBlockState.Moving;
 }
Esempio n. 2
0
        /// <summary>
        /// Allows the MoveableBlock to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            //Update a moving block
            if (state == MoveableBlockState.Moving)
            {
                movement.Update(gameTime);

                // Check if movement is complete
                if (movement.Complete)
                {
                    state = MoveableBlockState.Idle;
                    movement = null;
                }
            }
        }