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

public class GameEndedCameraState : BaseCameraState {
    
    private float startTime;
    private float startFov = 20;
    private float targetFov = 1;

    private float transitionDuration = 2;

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

        this.startTime = Time.time;
    }

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

        if (Time.time - this.startTime < transitionDuration) {
            var trans = (Time.time - this.startTime) / transitionDuration;

            this.gameController.CameraController.MainCamera.fieldOfView = Mathfx.Hermite(this.startFov, this.targetFov, trans);
        }
    }

    public override void DeinitState()
    {
        this.cameraController.MainCamera.fieldOfView = this.startFov;
        base.DeinitState();
    }
}
