public void OnSlidingDown()
        {
            if (isSwapping)
            {
                return;
            }

            isSwapping = true;
            swapper.SwapDown();
        }
Example #2
0
        public void SwappingDownFromItemWillSwapItWithDownItem()
        {
            Vector2      expectedSelectedItemPosition = Vector2.up;
            Vector2      selectedItemInitialPosition  = Vector2.zero;
            Item         itemDown     = CreateItem(expectedSelectedItemPosition);
            Item         selectedItem = CreateItem(selectedItemInitialPosition);
            ItemSearcher itemSearcher = CreateDownMockItemSearcher(() => itemDown);
            Swapper      swapper      = CreateSwapper(itemSearcher);

            swapper.Initialize(selectedItem);

            swapper.SwapDown();
            Vector2 selectedItemPosition = selectedItem.Position;

            Assert.AreEqual(expectedSelectedItemPosition, selectedItemPosition);
        }