using UnityEngine;

namespace Assets.Source.Misc
{
    public class ObjectRandomizer : MonoBehaviour
    {
        public Transform Root;
        public bool RandomizeRotation;
        public Vector2 RandomScale = Vector2.one;

        private Vector3 _defaultScale;

        void Awake()
        {
            _defaultScale = Root.localScale;
        }

        void OnEnable()
        {
            if (RandomizeRotation)
                Root.localRotation = Quaternion.Euler(0, 0, Random.Range(0, 360));
            Root.localScale = _defaultScale * Random.Range(RandomScale.x, RandomScale.y);
        }
    }
}
