using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateurPlateformes : MonoBehaviour
{
    public GameObject prefabPlateforme;
    public GameObject prefabPlateformeBonusFusee;
    public GameObject prefabPlateformeBonusSaut;

    int nbPlateforme = 510;
    float minY = 1.0f;
    float maxY = 5.0f;
    float minX = -6.0f;
    float maxX = 6.0f;

    public void GenererPlateformes()
    {
        Vector3 spawnPosition = new Vector3();

        for (int i = 0; i < nbPlateforme; i++)
        {
            spawnPosition.y += Random.Range(minY, maxY);
            spawnPosition.x = Random.Range(minX, maxX);

            //Bonus Fusée
            if (i == 18 || i == 36 || i == 54 || i == 90 || i == 108 || i == 126 || i == 144 || i == 162 || i == 180 ||
                i == 198 || i == 228 || i == 258 || i == 288 || i == 318 || i == 348 || i == 408 || i == 438 || i == 468 || i == 497)
            {
                Instantiate(prefabPlateformeBonusFusee, spawnPosition, Quaternion.identity);
            }


            //Bonus Saut
            if (i == 8 || i == 24 || i == 32 || i == 40 || i == 48 || i == 64 || i == 72 || i == 80 || i == 96 || i == 104 ||
                     i == 112 || i == 120 || i == 136 || i == 152 || i == 168 || i == 176 || i == 184 || i == 192 || i == 219 ||
                     i == 238 || i == 257 || i == 276 || i == 295 || i == 314 || i == 333 || i == 352 || i == 371 || i == 390 ||
                     i == 409 || i == 428 || i == 447 || i == 485 || i == 504)

            {
                Instantiate(prefabPlateformeBonusSaut, spawnPosition, Quaternion.identity);
            }

            //Platerforme normale
            else
            {
                Instantiate(prefabPlateforme, spawnPosition, Quaternion.identity);
            }
        }
    }
}
