133 lines
3.5 KiB
C#
133 lines
3.5 KiB
C#
using UnityEngine;
|
|
using UnityEngine.Rendering.PostProcessing;
|
|
using UnityEngine.Serialization;
|
|
|
|
public class ScriptsHandler : MonoBehaviour
|
|
{
|
|
private static ScriptsHandler instance;
|
|
|
|
[HideInInspector]
|
|
public Canvas m_Canvas;
|
|
|
|
[HideInInspector]
|
|
public InputManager m_InputManager;
|
|
|
|
public PlayerMain m_PlayerMain;
|
|
|
|
[HideInInspector]
|
|
public InteractionControl m_InteractionControl;
|
|
|
|
[HideInInspector]
|
|
public CanvasManager m_CanvasManager;
|
|
|
|
[HideInInspector]
|
|
public InventoryManager m_InventoryManager;
|
|
|
|
[HideInInspector]
|
|
public SceneSettings m_SceneSettings;
|
|
|
|
[FormerlySerializedAs("m_WeatherController")]
|
|
[HideInInspector]
|
|
public GameWeatherManager mGameWeatherController;
|
|
|
|
[HideInInspector]
|
|
public HudManager m_HudManager;
|
|
|
|
[HideInInspector]
|
|
public PlayerManager playerManager;
|
|
|
|
[HideInInspector]
|
|
public Transform fishContainer;
|
|
|
|
[HideInInspector]
|
|
public Transform WaterObject;
|
|
|
|
public GameObject[] fishingObiLinesPrefab;
|
|
|
|
public GameObject fishingThrowTargetPrefab;
|
|
|
|
public GameObject underWaterCameraPrefab;
|
|
|
|
public GameObject PodbierakPrefab;
|
|
|
|
public GameObject ChwytakPrefab;
|
|
|
|
public GameObject LineHandHelper;
|
|
|
|
public GameObject[] waterFishSplash;
|
|
|
|
public GameObject fishCatchPanel;
|
|
|
|
public static ScriptsHandler Instance => instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = this;
|
|
}
|
|
PutScripts();
|
|
}
|
|
|
|
private void PutScripts()
|
|
{
|
|
playerManager = GetComponent<PlayerManager>();
|
|
m_InputManager = Object.FindObjectOfType<InputManager>();
|
|
m_PlayerMain = Object.FindObjectOfType<PlayerMain>();
|
|
m_InteractionControl = Object.FindObjectOfType<InteractionControl>();
|
|
m_Canvas = Object.FindObjectOfType<Canvas>();
|
|
m_CanvasManager = Object.FindObjectOfType<CanvasManager>();
|
|
m_InventoryManager = Object.FindObjectOfType<InventoryManager>();
|
|
WaterObject = GameObject.Find("WaterObject").transform;
|
|
m_SceneSettings = Object.FindObjectOfType<SceneSettings>();
|
|
mGameWeatherController = Object.FindObjectOfType<GameWeatherManager>();
|
|
m_HudManager = Object.FindObjectOfType<HudManager>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
AffectPostProccesingFromSettings();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.P))
|
|
{
|
|
GameManager.Instance.PauseGame();
|
|
}
|
|
}
|
|
|
|
public void AffectPostProccesingFromSettings()
|
|
{
|
|
_ = GameManager.Instance._playerData.currentPlayerProfileIndex;
|
|
if (!(GameObject.FindGameObjectWithTag("ScenePostProcessing") == null) && GameObject.FindGameObjectWithTag("ScenePostProcessing").TryGetComponent<PostProcessVolume>(out var component))
|
|
{
|
|
if (component.profile.TryGetSettings<DepthOfField>(out var outSetting))
|
|
{
|
|
outSetting.active = Singleton<SaveDataManager>.Instance.SettingsData.IsBlurEnabled;
|
|
}
|
|
if (component.profile.TryGetSettings<Bloom>(out var outSetting2))
|
|
{
|
|
outSetting2.active = Singleton<SaveDataManager>.Instance.SettingsData.IsBloomEnabled;
|
|
}
|
|
if (component.profile.TryGetSettings<ChromaticAberration>(out var outSetting3))
|
|
{
|
|
outSetting3.active = Singleton<SaveDataManager>.Instance.SettingsData.IsChromaticAberrationEnabled;
|
|
}
|
|
if (component.profile.TryGetSettings<AmbientOcclusion>(out var outSetting4))
|
|
{
|
|
outSetting4.active = Singleton<SaveDataManager>.Instance.SettingsData.IsAmbientOcclusionEnabled;
|
|
}
|
|
PostProcessLayer component2 = m_PlayerMain.m_Camera.GetComponent<PostProcessLayer>();
|
|
if ((bool)component2)
|
|
{
|
|
component2.antialiasingMode = (PostProcessLayer.Antialiasing)Singleton<SaveDataManager>.Instance.SettingsData.AntiAliasingModeIndex;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
}
|
|
}
|