Esempio n. 1
0
        private void CheckSwipe(GemView gem1, GemView gem2)
        {
            Debug.Log("Swipe attempt " + gem1.Entity.Index + " - " + gem1.Entity.Index);
            var gem1Position = entityManager.GetComponentData <BoardPositionComponent>(gem1.Entity);
            var gem2Position = entityManager.GetComponentData <BoardPositionComponent>(gem2.Entity);

            if (BoardCalculator.IsNextToEachOther(gem1Position.Position, gem2Position.Position))
            {
                StartSwap(gem1.Entity, gem2.Entity);
            }
        }
Esempio n. 2
0
 private void SelectGem(GemView gem)
 {
     if (selectedGem == null)
     {
         Select(gem);
     }
     else
     {
         var gemPosition         = entityManager.GetComponentData <BoardPositionComponent>(gem.Entity);
         var selectedGemPosition = entityManager.GetComponentData <BoardPositionComponent>(selectedGem.Entity);
         Debug.Log("Select second gem " + gem.Entity.Index);
         if (BoardCalculator.IsNextToEachOther(gemPosition.Position, selectedGemPosition.Position))
         {
             StartSwap(gem.Entity, selectedGem.Entity);
         }
         else
         {
             Select(gem);
         }
     }
 }