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

public class CameraControl : MonoBehaviour
{


    private Vector3 newPosition;
    private Vector3 newRotation;

    public float cameraSpeed;
    public float cameraOffset = 1;
    private int playersCount;
    private int treesCount;

    private Vector3 smoothVel = Vector3.zero;

    // Use this for initialization
    void Start()
    {
        newPosition = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        lerpCamera();
    }


    void lerpCamera()
    {
        transform.position = Vector3.SmoothDamp(transform.position, newPosition,ref smoothVel, cameraSpeed);
        transform.LookAt(newRotation);
    }

    public void setCameraPosition(Vector3 newPosition)
    {
        this.newPosition = newPosition;
    }

    public void setCameraRotation(Vector3 newRotation) {
        this.newRotation = newRotation;
    }


    public void setPlayersCount(int playersCount)
    {
        this.playersCount = playersCount;
    }

    public void setTreesCount(int treesCount)
    {
        this.treesCount = treesCount;
    }


}
