// Use this for initialization
    void Start()
    {
        // Find orbit camera in the scene
        m_OrbitCamera = FindObjectOfType<WaterFlowOrbitCamera>();

        // Add water into m_WaterList array
        m_WaterList = new Transform[this.transform.childCount];
        int i=0;
        foreach(Transform child in transform)
        {
            // Add water into m_WaterList
            m_WaterList[i] = child;
            m_WaterList[i].gameObject.SetActive(false);

            // Keep original parameters of each shader
            switch(m_WaterList[i].gameObject.GetComponent<Renderer>().material.shader.name)
            {

                case "Water Flow/Water Diffuse":

                    m_WaterDiffuseOriginal_Diffuse 		= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetColor("_MainTexColor");
                    m_WaterDiffuseOriginal_Multiply 	= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexMultiply");
                    m_WaterDiffuseOriginal_UMoveSpeed 	= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexMoveSpeedU");
                    m_WaterDiffuseOriginal_VMoveSpeed 	= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexMoveSpeedV");

                    m_WaterDiffuseOld_Diffuse			= m_WaterDiffuse_Diffuse	= m_WaterDiffuseOriginal_Diffuse;
                    m_WaterDiffuseOld_Multiply 			= m_WaterDiffuse_Multiply	= m_WaterDiffuseOriginal_Multiply;
                    m_WaterDiffuseOld_UMoveSpeed		= m_WaterDiffuse_UMoveSpeed	= m_WaterDiffuseOriginal_UMoveSpeed;
                    m_WaterDiffuseOld_VMoveSpeed		= m_WaterDiffuse_VMoveSpeed	= m_WaterDiffuseOriginal_VMoveSpeed;

                    break;

                case "Water Flow/Water Heightmap":

                    m_WaterHeightmapOriginal_WaterTile 			= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexTile");
                    m_WaterHeightmapOriginal_HeightmapTile 		= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_HeightMapTile");
                    m_WaterHeightmapOriginal_Refraction 		= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexRefraction");
                    m_WaterHeightmapOriginal_Strength 			= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_HeightMapStrength");
                    m_WaterHeightmapOriginal_Multiply 			= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_HeightMapMultiply");

                    m_WaterHeightmapOld_WaterTile		= m_WaterHeightmap_WaterTile		= m_WaterHeightmapOriginal_WaterTile;
                    m_WaterHeightmapOld_HeightmapTile	= m_WaterHeightmap_HeightmapTile	= m_WaterHeightmapOriginal_HeightmapTile;
                    m_WaterHeightmapOld_Refraction		= m_WaterHeightmap_Refraction		= m_WaterHeightmapOriginal_Refraction;
                    m_WaterHeightmapOld_Strength		= m_WaterHeightmap_Strength			= m_WaterHeightmapOriginal_Strength;
                    m_WaterHeightmapOld_Multiply		= m_WaterHeightmap_Multiply			= m_WaterHeightmapOriginal_Multiply;

                    break;

                case "Water Flow/Water Simple":

                    m_WaterSimpleOriginal_Ambient		= RenderSettings.ambientLight;
                    m_WaterSimpleOriginal_UMoveSpeed 	= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexMoveSpeedU");
                    m_WaterSimpleOriginal_VMoveSpeed 	= m_WaterList[i].gameObject.GetComponent<Renderer>().material.GetFloat("_MainTexMoveSpeedV");

                    m_WaterSimpleOld_Ambient			= m_WaterSimple_Ambient			= m_WaterSimpleOriginal_Ambient;
                    m_WaterSimpleOld_UMoveSpeed			= m_WaterSimple_UMoveSpeed		= m_WaterSimpleOriginal_UMoveSpeed;
                    m_WaterSimpleOld_VMoveSpeed			= m_WaterSimple_VMoveSpeed		= m_WaterSimpleOriginal_VMoveSpeed;

                    break;

                default:
                    break;
            }

            i++;
        }

        // set current water to zero
        m_CurrentWaterIndex = 0;

        // update m_CurrentWaterShaderType
        UpdateCurrentShaderType();
    }
    // ######################################################################
    // MonoBehaviour Functions
    // ######################################################################

    #region MonoBehaviour

    // Use this for initialization
    void Start()
    {
        // Find orbit camera in the scene
        m_OrbitCamera = FindObjectOfType <WaterFlowOrbitCamera>();

        // Add water into m_WaterList array
        m_WaterList = new Transform[this.transform.childCount];
        int i = 0;

        foreach (Transform child in transform)
        {
            // Add water into m_WaterList
            m_WaterList[i] = child;
            m_WaterList[i].gameObject.SetActive(false);

            // Keep original parameters of each shader
            switch (m_WaterList[i].gameObject.GetComponent <Renderer>().material.shader.name)
            {
            case "Water Flow/Water Diffuse":

                m_WaterDiffuseOriginal_Diffuse    = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetColor("_MainTexColor");
                m_WaterDiffuseOriginal_Multiply   = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexMultiply");
                m_WaterDiffuseOriginal_UMoveSpeed = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexMoveSpeedU");
                m_WaterDiffuseOriginal_VMoveSpeed = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexMoveSpeedV");

                m_WaterDiffuseOld_Diffuse    = m_WaterDiffuse_Diffuse = m_WaterDiffuseOriginal_Diffuse;
                m_WaterDiffuseOld_Multiply   = m_WaterDiffuse_Multiply = m_WaterDiffuseOriginal_Multiply;
                m_WaterDiffuseOld_UMoveSpeed = m_WaterDiffuse_UMoveSpeed = m_WaterDiffuseOriginal_UMoveSpeed;
                m_WaterDiffuseOld_VMoveSpeed = m_WaterDiffuse_VMoveSpeed = m_WaterDiffuseOriginal_VMoveSpeed;

                break;

            case "Water Flow/Water Heightmap":

                m_WaterHeightmapOriginal_WaterTile     = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexTile");
                m_WaterHeightmapOriginal_HeightmapTile = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_HeightMapTile");
                m_WaterHeightmapOriginal_Refraction    = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexRefraction");
                m_WaterHeightmapOriginal_Strength      = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_HeightMapStrength");
                m_WaterHeightmapOriginal_Multiply      = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_HeightMapMultiply");

                m_WaterHeightmapOld_WaterTile     = m_WaterHeightmap_WaterTile = m_WaterHeightmapOriginal_WaterTile;
                m_WaterHeightmapOld_HeightmapTile = m_WaterHeightmap_HeightmapTile = m_WaterHeightmapOriginal_HeightmapTile;
                m_WaterHeightmapOld_Refraction    = m_WaterHeightmap_Refraction = m_WaterHeightmapOriginal_Refraction;
                m_WaterHeightmapOld_Strength      = m_WaterHeightmap_Strength = m_WaterHeightmapOriginal_Strength;
                m_WaterHeightmapOld_Multiply      = m_WaterHeightmap_Multiply = m_WaterHeightmapOriginal_Multiply;

                break;

            case "Water Flow/Water Simple":

                m_WaterSimpleOriginal_Ambient    = RenderSettings.ambientLight;
                m_WaterSimpleOriginal_UMoveSpeed = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexMoveSpeedU");
                m_WaterSimpleOriginal_VMoveSpeed = m_WaterList[i].gameObject.GetComponent <Renderer>().material.GetFloat("_MainTexMoveSpeedV");

                m_WaterSimpleOld_Ambient    = m_WaterSimple_Ambient = m_WaterSimpleOriginal_Ambient;
                m_WaterSimpleOld_UMoveSpeed = m_WaterSimple_UMoveSpeed = m_WaterSimpleOriginal_UMoveSpeed;
                m_WaterSimpleOld_VMoveSpeed = m_WaterSimple_VMoveSpeed = m_WaterSimpleOriginal_VMoveSpeed;

                break;

            default:
                break;
            }

            i++;
        }

        // set current water to zero
        m_CurrentWaterIndex = 0;

        // update m_CurrentWaterShaderType
        UpdateCurrentShaderType();
    }