// Update is called once per frame
    void Update()
    {
        if (transform.position.x < generationPoint.position.x)
        {
            distanceBetween = Random.Range(distanceBetweenMin, distanceBetweenMax);

            platformSelector = Random.Range(0, theObjectPools.Length);

            heightChange = transform.position.y + Random.Range(maxHeightChange, -maxHeightChange);

            if (heightChange > maxHeight)
            {
                heightChange = maxHeight;
            }
            else if (heightChange < minHeight)
            {
                heightChange = minHeight;
            }

            transform.position = new Vector3(transform.position.x + platformWidths[platformSelector] + distanceBetween, heightChange, transform.position.z);

            //Instantiate(thePlatforms[platformSelector], transform.position, transform.rotation);

            GameObject newPlatform = theObjectPools[platformSelector].GetPooledObject();

            newPlatform.transform.position = transform.position;
            newPlatform.transform.rotation = transform.rotation;
            newPlatform.SetActive(true);


            /* if(Random.Range(0f,100f) < randomCoinThreshold)
             * {
             *  theCoinGenerator.SpawnCoins(new Vector3(transform.position.x, transform.position.y + platformHeight, transform.position.z), (platformWidths[platformSelector] / 3));
             *  transform.position = new Vector3(transform.position.x + (platformWidths[platformSelector] / 2)  + distanceBetween, transform.position.y, transform.position.z);
             * } */

            if (Random.Range(0f, 100f) < randomDiamondThreshold)
            {
                theCoinGenerator.SpawnDiamonds(new Vector3(transform.position.x, transform.position.y + platformHeight, transform.position.z));
            }
            else if (Random.Range(0f, 100f) < randomCoinThreshold)
            {
                theCoinGenerator.SpawnCoins(new Vector3(transform.position.x, transform.position.y + platformHeight, transform.position.z), (platformWidths[platformSelector] / 3));
                transform.position = new Vector3(transform.position.x + (platformWidths[platformSelector] / 2) + distanceBetween, transform.position.y, transform.position.z);
            }
        }
    }