public void ClearSlot(RompecabezasSlot slot)
 {
     if (slot)
     {
         slot.GetComponent <Image> ().sprite = baseTileSprite;
     }
 }
        //ESTO SOLO ES CUANDO CAES EN UN SLOT, NO AFUERA
        public void Dropped(Part dragger, RompecabezasSlot slot, int row, int column)
        {
            dragger.SetPosition(slot.transform.position);
            if (dragger.GetCurrentSlot() != null)
            {
                ClearSlot(dragger.GetCurrentSlot());
            }

            dragger.SetSlot(slot);
            dragger.GetComponent <Button> ().interactable = true;
            takenDragger = dragger;
        }
        bool IsCorrect()
        {
            List <PartModel> startParts = model.CurrentLvl().StartParts();

            foreach (PartModel startPart in startParts)
            {
                int newRow = startPart.row;
                int newCol = startPart.col;

                Direction dir = startPart.direction;

                while (true)
                {
                    newRow = DirectionPlusRow(dir, newRow);
                    newCol = DirectionPlusCol(dir, newCol);

                    RompecabezasSlot slot = tiles[TileNumber(newRow, newCol)].GetComponent <RompecabezasSlot>();

                    if (slot.IsEnd())
                    {
                        break;
                    }

                    Part currentPart = slot.GetCurrent();

                    if (currentPart == null)
                    {
                        return(false);
                    }

                    PartModel m = currentPart.Model();
                    if (m.isDouble)
                    {
                        if (!m.isCross)
                        {
                            dir = NotCrossDouble(dir, m.isLeftUp);
                        }
                    }
                    else
                    {
                        dir = GetNextDirection(m, dir);

                        if (dir == Direction.NULL)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Beispiel #4
0
 public void ReturnToOriginalPosition()
 {
     transform.position = originPosition;
     myCurrentSlot      = null;
 }
Beispiel #5
0
 public void SetSlot(RompecabezasSlot slot)
 {
     myCurrentSlot = slot;
 }