143 lines
3.9 KiB
C#
143 lines
3.9 KiB
C#
using System.Collections.Generic;
|
|
using UFS2.Gameplay;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.PostProcessing;
|
|
|
|
namespace OLDCODE
|
|
{
|
|
public class EagleEyes : MonoBehaviour
|
|
{
|
|
public Material eyeFishMaterial;
|
|
|
|
public GameObject coolDownCanvasPrefab;
|
|
|
|
private CoolDownEagle currentCooldown;
|
|
|
|
private FFishSystem fishSystem;
|
|
|
|
public bool isFishView;
|
|
|
|
private bool isReady = true;
|
|
|
|
private bool isView;
|
|
|
|
private float currentViewTimer;
|
|
|
|
private float eagleAffectProgress;
|
|
|
|
private PostProcessVolume postProcessVolume;
|
|
|
|
private ColorGrading colorGrading;
|
|
|
|
private Vignette vignette;
|
|
|
|
private float vignetteStartValue;
|
|
|
|
public float startCameraFov;
|
|
|
|
private List<Material> allEyesMaterials;
|
|
|
|
public AudioSource audioSourceHearth;
|
|
|
|
public AudioSource audioSourceFalcon;
|
|
|
|
private List<FishEntity> shownFish = new List<FishEntity>();
|
|
|
|
private void Start()
|
|
{
|
|
if (FScriptsHandler.Instance != null)
|
|
{
|
|
startCameraFov = FScriptsHandler.Instance.m_PlayerMain.m_Camera.fieldOfView;
|
|
}
|
|
if (Singleton<SaveDataManager>.Instance.HasCurrentPlayerSkill(GameManager.Skills.eagle_sens))
|
|
{
|
|
if (GameManager.Instance._playerData.eagleEyesViewTimer != 10f)
|
|
{
|
|
GameManager.Instance._playerData.eagleEyesViewTimer = 10f;
|
|
}
|
|
}
|
|
else if (Singleton<SaveDataManager>.Instance.HasCurrentPlayerSkill(GameManager.Skills.Eagle_eye))
|
|
{
|
|
if (GameManager.Instance._playerData.eagleEyesViewTimer != 5f)
|
|
{
|
|
GameManager.Instance._playerData.eagleEyesViewTimer = 5f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GameManager.Instance._playerData.eagleEyesViewTimer = 0f;
|
|
}
|
|
allEyesMaterials = new List<Material>();
|
|
fishSystem = GetComponent<FFishSystem>();
|
|
eyeFishMaterial.SetFloat("_Opacity", 0f);
|
|
if (!GameObject.FindGameObjectWithTag("ScenePostProcessing").TryGetComponent<PostProcessVolume>(out postProcessVolume))
|
|
{
|
|
Debug.LogError("EagleEye nie widzi Postprocesing");
|
|
}
|
|
else
|
|
{
|
|
if (!postProcessVolume.profile.TryGetSettings<ColorGrading>(out colorGrading))
|
|
{
|
|
Debug.LogError("EagleEye nie widzi Colorgrading");
|
|
}
|
|
if (!postProcessVolume.profile.TryGetSettings<Vignette>(out vignette))
|
|
{
|
|
Debug.LogError("EagleEye nie widzi Vignette");
|
|
}
|
|
else
|
|
{
|
|
vignetteStartValue = vignette.intensity.value;
|
|
}
|
|
}
|
|
if (GameManager.Instance._playerData.eagleEyesCoolDown > 0f)
|
|
{
|
|
currentCooldown = Object.Instantiate(coolDownCanvasPrefab, FScriptsHandler.Instance.m_Canvas.transform).GetComponent<CoolDownEagle>();
|
|
if (Singleton<SaveDataManager>.Instance.HasCurrentPlayerSkill(GameManager.Skills.eagle_sens))
|
|
{
|
|
currentCooldown.StartCooldown(CoolDownEagle.Type.Falcon);
|
|
}
|
|
else if (Singleton<SaveDataManager>.Instance.HasCurrentPlayerSkill(GameManager.Skills.Eagle_eye))
|
|
{
|
|
currentCooldown.StartCooldown(CoolDownEagle.Type.Eagle);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!FScriptsHandler.Instance || Singleton<GameCameraController>.Instance.IsCameraZoomIn || Singleton<GameCameraController>.Instance.IsZoomPlaying)
|
|
{
|
|
return;
|
|
}
|
|
if ((bool)FScriptsHandler.Instance.m_PlayerMain.currentRod && (FScriptsHandler.Instance.m_PlayerMain.currentRod.CheckIsInUse() || (bool)FScriptsHandler.Instance.m_PlayerMain.currentRod.currentFish))
|
|
{
|
|
isReady = false;
|
|
}
|
|
if (InputManager.isEagleEye && isReady && !currentCooldown && !isView && GameManager.Instance._playerData.eagleEyesViewTimer > 0f)
|
|
{
|
|
if (currentViewTimer == 0f)
|
|
{
|
|
currentViewTimer = GameManager.Instance._playerData.eagleEyesViewTimer;
|
|
}
|
|
isView = true;
|
|
startCameraFov = GameCameraController.GetCurrentFov();
|
|
}
|
|
else if (!InputManager.isEagleEye && isView)
|
|
{
|
|
isView = false;
|
|
}
|
|
_ = isView;
|
|
audioSourceHearth.volume = eagleAffectProgress * 0.2f;
|
|
audioSourceFalcon.volume = eagleAffectProgress * 0.3f;
|
|
}
|
|
|
|
private void ShowFishes()
|
|
{
|
|
}
|
|
|
|
private void HideFishes()
|
|
{
|
|
}
|
|
}
|
|
}
|