Ejemplo n.º 1
0
    void Rewind()
    {
        Vector2 scrollAmount = Input.mouseScrollDelta;
        float   rewindAmount = scrollAmount.y * scrollFactor;

        //print (rewindAmount);
        overseer.AdjustTime(rewindAmount);
    }
Ejemplo n.º 2
0
    //--------------------------------------
    // The functionality for player-input rewinding
    //--------------------------------------

    //OLD VERSION. Gotta clean it up.
    void Rewinder()
    {
        if (currentTarget == null || !currentTarget.IsRewinding())
        {
            return;
        }

        Vector2 scrollAmount = Input.mouseScrollDelta;
        float   rewindAmount = scrollAmount.y * scrollFactor;

        scrollBuffer += rewindAmount;

        if (scrollBuffer == 0)
        {
            return;
        }
        else if (scrollBuffer < 0)
        {
            rewindAmount = Mathf.Max(scrollBuffer, -maxScrollPerUpdate);
        }
        else if (scrollBuffer > 0)
        {
            rewindAmount = Mathf.Min(scrollBuffer, maxScrollPerUpdate);
        }
        scrollBuffer -= rewindAmount;
        scrollBuffer  = Mathf.Clamp(scrollBuffer, -maxBuffer, maxBuffer);

        currentTarget.AdjustTime(rewindAmount);
    }