Ejemplo n.º 1
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        GameShape gameShape = GetSlotShape();
        ShapeData shapeData = gameShape?.GetShapeData();

        if (canInteract && canSelect && shapeData != null)
        {
            if (!selected)
            {
                GameSlot selectedSlot = GameManager.manager.GetSelectedSlot();
                if (selectedSlot != null && selectedSlot != this)
                {
                    GameManager.manager.DeselectSlot();
                }

                GameManager.manager.SelectSlot(this);
                themeElement.SetElementToHighlighted();
            }

            Color baseColor = gameShape.GetComponent <Image>().color;
            gameShape.GetComponent <Image>().color = new Color(baseColor.r, baseColor.g, baseColor.b, baseColor.a / 2f);

            DragInputManager.dragInputManager.BeginDrag(shapeData, this, gameShape?.GetComponent <Transform>().localScale ?? Vector3.one);
            beganDrag = true;
        }
    }
Ejemplo n.º 2
0
 public ShapeData GetDraggingShape()
 {
     if (dragging)
     {
         return(gameShape.GetShapeData());
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
    public ShapeData GetBoardShapeData(int slotIndex, Transform boardParent)
    {
        GameSlot slot = GetGameSlot(slotIndex, boardParent);

        if (slot.CheckCanInteract())
        {
            GameShape shape = slot.GetSlotShape();
            if (shape != null)
            {
                return(shape.GetShapeData() ?? null);
            }
            else
            {
                return(null);
            }
        }
        else
        {
            return(null);
        }
    }