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

public class Spin : MonoBehaviour
{

    public float rotationSpeed;
    public float phaseOffset;
    public float bobAmplitude;
    public float bobPeriod;

    public Vector3 initialPos;


    private void Start()
    {
        initialPos = transform.position;
    }

    private void Update()
    {
        if (rotationSpeed != 0)
            transform.rotation = Quaternion.Euler(0, rotationSpeed * Time.time + phaseOffset, 0);

        transform.position = initialPos + Vector3.up * bobAmplitude * Mathf.Sin(bobPeriod * Time.time + phaseOffset);
    }
}
