// Retract
 public void Retract()
 {
     state     = PusherState.Retracting;
     startTime = Time.time;
     current   = transform.position;
     target    = start;
 }
 // Extend
 public void Extend()
 {
     state     = PusherState.Extending;
     startTime = Time.time;
     current   = transform.position;
     target    = end;
 }
    // Start is called before the first frame update
    void Start()
    {
        state = PusherState.Retracted;

        distanceTotal = Vector3.Distance(start, end);

        current = start;
        target  = start;
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(key))
        {
            Push();
        }


        if (state == PusherState.Extending || state == PusherState.Retracting)
        {
            // Calculate the fraction of current distance over total distance
            float distance         = (Time.time - startTime) * speed;
            float distanceFraction = distance / distanceTotal;

            // Put the pusher on fraction of the distance
            transform.position = Vector3.Lerp(current, target, distanceFraction);

            // If the pusher reached its total distance
            if (distance >= distanceTotal)
            {
                // Update state
                if (state == PusherState.Extending)
                {
                    state = PusherState.Extended;

                    if (doPush)
                    {
                        if (name == "Stringer")
                        {
                            GameObject.Find("Funnel").GetComponent <Funnel>().Next();
                        }

                        Retract();
                    }
                    else
                    {
                        ConfirmState();
                    }
                }
                else
                {
                    state = PusherState.Retracted;

                    if (doPush)
                    {
                        doPush = false;
                        ConfirmPush();
                    }
                    else
                    {
                        ConfirmState();
                    }
                }
            }
        }
    }