feat: Stage 1 캐릭터 follow 카메라 추가 작업
This commit is contained in:
31
Gameton-06/Assets/Gameton/Scripts/Camera/CameraFollow.cs
Normal file
31
Gameton-06/Assets/Gameton/Scripts/Camera/CameraFollow.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
|
||||
public class CameraFollow : MonoBehaviour
|
||||
{
|
||||
private CinemachineVirtualCamera vcam;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
vcam = GetComponent<CinemachineVirtualCamera>();
|
||||
if (vcam == null)
|
||||
{
|
||||
Debug.LogError("Cinemachine Virtual Camera component is missing!");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFollowTarget(Transform target)
|
||||
{
|
||||
if (vcam != null)
|
||||
{
|
||||
vcam.Follow = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user