/// <summary>
    /// Change which pipe is rattling
    /// </summary>
    /// <param name="rattle">The new pipe to rattle</param>
    private void UpdateRattlingPipe(RattlingPipe rattle)
    {
        if (rattle == m_rattlingPipe)         //if the pipe isn't being changed, don't bother with rest of code
        {
            return;
        }
        if (m_isPipeRattling)         //if a pipe is currently rattling, stop rattling the old pipe and start rattling the new one
        {
            switch (m_rattlingPipe)   //stop rattling old pipe
            {
            case (RattlingPipe.GREEN):
                m_greenPipe.StopRattling();
                break;

            case (RattlingPipe.YELLOW):
                m_yellowPipe.StopRattling();
                break;

            case (RattlingPipe.BLUE):
                m_bluePipe.StopRattling();
                break;

            case (RattlingPipe.RED):
                m_redPipe.StopRattling();
                break;

            default:
                Debug.LogError("Invalid rattling pipe type on WoodchipperReworked");
                break;
            }
            m_rattlingPipe = rattle;            //update rattling pipe
            switch (m_rattlingPipe)             //start rattling new pipe
            {
            case (RattlingPipe.GREEN):
                m_greenPipe.StartRattling();
                break;

            case (RattlingPipe.YELLOW):
                m_yellowPipe.StartRattling();
                break;

            case (RattlingPipe.BLUE):
                m_bluePipe.StartRattling();
                break;

            case (RattlingPipe.RED):
                m_redPipe.StartRattling();
                break;

            default:
                Debug.LogError("Invalid rattling pipe type on WoodchipperReworked");
                break;
            }
        }
        else         //if no pipe is currently rattling, just update the pipe
        {
            m_rattlingPipe = rattle;
        }
    }
    /// <summary>
    /// Calls base fix machine, also randomly sets a new value for all the variables
    /// </summary>
    public override void FixMachine()
    {
        //call base function
        base.FixMachine();

        //randomly generate new variables
        AxleOrientation    newAxles       = (AxleOrientation)Random.Range(0, 2);
        BladeSpinDirection newSpin        = (BladeSpinDirection)Random.Range(0, 2);
        RattlingPipe       newRattle      = (RattlingPipe)Random.Range(0, 4);
        RotationRate       newRotateSpeed = (RotationRate)Random.Range(0, 5);
        PressureGauge      newPressure    = (PressureGauge)Random.Range(0, 5);

        //Hide variables
        StopRattlingPipe();
        //TODO close panels

        //update all the variables
        UpdateAxle(newAxles);
        UpdateBlades(newSpin);
        UpdateRattlingPipe(newRattle);
        UpdateRotationRate(newRotateSpeed);
        UpdatePressure(newPressure);
    }
 /// <summary>
 /// Sets initial variables for the rattling pipe
 /// </summary>
 private void CreateRattlingPipe()
 {
     m_rattlingPipe = (RattlingPipe)Random.Range(0, 4);
 }