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

public class ClutterRandomizer : MonoBehaviour
{
    public Sprite[] clutters;

    float perlinCutoff = 0.5f;

    // Start is called before the first frame update
    void Awake()
    {
        float perlin = Mathf.PerlinNoise(transform.position.x * 5, transform.position.y * 5);
        if (perlin > this.perlinCutoff)
        {
            SpriteRenderer renderer = GetComponent<SpriteRenderer>();
            if (renderer != null && clutters.Length > 0)
            {
                renderer.sprite = clutters[Random.Range(0, this.clutters.Length)];
            }
        }
    }
}
