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

public class Orbit : MonoBehaviour {

    public static float defaultCycleTime = 60f;
    public float cycleTime = defaultCycleTime;
    float degsPerSecond { get { return 360 / cycleTime; } }

	void Update () {
        transform.Rotate(Vector3.up, degsPerSecond * Time.deltaTime);
	}

    /// <summary>
    /// performs one orbit at the new speed, then returns to normal
    /// </summary>
    public IEnumerator Quickie(float temporaryCycleTime)
    {
        var oldTime = cycleTime;
        this.cycleTime = temporaryCycleTime;
        yield return new WaitForSeconds(temporaryCycleTime);
        cycleTime = oldTime;
    }
}
