Beispiel #1
0
    public int HandleUpdate(MouseCore clicker)
    {
        moveDelay -= Time.deltaTime * 60.0f;
        if (moveDelay > 0)
        {
            return(0);
        }
        launching = false;
        int   prevX   = rowX;
        float newYPos = SetSelectedRowAndReturnY(clicker);

        if (!clicker.isHeld())
        {
            lockY = false; launchLimiter = false; lastYPos = newYPos; return(0);
        }
        int dx = rowX - prevX;

        if (dx == 0 && !launchLimiter)
        {
            launching     = (newYPos - lastYPos) > 1.25f;
            launchLimiter = launching;
            return(0);
        }
        lastYPos = newYPos;
        if (dx != 0)
        {
            moveDelay = PD.KEY_DELAY;
        }
        return(dx);
    }
Beispiel #2
0
    private float SetSelectedRowAndReturnY(MouseCore clicker)
    {
        Vector3 pos = clicker.getPositionInGameObject(rowCollider);

        if (pos.z == 0)
        {
            return(0.0f);
        }
        if (!clicker.isHeld() || !lockY)
        {
            rowY  = Mathf.FloorToInt((pos.y + halfHeight) / Consts.TILE_SIZE);
            lockY = clicker.isHeld();
        }
        aboveEverything = rowY > height;
        rowX            = Mathf.FloorToInt((pos.x + 0.85f) / Consts.TILE_SIZE);
        return((pos.y + halfHeight) / Consts.TILE_SIZE);
    }