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

public class MenuCameraState : BaseCameraState {
    
    private float rotationSpeed = 3;
    private float fov = 60;

    public Vector3 focusPosition;
    private Vector3 targetPosition;
    private Vector3 cameraOffset = new Vector3 (0, 5, -10);

    public override void InitState()
    {
        base.InitState();

        // TODO: set camera to perspective - done
        // TODO: set camera fov - done
        // TODO: set camera offset - done

        this.cameraController.MainCamera.orthographic = false;
        this.cameraController.MainCamera.fieldOfView = this.fov;
    }

    public override void UpdateState()
    {
        base.UpdateState();

        this.targetPosition = focusPosition + Quaternion.Euler(0, Time.time * this.rotationSpeed, 0) * this.cameraOffset;
        this.cameraController.MainCamera.transform.position = this.targetPosition;

        var direction = (this.focusPosition - this.targetPosition).normalized;
        this.cameraController.MainCamera.transform.forward = direction;
    }

    public override void DeinitState()
    {
        base.DeinitState();
    }
}
