您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
32 行
933 B
32 行
933 B
using Cinemachine;
|
|
using UnityEngine;
|
|
using UnityEngine.Assertions;
|
|
|
|
namespace Unity.Multiplayer.Samples.BossRoom.Visual
|
|
{
|
|
public class CameraController : MonoBehaviour
|
|
{
|
|
private CinemachineFreeLook m_MainCamera;
|
|
|
|
void Start()
|
|
{
|
|
AttachCamera();
|
|
}
|
|
|
|
private void AttachCamera()
|
|
{
|
|
m_MainCamera = GameObject.FindObjectOfType<CinemachineFreeLook>();
|
|
Assert.IsNotNull(m_MainCamera, "CameraController.AttachCamera: Couldn't find gameplay freelook camera");
|
|
|
|
if (m_MainCamera)
|
|
{
|
|
// camera body / aim
|
|
m_MainCamera.Follow = transform;
|
|
m_MainCamera.LookAt = transform;
|
|
// default rotation / zoom
|
|
m_MainCamera.m_Heading.m_Bias = 40f;
|
|
m_MainCamera.m_YAxis.Value = 0.5f;
|
|
}
|
|
}
|
|
}
|
|
}
|