49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using BeautifyEffect;
|
|
using UFS2.Gameplay;
|
|
using UnityEngine;
|
|
|
|
public class UnderwaterFocusSphere : MonoBehaviour
|
|
{
|
|
private FPlayer player;
|
|
|
|
private FLineHandler lineHandler;
|
|
|
|
private void Start()
|
|
{
|
|
player = FScriptsHandler.Instance.m_PlayerMain;
|
|
lineHandler = GetComponentInParent<FLineHandler>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
GameCameraController.OnEnterInToWater += GameCameraControllerOnOnEnterInToWater;
|
|
GameCameraController.OnExitFromWater += GameCameraControllerOnOnExitFromWater;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
GameCameraController.OnEnterInToWater -= GameCameraControllerOnOnEnterInToWater;
|
|
GameCameraController.OnExitFromWater -= GameCameraControllerOnOnExitFromWater;
|
|
}
|
|
|
|
private void GameCameraControllerOnOnExitFromWater()
|
|
{
|
|
if (player?.currentRod?.fishingLine?.currentLineHandler == lineHandler)
|
|
{
|
|
Beautify instance = Beautify.instance;
|
|
instance.depthOfField = false;
|
|
instance.depthOfFieldTargetFocus = null;
|
|
}
|
|
}
|
|
|
|
private void GameCameraControllerOnOnEnterInToWater()
|
|
{
|
|
if (player?.currentRod?.fishingLine?.currentLineHandler == lineHandler)
|
|
{
|
|
Beautify instance = Beautify.instance;
|
|
instance.depthOfField = true;
|
|
instance.depthOfFieldTargetFocus = base.transform;
|
|
}
|
|
}
|
|
}
|