27 lines
869 B
C#
27 lines
869 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraFollower : MonoBehaviour
|
|
{
|
|
public Transform target;
|
|
public float smoothness =0.1f;
|
|
public Vector3 offset;
|
|
public float speedFOVMultiplier = 1.3f;
|
|
float deFOV = 0;
|
|
public float fovSmoothness =0.1f;
|
|
void Start()
|
|
{
|
|
deFOV = Camera.main.orthographicSize;
|
|
// offset= transform.position - target.position;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void FixedUpdate()
|
|
{
|
|
transform.position = Vector3.Lerp(transform.position, new Vector3(target.position.x - offset.x, transform.position.y, transform.position.z), smoothness);
|
|
|
|
Camera.main.orthographicSize = Mathf.Lerp(Camera.main.orthographicSize, (!PlayerController.instance.PowerupActive) ? deFOV : deFOV * speedFOVMultiplier, fovSmoothness);
|
|
}
|
|
}
|