58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
|
|
using UnityEngine;
|
|
using EasyInject.Attributes;
|
|
using UnityEngine.UI;
|
|
using Cinemachine;
|
|
using Unity.VisualScripting;
|
|
[GameObjectBean(ENameType.GameObjectName)]
|
|
public class CameraShotCut : MonoBehaviour,IFollowHelp
|
|
{
|
|
[Autowired]
|
|
private AutoRotationButton autoRotation;
|
|
[Autowired]
|
|
private CameraManage cameraManage;
|
|
[SerializeField]
|
|
private GameObject follow;
|
|
[SerializeField]
|
|
private GameObject lookat;
|
|
[SerializeField]
|
|
private Vector3 offset;
|
|
private Button button;
|
|
|
|
[SerializeField]
|
|
private LayerMask layerMask;
|
|
[SerializeField]
|
|
public MonoBehaviour followHelp;
|
|
public Transform Follow => follow.transform;
|
|
|
|
public Transform FookAt => lookat.transform;
|
|
|
|
public Vector3 Offset => offset;
|
|
|
|
void Start()
|
|
{
|
|
button = GetComponent<Button>();
|
|
button.onClick.AddListener(Click);
|
|
}
|
|
public void Click()
|
|
{
|
|
autoRotation.ClickRotationBtn(true);
|
|
if (followHelp != null)
|
|
{
|
|
if(followHelp is IFollowHelp help)
|
|
{
|
|
cameraManage.ShotCut(help);
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
cameraManage.ShotCut(this);
|
|
if(!layerMask.IsUnityNull())
|
|
{
|
|
Camera.main.cullingMask = layerMask;
|
|
}
|
|
|
|
}
|
|
}
|