+ 기본적인 배에서 포쏘는 로직 완료 우클릭 - 발사 모드 온/오프 좌클릭 Hold - 발사 게이지 충전 좌클릭 중단 - 발사 + 대포 발사시 카메라 흔들림 효과 추가 + 대포 재장선시 UI 추가 + 대포 재장전시 공격하면 사운드 및 UI 흔들림 효과 추가 + 카메라 고정으로 변경
65 lines
1.7 KiB
C#
65 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using Cinemachine;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class OceanCamera : MonoBehaviour
|
|
{
|
|
[Title("초기화 방식")]
|
|
[SerializeField] private bool autoInit = true;
|
|
|
|
[field: Title("카메라")]
|
|
[field: SerializeField] public CinemachineVirtualCamera BaseShipCam { get; private set; }
|
|
|
|
private List<CinemachineVirtualCamera> cineCamList;
|
|
private GameObject cineCams;
|
|
|
|
private const int CINE_CAM_NUM = 1;
|
|
|
|
private void Awake()
|
|
{
|
|
if (autoInit)
|
|
{
|
|
Init();
|
|
}
|
|
|
|
CameraManager.Inst.OceanCamera = this;
|
|
CameraManager.Inst.MainCam = Camera.main;
|
|
}
|
|
|
|
[Button("셋팅 초기화")]
|
|
private void Init()
|
|
{
|
|
cineCams = GameObject.Find("CineCameras");
|
|
if (!cineCams)
|
|
{
|
|
Debug.LogError("cineCams is null error");
|
|
return;
|
|
}
|
|
|
|
BaseShipCam = cineCams.transform.Find("BaseShipCam")?.GetComponent<CinemachineVirtualCamera>();
|
|
if (!BaseShipCam)
|
|
{
|
|
Debug.LogError("BaseShipCam is null error");
|
|
return;
|
|
}
|
|
|
|
cineCamList = new List<CinemachineVirtualCamera>(CINE_CAM_NUM)
|
|
{
|
|
BaseShipCam
|
|
};
|
|
|
|
foreach (var cam in cineCamList)
|
|
{
|
|
cam.Priority = 0;
|
|
}
|
|
|
|
BaseShipCam.Priority = 1;
|
|
|
|
CameraManager.Inst.MainCam = Camera.main;
|
|
}
|
|
}
|
|
} |