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

public class SpinAroundScript : MonoBehaviour {

    bool rotate;
    float rotstart;

    public void StartRotation()
    {
        rotstart = Time.time;
        rotate = true;
    }
	
	// Update is called once per frame
	void FixedUpdate ()
    {
        if (! rotate)
            transform.rotation = Quaternion.Euler(0, 0, Mathf.Sin(0.1f * (int)(Time.time / 5)));
        else
            transform.rotation = Quaternion.Euler(0, 0, Mathf.Min(90, 5*(Time.time - rotstart)));
	}
}
