Esempio n. 1
0
 private void MoveByControls(BlockFacade blockFacade, Vector3 movement)
 {
     _audioPlayer.PlaySound(SoundType.MoveBlock);
     blockFacade.BlockTransform.position += movement;
     if (!_gridProcessor.CheckMovementIsValid(blockFacade.BlockTransform))
     {
         blockFacade.BlockTransform.position -= movement;
     }
 }
        public void Move(BlockFacade blockFacade)
        {
            if (!IsMovementEnabled)
            {
                return;
            }

            blockFacade.GhostBlockTransform.position = blockFacade.BlockTransform.position;
            blockFacade.GhostBlockTransform.rotation = blockFacade.BlockTransform.rotation;

            while (_gridProcessor.CheckMovementIsValid(blockFacade.GhostBlockTransform))
            {
                blockFacade.GhostBlockTransform.position += Vector3.down;
            }

            if (!_gridProcessor.CheckMovementIsValid(blockFacade.GhostBlockTransform))
            {
                blockFacade.GhostBlockTransform.position += Vector3.up;
            }
        }