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

public class CameraControl : MonoBehaviour
{
    public int zoomLevel { get; private set; }

    private void Awake()
    {
        zoomLevel = 1;
    }

    private void FixedUpdate()
    {
        transform.position = GameManager.instance.ship.transform.position + new Vector3(-60,0,-10);
    }

    public void ZoomIn()
    {
        zoomLevel--;
        if (zoomLevel < 1) zoomLevel = 1;
        SetZoomLevel();        
    }

    public void ZoomOut()
    {
        zoomLevel++;
        if (zoomLevel > 3) zoomLevel = 3;
        SetZoomLevel();
    }
    
    private void SetZoomLevel()
    {
        if (zoomLevel == 1)
            Camera.main.orthographicSize = 175;
        if (zoomLevel == 2)
            Camera.main.orthographicSize = 350;
        if (zoomLevel == 3)
            Camera.main.orthographicSize = 700;

        GameManager.instance.ship.RefreshTrail();
    }
}
