using UnityEngine;

public class MovementDebug : MonoBehaviour
{
    [SerializeField]
    float rotationalSpeedX;
    [SerializeField]
    [Range(-20, 20)]
    float rotationalSpeedY;
    [SerializeField]
    [Range(-20, 20)]
    float rotationalSpeedZ;

    private void OnEnable()
    {
        RandomizeSpiralBehaviour();
    }
    public void Update()
    {
        // SpiralMovement();

        Quaternion drSpiral_Parent = Quaternion.Euler(0, Time.deltaTime * rotationalSpeedY, 0);
        Quaternion drSpiral_Child = Quaternion.Euler(0, 0, Time.deltaTime * rotationalSpeedZ);

        transform.parent.localRotation *= drSpiral_Parent;
        transform.localRotation *= drSpiral_Child;
    }

    void RandomizeSpiralBehaviour()
    {
        rotationalSpeedY = Random.Range(-20, 20);
        rotationalSpeedZ = Random.Range(-20, 20);
    }

    void SpiralMovement()
    {
        transform.Rotate(new Vector3(rotationalSpeedX, 0, 0) * Time.deltaTime);
        transform.Rotate(new Vector3(0, rotationalSpeedY, 0) * Time.deltaTime);
        transform.Rotate(new Vector3(0, 0, rotationalSpeedZ) * Time.deltaTime);
    }

}