using UnityEngine;
using System;

public class RotateTo : SomethingTo {

    private Quaternion fromQuaternion;
    private Quaternion targetQuaternion;

    private void Lerp(float lerp){
        transform.rotation = Quaternion.Lerp(fromQuaternion, targetQuaternion, lerp);
    }

    public void ChangeRotation(Quaternion targetQuaternion, float interval, EasingType easingType = EasingType.Linear){
        ChangeRotation(targetQuaternion, interval, ActionExtensions.EmptyAction, easingType);
    }

    public void ChangeRotation(Quaternion targetQuaternion, float interval, Action callback, EasingType easingType = EasingType.Linear){
        this.targetQuaternion = targetQuaternion;
        this.fromQuaternion = transform.rotation;
        Begin(Lerp, interval, callback, easingType);
    }
}
