2022-02-25 23:38:09 +03:00
|
|
|
using Cinemachine;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace Camera
|
|
|
|
{
|
|
|
|
public class CameraPlayerFinder : MonoBehaviour
|
|
|
|
{
|
|
|
|
private CinemachineVirtualCamera _cinemachineVirtualCamera;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
_cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
2022-02-26 18:55:49 +03:00
|
|
|
if (_cinemachineVirtualCamera.Follow == null && GameObject.FindWithTag("Player") != null && !GameObject.Find("Fixed Camera Point"))
|
2022-02-25 23:52:09 +03:00
|
|
|
_cinemachineVirtualCamera.Follow = GameObject.FindWithTag("Player").transform;
|
2022-02-25 23:38:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|