Exemplo n.º 1
0
 void CheckMouseOver()
 {
     if (collider.bounds.Contains(MouseUtilities.getMouseWorldPosition()))
     {
         blockState = BlockState.MOUSEOVER;
         doMouseOverState();
     }
     else
     {
         blockState = BlockState.IDLE;
         doIdleState();
     }
 }
Exemplo n.º 2
0
    public virtual void checkDrag()
    {
        if (isSnapped() || isDropping())
        {
            return;
        }

        if (isMouseOver())
        {
            if (Input.GetMouseButton(0))
            {
                if (GameManager.GetCurrentItem() == null)
                {
                    if (isInConveyor())
                    {
                        GridManager.getConveyor().removeFromList(this);
                    }

                    setDragging();
                    sprite.color = dragColor;
                    GameManager.setCurrentItem(this);
                    AudioManager.playSfx(pickupItem);
                }
            }
        }

        if (isDragging())
        {
            transform.parent.position = MouseUtilities.getMouseWorldPosition();
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (GridManager.isInsideConveyer(transform.parent.position) && GameManager.GetCurrentItem() == this)
            {
                GridManager.getConveyor().addToConveyor(this);
            }
            else
            {
                setDropped();
                if (!isInConveyor())
                {
                    setDragIdle();
                }
            }
        }
    }
Exemplo n.º 3
0
    public virtual void CheckMouseOver()
    {
        if (collider.bounds.Contains(MouseUtilities.getMouseWorldPosition()))
        {
            if (blockState == BlockState.MOUSEOVER)
            {
                return;
            }

            blockState = BlockState.MOUSEOVER;
            doMouseOverState();
        }
        else
        {
            if (blockState == BlockState.IDLE)
            {
                return;
            }

            blockState = BlockState.IDLE;
            doIdleState();
        }
    }