Exemplo n.º 1
0
    private void OnClickUp()
    {
        if (!isDragging)
        {
            return;
        }
        GearSlot _gearSlot = AllRaycasts("Slot");

        if (_gearSlot == null)       //se não achar nada devolve a engrenagem
        {
            lastSlot.GearEnter(gearColor.Color);
        }
        else if (!_gearSlot.isActive) //se achar slot vazio, coloca a engrenagem
        {
            _gearSlot.GearEnter(gearColor.Color);
        }
        else                         //se acahr slot com engrenagem, troca as engrenagens
        {
            lastSlot.GearEnter(_gearSlot.GearExit());
            _gearSlot.GearEnter(gearColor.Color);
        }

        //desliga a engrenagem arrastavel
        gearTransparency.alpha = 0f;
        isDragging             = false;
    }
Exemplo n.º 2
0
    private void OnClickDown()
    {
        GearSlot _gearSlot = AllRaycasts("Slot");

        if (_gearSlot == null)
        {
            return;
        }
        if (!_gearSlot.isActive)
        {
            return;
        }

        lastSlot = _gearSlot;

        //prepara a  engrenagem arrastavel pra seguir
        gearTransform.position = Input.mousePosition;
        gearColor.Color        = _gearSlot.GearExit();
        gearTransparency.alpha = 0.7f;

        //liga o arrastamento
        isDragging = true;
    }