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

public class LevelController : MonoBehaviour {
    public GameObject level;
    private float smooth = 1f;
    private Quaternion targetRotation;

    void Start()
    {
        targetRotation = transform.rotation;
    }

	// Update is called once per frame
	void Update () {
        level.transform.rotation = transform.rotation;
        if (Input.GetKeyDown(KeyCode.Q))
        {
            SoundManager.instance.PlayWalkStep(2);
            targetRotation *= Quaternion.AngleAxis(90, Vector3.forward);        
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            SoundManager.instance.PlayWalkStep(1);
            targetRotation *= Quaternion.AngleAxis(-90, Vector3.forward);
        }

        transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, 10 * smooth * Time.deltaTime);
    }
}
