1689 lines
44 KiB
C#
1689 lines
44 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BitStrap;
|
|
using UltimateWater;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.PostProcessing;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityStandardAssets.ImageEffects;
|
|
using uNature.Core.FoliageClasses;
|
|
using uNature.Core.Utility;
|
|
|
|
public class GameController : MonoBehaviour
|
|
{
|
|
[Serializable]
|
|
public class TerrainPreset
|
|
{
|
|
public ReliefTerrain reliefTerrain;
|
|
|
|
public ReliefTerrainPresetHolder presetNormal;
|
|
|
|
public ReliefTerrainPresetHolder presetWinter;
|
|
|
|
public Texture2D[] splatNormal = new Texture2D[2];
|
|
|
|
public Texture2D[] splatWinter = new Texture2D[2];
|
|
}
|
|
|
|
private static GameController instance;
|
|
|
|
public HUDManager hudManagerPrefab;
|
|
|
|
[HideInInspector]
|
|
public GlobalSettings globalSettings;
|
|
|
|
[HideInInspector]
|
|
public HUDManager hudManager;
|
|
|
|
[HideInInspector]
|
|
public FishingPlayer fishingPlayer;
|
|
|
|
[HideInInspector]
|
|
public WeatherSettings weatherSettings;
|
|
|
|
[HideInInspector]
|
|
public WeatherLevelManager weatherLevelManager;
|
|
|
|
[HideInInspector]
|
|
public LevelSoundManager levelSoundManager;
|
|
|
|
[HideInInspector]
|
|
public UniStormWeatherSystem_C uniStormSystem;
|
|
|
|
[HideInInspector]
|
|
public FisheryEditor_Game fisheryEditorGame;
|
|
|
|
[HideInInspector]
|
|
public TournamentManager tournamentManager;
|
|
|
|
[HideInInspector]
|
|
public MultiplayerManager multiplayerManager;
|
|
|
|
[HideInInspector]
|
|
public JunkManager junkManager;
|
|
|
|
public WaterEffectsManager waterEffectsManager;
|
|
|
|
public Material waterInteractiveMaterial;
|
|
|
|
public LevelsManager.FisheryDefinition fisheryDefinition;
|
|
|
|
[Header("Players")]
|
|
public FishingPlayer normalPlayer;
|
|
|
|
public FishingPlayer icePlayer;
|
|
|
|
public FishingPlayer normalPlayerVR;
|
|
|
|
public FishingPlayer icePlayerVR;
|
|
|
|
[ReadOnly]
|
|
public Water water;
|
|
|
|
[ReadOnly]
|
|
public WaterParameters waterParameters;
|
|
|
|
[Space(10f)]
|
|
public GameObject fishSpawnersParent;
|
|
|
|
[HideInInspector]
|
|
public List<FishSpawner> fishSpawners = new List<FishSpawner>();
|
|
|
|
public Vector2 fishSpawnersDisabledDelay = new Vector2(0.8f, 1.2f);
|
|
|
|
public Vector2 fishSpawnersEnabledDelay = new Vector2(0.4f, 0.7f);
|
|
|
|
[ReadOnly]
|
|
public List<Material> fishMaterials = new List<Material>();
|
|
|
|
public List<Material> fishTransparentMaterials = new List<Material>();
|
|
|
|
public Shader fishShaderNormal;
|
|
|
|
public Shader fishShaderHunter;
|
|
|
|
public Color hunterMaterialColor = Color.yellow;
|
|
|
|
public AnimationCurve hunterMaterialCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
|
|
|
|
[Space(10f)]
|
|
public int fisheryId;
|
|
|
|
public int fisheryIceId = -1;
|
|
|
|
public string startMessage = string.Empty;
|
|
|
|
public bool allowFishing = true;
|
|
|
|
public bool fightTest;
|
|
|
|
public bool jumpTest;
|
|
|
|
public bool tireAtCatch;
|
|
|
|
public bool alwaysWantBait;
|
|
|
|
public bool alwaysWantBaitSize;
|
|
|
|
public bool alwaysWantBaitExceptSize;
|
|
|
|
public bool hideWater;
|
|
|
|
public bool thickLine;
|
|
|
|
public bool useFishRotationDuringFight = true;
|
|
|
|
public bool optimalRopeGenerator = true;
|
|
|
|
public bool fishingNetTest;
|
|
|
|
public bool manualFishingNet = true;
|
|
|
|
public bool stopBaitOnWater;
|
|
|
|
public float fishRotateTweenSpeed = 1f;
|
|
|
|
public float youngFishChance = 0.15f;
|
|
|
|
public float youngSizeFactor = 0.2f;
|
|
|
|
public bool useFastRopeDraw = true;
|
|
|
|
public bool quickCheckBehaviorDistance;
|
|
|
|
[Space(10f)]
|
|
public bool oceanLevel;
|
|
|
|
public bool endlessWaterArea = true;
|
|
|
|
public string harbourScene = string.Empty;
|
|
|
|
public bool isTournament;
|
|
|
|
public bool isMultiplayer;
|
|
|
|
public bool multiAnyLanguage;
|
|
|
|
public bool multiPrivateRoom;
|
|
|
|
public string multiRoomName = string.Empty;
|
|
|
|
[Space(10f)]
|
|
public GameObject playerPrefab;
|
|
|
|
public GameObject[] spawnPoints;
|
|
|
|
public List<GameObject> quickJumpPoints = new List<GameObject>();
|
|
|
|
private int currentQuickJump;
|
|
|
|
public int fisheryExitCounter;
|
|
|
|
public float fisheryExitTimer;
|
|
|
|
public float fisheryExitDelay = 5f;
|
|
|
|
public float fisheryExitBoatDelay = 10f;
|
|
|
|
[ReadOnly]
|
|
public bool resetingPlayer;
|
|
|
|
private BoatSimulator[] allBoats;
|
|
|
|
[HideInInspector]
|
|
public ReflectionProbe reflectionProbe;
|
|
|
|
public ReflectionProbe[] reflectionProbes;
|
|
|
|
[HideInInspector]
|
|
public bool isInitialized;
|
|
|
|
[Space(10f)]
|
|
public bool spawnAllAtStart = true;
|
|
|
|
public bool showFishIndicator = true;
|
|
|
|
[ReadOnly]
|
|
public int fishCount;
|
|
|
|
public float fishSpawnersAmount = 0.5f;
|
|
|
|
public float fishSizeMultiplier = 1f;
|
|
|
|
public float fishViewDistance = 25f;
|
|
|
|
public float fishViewCurrentDistance;
|
|
|
|
[ReadOnly]
|
|
public int spawnersCount;
|
|
|
|
public List<Fish> fishFromDLC = new List<Fish>();
|
|
|
|
public float fishSpawnersDLCAmount = 0.3f;
|
|
|
|
public List<FishSpawner> fishSpawnersDLC = new List<FishSpawner>();
|
|
|
|
public bool newSpawnersDeactivateMethod;
|
|
|
|
private bool firstUpdate = true;
|
|
|
|
[Space(10f)]
|
|
public float vrLodBias = 0.6f;
|
|
|
|
public float vrLodBiasIce = 0.6f;
|
|
|
|
public int shadowDistance = 150;
|
|
|
|
public int shadowDistanceWinter = 150;
|
|
|
|
public int shadowMaxCascades = 2;
|
|
|
|
public int shadowMaxCascadesWinter = 2;
|
|
|
|
public float shadow2CascadeSplit = 0.11f;
|
|
|
|
public Vector3 shadow4CascadeSplit = new Vector3(0.08f, 0.13f, 0.467f);
|
|
|
|
public ShadowResolution maxShadowResolution = ShadowResolution.High;
|
|
|
|
[HideInInspector]
|
|
public GameObject[] grassObjects;
|
|
|
|
[HideInInspector]
|
|
public RefreshVRQuality[] refreshVRQualityAll;
|
|
|
|
public List<int> grassIds = new List<int>();
|
|
|
|
public Vector2 unityGrassDistance = Vector2.zero;
|
|
|
|
public int vrGrassDistance = 30;
|
|
|
|
public float vrGrassDensity = 0.2f;
|
|
|
|
public List<GameObject> testHideObjects = new List<GameObject>();
|
|
|
|
public List<GameObject> testHideObjects2 = new List<GameObject>();
|
|
|
|
public List<GameObject> normalObjects = new List<GameObject>();
|
|
|
|
public List<GameObject> iceObjects = new List<GameObject>();
|
|
|
|
public List<GameObject> iceFishSpawners = new List<GameObject>();
|
|
|
|
public List<GameObject> fishEscapeColliders = new List<GameObject>();
|
|
|
|
[Header("Ice Fishing")]
|
|
public bool iceLevel;
|
|
|
|
public Water normalWater;
|
|
|
|
public Water iceWater;
|
|
|
|
public List<Water> watersToSwitch = new List<Water>();
|
|
|
|
[ReadOnly]
|
|
public AzureSky_Controller azureSkyController;
|
|
|
|
public AzureSky_Controller azureSkyController_NORMAL;
|
|
|
|
public AzureSky_Controller azureSkyController_WINTER;
|
|
|
|
[HideInInspector]
|
|
public UltimateWater.WaterRipples waterRipples;
|
|
|
|
public GameObject iceTop;
|
|
|
|
public GameObject iceBottom;
|
|
|
|
[Header("Terrains")]
|
|
public List<TerrainPreset> terrainPresets = new List<TerrainPreset>();
|
|
|
|
public List<GameObject> terrainsNormal = new List<GameObject>();
|
|
|
|
public List<GameObject> terrainsIce = new List<GameObject>();
|
|
|
|
public List<GameObject> terrainsMeshTest = new List<GameObject>();
|
|
|
|
[ReadOnly]
|
|
public GameObject[] nightObjects;
|
|
|
|
[ReadOnly]
|
|
public bool isNight;
|
|
|
|
[ReadOnly]
|
|
public bool cursorVisible;
|
|
|
|
[Header("Use new code params")]
|
|
[Space(10f)]
|
|
public bool useNewBaitSizeCheck;
|
|
|
|
public bool useFishesPool;
|
|
|
|
public bool useConstTaste;
|
|
|
|
public float constTaste = -1f;
|
|
|
|
public List<ReliefTerrain> reliefTerrainsToChangeTiles = new List<ReliefTerrain>();
|
|
|
|
public Vector2 tilesSize = new Vector2(3f, 3f);
|
|
|
|
public static GameController Instance
|
|
{
|
|
get
|
|
{
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
private GameController()
|
|
{
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = this;
|
|
}
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
if (GlobalSettings.Instance.turnOnMyCheats)
|
|
{
|
|
fightTest = true;
|
|
alwaysWantBait = true;
|
|
}
|
|
else
|
|
{
|
|
fightTest = false;
|
|
thickLine = false;
|
|
alwaysWantBait = false;
|
|
alwaysWantBaitSize = false;
|
|
alwaysWantBaitExceptSize = false;
|
|
}
|
|
fishingNetTest = false;
|
|
fisheryDefinition = GlobalSettings.Instance.levelsManager.GetCurrentFishery();
|
|
GlobalSettings.Instance.equipmentManager.CheckStartEquipment();
|
|
if (VRManager.IsVROn())
|
|
{
|
|
VRControllersManager.Instance.ShowHandsQuick(VRControllersManager.Instance.handsVisible);
|
|
}
|
|
}
|
|
Debug.Log("<b>---------------------- ENTER LEVEL ----------------------</b>");
|
|
Debug.Log(SceneManager.GetActiveScene().name);
|
|
AudioController.PauseMusic(3f);
|
|
hudManager = UnityEngine.Object.Instantiate(hudManagerPrefab);
|
|
hudManager.transform.parent = base.transform.parent;
|
|
fisheryEditorGame = UnityEngine.Object.FindObjectOfType<FisheryEditor_Game>();
|
|
if ((bool)fisheryEditorGame)
|
|
{
|
|
fisheryEditorGame.Initialize();
|
|
}
|
|
else
|
|
{
|
|
InitializeAwake();
|
|
}
|
|
if (!GlobalSettings.Instance)
|
|
{
|
|
float num = (QualitySettings.shadowDistance = ((!iceLevel) ? shadowDistance : shadowDistanceWinter));
|
|
QualitySettings.shadowCascades = ((!iceLevel) ? shadowMaxCascades : shadowMaxCascadesWinter);
|
|
if (QualitySettings.shadowCascades == 4)
|
|
{
|
|
Vector3 zero = Vector3.zero;
|
|
float num3 = 150f / num;
|
|
zero = Instance.shadow4CascadeSplit * num3;
|
|
QualitySettings.shadowCascade4Split = zero;
|
|
}
|
|
else if (QualitySettings.shadowCascades == 2)
|
|
{
|
|
QualitySettings.shadowCascade2Split = shadow2CascadeSplit;
|
|
}
|
|
}
|
|
if (!Application.isEditor)
|
|
{
|
|
}
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
if (fisheryEditorGame == null)
|
|
{
|
|
InitializeStart();
|
|
}
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
if ((bool)LoadingManager.Instance)
|
|
{
|
|
LoadingManager.Instance.SpawnFish();
|
|
}
|
|
LoadingManager.spawnFish = true;
|
|
if (iceLevel)
|
|
{
|
|
for (int i = 0; i < terrainsNormal.Count; i++)
|
|
{
|
|
UnityEngine.Object.DestroyImmediate(terrainsNormal[i], true);
|
|
}
|
|
for (int j = 0; j < terrainsIce.Count; j++)
|
|
{
|
|
terrainsIce[j].SetActive(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int k = 0; k < terrainsNormal.Count; k++)
|
|
{
|
|
terrainsNormal[k].SetActive(true);
|
|
}
|
|
for (int l = 0; l < terrainsIce.Count; l++)
|
|
{
|
|
UnityEngine.Object.DestroyImmediate(terrainsIce[l], true);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
LeanTween.cancelAll();
|
|
UpdateHunterFishMaterials(false, 0f);
|
|
ResetHunterFishMaterials();
|
|
UpdateTransparentFishMaterials(false);
|
|
if ((bool)waterParameters)
|
|
{
|
|
waterParameters.Reset();
|
|
}
|
|
}
|
|
|
|
private void OnApplicationFocus(bool hasFocus)
|
|
{
|
|
if (Application.isEditor || hasFocus || !hudManager || hudManager.currentHudState == HUDManager.HUDState.PAUSE || !isMultiplayer || !isTournament)
|
|
{
|
|
}
|
|
if (!Application.isEditor)
|
|
{
|
|
if (!hasFocus)
|
|
{
|
|
cursorVisible = Cursor.visible;
|
|
return;
|
|
}
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
Cursor.visible = cursorVisible;
|
|
Cursor.lockState = ((!cursorVisible) ? CursorLockMode.Locked : CursorLockMode.None);
|
|
}
|
|
}
|
|
|
|
public void InitializeAwake()
|
|
{
|
|
globalSettings = GlobalSettings.Instance;
|
|
fishViewCurrentDistance = fishViewDistance;
|
|
weatherLevelManager = GetComponent<WeatherLevelManager>();
|
|
weatherLevelManager.gameController = this;
|
|
if ((bool)globalSettings)
|
|
{
|
|
globalSettings.weatherSettings.GenerateRandomWeather();
|
|
weatherSettings = globalSettings.weatherSettings;
|
|
if (!fisheryEditorGame)
|
|
{
|
|
iceLevel = globalSettings.levelsManager.GetCurrentFishery().iceLevel;
|
|
}
|
|
manualFishingNet = globalSettings.playerSettings.manualFishingNet;
|
|
globalSettings.equipmentManager.ResetChanged();
|
|
}
|
|
Debug.Log("iceLevel: " + iceLevel);
|
|
if (spawnPoints.Length == 0)
|
|
{
|
|
GameObject[] array = MultiTags.FindGameObjectsWithMultiTag("SPAWN_POINT");
|
|
spawnPoints = new GameObject[2];
|
|
spawnPoints[0] = array[0];
|
|
spawnPoints[1] = array[0];
|
|
}
|
|
uniStormSystem = UnityEngine.Object.FindObjectOfType<UniStormWeatherSystem_C>();
|
|
if ((bool)azureSkyController_NORMAL && !iceLevel)
|
|
{
|
|
azureSkyController_NORMAL.gameObject.SetActive(true);
|
|
azureSkyController_WINTER.gameObject.SetActive(false);
|
|
azureSkyController = azureSkyController_NORMAL;
|
|
}
|
|
else if ((bool)azureSkyController_WINTER && iceLevel)
|
|
{
|
|
azureSkyController_NORMAL.gameObject.SetActive(false);
|
|
azureSkyController_WINTER.gameObject.SetActive(true);
|
|
azureSkyController = azureSkyController_WINTER;
|
|
}
|
|
else
|
|
{
|
|
azureSkyController = UnityEngine.Object.FindObjectOfType<AzureSky_Controller>();
|
|
}
|
|
levelSoundManager = azureSkyController.GetComponent<LevelSoundManager>();
|
|
levelSoundManager.Initialize();
|
|
if ((bool)uniStormSystem)
|
|
{
|
|
uniStormSystem.gameController = Instance;
|
|
}
|
|
tournamentManager = GetComponent<TournamentManager>();
|
|
junkManager = GetComponent<JunkManager>();
|
|
nightObjects = MultiTags.FindGameObjectsWithMultiTag("NIGHT_OBJECT");
|
|
grassObjects = MultiTags.FindGameObjectsWithMultiTag("GRASS");
|
|
refreshVRQualityAll = UnityEngine.Object.FindObjectsOfType<RefreshVRQuality>();
|
|
if (VRManager.IsVROn())
|
|
{
|
|
fishingPlayer = ((!iceLevel) ? normalPlayerVR : icePlayerVR);
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer = ((!iceLevel) ? normalPlayer : icePlayer);
|
|
}
|
|
normalPlayer.gameObject.SetActive(fishingPlayer == normalPlayer);
|
|
if ((bool)icePlayer)
|
|
{
|
|
icePlayer.gameObject.SetActive(fishingPlayer == icePlayer);
|
|
}
|
|
normalPlayerVR.gameObject.SetActive(fishingPlayer == normalPlayerVR);
|
|
if ((bool)icePlayerVR)
|
|
{
|
|
icePlayerVR.gameObject.SetActive(fishingPlayer == icePlayerVR);
|
|
}
|
|
if ((bool)fishingPlayer)
|
|
{
|
|
fishingPlayer.gameObject.SetActive(true);
|
|
}
|
|
else if (fishingPlayer == null && (bool)playerPrefab)
|
|
{
|
|
fishingPlayer = UnityEngine.Object.Instantiate(playerPrefab, spawnPoints[iceLevel ? 1 : 0].transform.position, spawnPoints[iceLevel ? 1 : 0].transform.rotation).GetComponent<FishingPlayer>();
|
|
}
|
|
fishingPlayer.transform = fishingPlayer.GetComponent<Transform>();
|
|
if ((bool)fisheryEditorGame)
|
|
{
|
|
fisheryEditorGame.fakeAudioListener.gameObject.SetActive(false);
|
|
}
|
|
if (oceanLevel || FishingPlayer.playerWasInBoat)
|
|
{
|
|
BoatSimulator boatSimulator = UnityEngine.Object.FindObjectOfType<BoatSimulator>();
|
|
fishingPlayer.startTransform = boatSimulator.enterPosition;
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.startTransform = spawnPoints[iceLevel ? 1 : 0].transform;
|
|
}
|
|
allBoats = UnityEngine.Object.FindObjectsOfType<BoatSimulator>();
|
|
if ((bool)GlobalSettings.Instance && !GlobalSettings.Instance.turnOnCheats)
|
|
{
|
|
showFishIndicator = false;
|
|
fishingPlayer.ufpsWeaponCamera.cullingMask = Utilities.RemoveFromLayerMask(fishingPlayer.ufpsWeaponCamera.cullingMask, "Debug");
|
|
}
|
|
junkManager.fishingPlayer = fishingPlayer;
|
|
if (spawnPoints != null)
|
|
{
|
|
GameObject[] array2 = spawnPoints;
|
|
foreach (GameObject gameObject in array2)
|
|
{
|
|
gameObject.GetComponent<SpawnPoint>().HideSpawnPoint();
|
|
}
|
|
}
|
|
water = UnityEngine.Object.FindObjectOfType<Water>();
|
|
CreateWaterCollider();
|
|
if ((bool)normalWater)
|
|
{
|
|
normalWater.gameObject.SetActive(!iceLevel);
|
|
}
|
|
if ((bool)iceWater)
|
|
{
|
|
iceWater.gameObject.SetActive(iceLevel);
|
|
}
|
|
if ((bool)normalWater)
|
|
{
|
|
water = ((!iceLevel) ? normalWater : iceWater);
|
|
}
|
|
if ((bool)water)
|
|
{
|
|
}
|
|
if ((bool)LoadingManager.Instance)
|
|
{
|
|
LoadingManager.Instance.ShowLoadingFishText();
|
|
}
|
|
if (!iceLevel)
|
|
{
|
|
for (int j = 0; j < iceFishSpawners.Count; j++)
|
|
{
|
|
UnityEngine.Object.DestroyImmediate(iceFishSpawners[j].gameObject);
|
|
iceFishSpawners[j] = null;
|
|
}
|
|
iceFishSpawners.Clear();
|
|
}
|
|
GameObject[] array3 = MultiTags.FindGameObjectsWithMultiTag("FISH_SPAWNER");
|
|
if (array3 != null)
|
|
{
|
|
if (fishFromDLC.Count > 0)
|
|
{
|
|
if ((bool)GlobalSettings.Instance && !GlobalSettings.Instance.fishManager.GetFishDefinition(fishFromDLC[0].species).isAvailableFromDLCs)
|
|
{
|
|
Debug.LogError("DLC not available: " + GlobalSettings.Instance.fishManager.GetFishDefinition(fishFromDLC[0].species).fromDLC[0]);
|
|
}
|
|
else
|
|
{
|
|
fishSpawnersDLC.Clear();
|
|
GameObject[] array4 = array3;
|
|
foreach (GameObject gameObject2 in array4)
|
|
{
|
|
fishSpawnersDLC.Add(gameObject2.GetComponent<FishSpawner>());
|
|
}
|
|
fishSpawnersDLC.RandomizeList();
|
|
int num = Mathf.RoundToInt((float)fishSpawnersDLC.Count * fishSpawnersDLCAmount);
|
|
fishSpawnersDLC.RemoveRange(num, fishSpawnersDLC.Count - num);
|
|
foreach (FishSpawner item in fishSpawnersDLC)
|
|
{
|
|
item.fishPrefabsDLC.Clear();
|
|
foreach (Fish item2 in fishFromDLC)
|
|
{
|
|
item.fishPrefabsDLC.Add(item2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
GameObject[] array5 = array3;
|
|
foreach (GameObject gameObject3 in array5)
|
|
{
|
|
FishSpawner component = gameObject3.GetComponent<FishSpawner>();
|
|
if (component.alwaysSpawn)
|
|
{
|
|
component.SpawnAllFish();
|
|
component.InitializeAllFish();
|
|
component.CheckBehaviorDistance();
|
|
}
|
|
else
|
|
{
|
|
fishSpawners.Add(component);
|
|
}
|
|
}
|
|
}
|
|
for (int m = 0; m < fishSpawners.Count; m++)
|
|
{
|
|
FishSpawner value = fishSpawners[m];
|
|
int index = UnityEngine.Random.Range(m, fishSpawners.Count);
|
|
fishSpawners[m] = fishSpawners[index];
|
|
fishSpawners[index] = value;
|
|
}
|
|
spawnersCount = Mathf.CeilToInt(fishSpawnersAmount * (float)fishSpawners.Count);
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
spawnersCount = Mathf.CeilToInt((float)spawnersCount * GlobalSettings.Instance.renderSettings.GetQualityDefinition().fishSpawnersAmount);
|
|
}
|
|
Debug.Log("spawnersCount: " + spawnersCount);
|
|
for (int n = 0; n < fishSpawners.Count; n++)
|
|
{
|
|
if (n < spawnersCount)
|
|
{
|
|
if (spawnAllAtStart || fishSpawners[n].spawnAtStart)
|
|
{
|
|
fishSpawners[n].SpawnAllFish();
|
|
}
|
|
fishCount += fishSpawners[n].count;
|
|
}
|
|
else
|
|
{
|
|
fishSpawners[n].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
if (fishSpawnersParent == null && fishSpawners.Count > 0)
|
|
{
|
|
fishSpawnersParent = fishSpawners[0].transform.root.gameObject;
|
|
}
|
|
GetAvailableFishMaterials();
|
|
reflectionProbes = UnityEngine.Object.FindObjectsOfType<ReflectionProbe>();
|
|
}
|
|
|
|
public void InitializeStart()
|
|
{
|
|
if ((bool)globalSettings)
|
|
{
|
|
isMultiplayer = globalSettings.levelsManager.isMultiplayer;
|
|
}
|
|
multiplayerManager = MultiplayerManager.Instance;
|
|
if (isMultiplayer)
|
|
{
|
|
multiplayerManager.Initialize();
|
|
}
|
|
if ((bool)globalSettings && !fisheryEditorGame)
|
|
{
|
|
isTournament = globalSettings.levelsManager.isTournament;
|
|
}
|
|
if (isTournament)
|
|
{
|
|
tournamentManager.Initialize();
|
|
}
|
|
if (hudManager == null)
|
|
{
|
|
hudManager = HUDManager.Instance;
|
|
}
|
|
hudManager.gameController = Instance;
|
|
hudManager.fishingPlayer = fishingPlayer;
|
|
hudManager.ResetHUD();
|
|
if ((bool)MapController.Instance)
|
|
{
|
|
MapController.Instance.Initialize();
|
|
}
|
|
fishingPlayer.Initialize();
|
|
fishingPlayer.unSeeker.enabled = true;
|
|
if (VRManager.IsVROn() && VRManager.GetControllerType(true) == OVRInput.OpenVRController.OculusTouch)
|
|
{
|
|
fishingPlayer.waterCamera.RenderMode = WaterRenderMode.DefaultQueue;
|
|
fishingPlayer.underwaterWaterCamera.RenderMode = WaterRenderMode.DefaultQueue;
|
|
}
|
|
if ((bool)globalSettings)
|
|
{
|
|
ShowBaitIndicator(globalSettings.playerSettings.showBaitIndicator);
|
|
}
|
|
if ((bool)hudManager.kgfMapSystem)
|
|
{
|
|
hudManager.kgfMapSystem.SetTarget(fishingPlayer.gameObject);
|
|
}
|
|
weatherLevelManager.UpdateWeather(true);
|
|
BoatSimulator[] array = UnityEngine.Object.FindObjectsOfType<BoatSimulator>();
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
array[i].Initialize();
|
|
}
|
|
if ((bool)water)
|
|
{
|
|
Utilities.SetLayerRecursively(water.gameObject, LayerMask.NameToLayer("Water"));
|
|
if ((bool)fishingPlayer.rain.GetComponent<WaterParticleDisplacement>()._System)
|
|
{
|
|
fishingPlayer.rain.GetComponent<WaterParticleDisplacement>().Initialize(water);
|
|
}
|
|
waterParameters = water.GetComponent<WaterParameters>();
|
|
waterParameters.water = water;
|
|
waterParameters.Initialize();
|
|
waterParameters.Reset();
|
|
}
|
|
waterEffectsManager.Initialize();
|
|
ShowIceBottom(false);
|
|
for (int j = 0; j < fishSpawners.Count; j++)
|
|
{
|
|
fishSpawners[j].InitializeAllFish();
|
|
}
|
|
int num = 0;
|
|
int[] array2 = new int[5];
|
|
for (int k = 0; k < fishSpawners.Count; k++)
|
|
{
|
|
if (fishSpawners[k].gameObject.activeSelf)
|
|
{
|
|
foreach (Fish fish in fishSpawners[k].fishList)
|
|
{
|
|
array2[fish.baitSize - 1]++;
|
|
}
|
|
}
|
|
num += fishSpawners[k].count;
|
|
}
|
|
num = Mathf.RoundToInt((float)num * fishSpawnersAmount);
|
|
Debug.Log("fishSizes: " + array2.ToStringFull() + " total: " + num);
|
|
for (int l = 0; l < normalObjects.Count; l++)
|
|
{
|
|
if ((bool)normalObjects[l])
|
|
{
|
|
normalObjects[l].SetActive(!iceLevel);
|
|
}
|
|
}
|
|
for (int m = 0; m < iceObjects.Count; m++)
|
|
{
|
|
if ((bool)iceObjects[m])
|
|
{
|
|
iceObjects[m].SetActive(iceLevel);
|
|
}
|
|
}
|
|
if ((bool)fisheryEditorGame)
|
|
{
|
|
fisheryEditorGame.LateInitialize();
|
|
}
|
|
UpdateTerrains();
|
|
StartCoroutine(Utilities.CleanUp());
|
|
Utilities.CheckTextureMemory();
|
|
if (startMessage != string.Empty)
|
|
{
|
|
hudManager.ShowMessage(startMessage, 15f);
|
|
}
|
|
if (VRManager.IsVROn())
|
|
{
|
|
if (!VRManager.Instance.IsControllersInput())
|
|
{
|
|
VRManager.Instance.Recenter();
|
|
}
|
|
OVRInput.UpdateXRControllerNodeIds(true);
|
|
}
|
|
if ((bool)globalSettings)
|
|
{
|
|
}
|
|
isInitialized = true;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if ((bool)fisheryEditorGame)
|
|
{
|
|
if (fisheryEditorGame.m_isLoading)
|
|
{
|
|
return;
|
|
}
|
|
if (!isInitialized)
|
|
{
|
|
InitializeAwake();
|
|
InitializeStart();
|
|
return;
|
|
}
|
|
}
|
|
if (firstUpdate && isInitialized)
|
|
{
|
|
RenderAllProbes();
|
|
if ((bool)globalSettings)
|
|
{
|
|
globalSettings.renderSettings.OnSceneChanged();
|
|
globalSettings.renderSettings.RefreshAll();
|
|
}
|
|
UpdateNightObjects(true);
|
|
UpdateHunterFishMaterials(false, 0f);
|
|
hudManager.ShowRadar(false);
|
|
if ((bool)water)
|
|
{
|
|
}
|
|
firstUpdate = false;
|
|
LeanTween.delayedCall(2f, (Action)delegate
|
|
{
|
|
});
|
|
}
|
|
else
|
|
{
|
|
if ((bool)BugReporter.Instance && BugReporter.Instance.isVisible)
|
|
{
|
|
return;
|
|
}
|
|
if (fisheryDefinition != null)
|
|
{
|
|
LevelsManager.FisheryStats fisheryStats = fisheryDefinition.fisheryStats;
|
|
fisheryStats.timeSpent = (float)fisheryStats.timeSpent + Time.deltaTime;
|
|
}
|
|
if (isMultiplayer)
|
|
{
|
|
multiplayerManager.MakeUpdate();
|
|
}
|
|
if (isTournament)
|
|
{
|
|
tournamentManager.MakeUpdate();
|
|
}
|
|
if ((bool)junkManager)
|
|
{
|
|
junkManager.MakeUpdate();
|
|
}
|
|
if (fisheryExitCounter > 0)
|
|
{
|
|
if (fisheryExitTimer > 0f)
|
|
{
|
|
fisheryExitTimer -= Time.deltaTime;
|
|
}
|
|
if (fisheryExitTimer <= 0f && !resetingPlayer)
|
|
{
|
|
fisheryExitTimer = 0f;
|
|
fisheryExitCounter = 0;
|
|
if (oceanLevel)
|
|
{
|
|
hudManager.PortReturn();
|
|
}
|
|
else if ((bool)fishingPlayer.boatSimulator)
|
|
{
|
|
StartCoroutine(fishingPlayer.EnterBoat(false, fishingPlayer.boatSimulator));
|
|
}
|
|
else
|
|
{
|
|
StartCoroutine(ResetPlayer(true));
|
|
}
|
|
Debug.Log("ResetPlayer fisheryExit " + fisheryExitCounter + " " + fisheryExitTimer);
|
|
hudManager.infoFisheryExit.SetActive(false);
|
|
}
|
|
hudManager.infoFisheryExitTimer.text = string.Empty + Mathf.RoundToInt(fisheryExitTimer);
|
|
}
|
|
if (!fishingPlayer.boatSimulator || fishingPlayer.boatSimulator.currentState == BoatSimulator.BoatState.PLAYER_DRIVING)
|
|
{
|
|
}
|
|
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.KeypadPlus) || Input.GetKeyDown(KeyCode.Plus) || Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.Period))
|
|
{
|
|
ChangeHour(true);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.KeypadMinus) || Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.Underscore) || Input.GetKeyDown(KeyCode.Comma))
|
|
{
|
|
ChangeHour(false);
|
|
}
|
|
}
|
|
if ((!isTournament || !tournamentManager.tournamentActive) && UtilitiesInput.GetButtonDown("FREEZE_GAME") && hudManager.currentHudState == HUDManager.HUDState.GAME)
|
|
{
|
|
Time.timeScale = ((Time.timeScale != 0f) ? 0f : 1f);
|
|
}
|
|
if (GlobalSettings.Instance == null || ((bool)GlobalSettings.Instance && GlobalSettings.Instance.turnOnCheats))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Tab))
|
|
{
|
|
Cursor.lockState = (Cursor.visible ? CursorLockMode.Locked : CursorLockMode.None);
|
|
Cursor.visible = !Cursor.visible;
|
|
fishingPlayer.ufpsInput.AllowGameplayInput = !Cursor.visible;
|
|
if (fishingPlayer.currentState != FishingPlayer.PlayerState.NORMAL && fishingPlayer.currentState != FishingPlayer.PlayerState.FISHING)
|
|
{
|
|
fishingPlayer.ufpsInput.AllowGameplayInput = false;
|
|
}
|
|
fishingPlayer.ufpsCamera.freezeInput = Cursor.visible;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.F11))
|
|
{
|
|
showFishIndicator = !showFishIndicator;
|
|
if (showFishIndicator)
|
|
{
|
|
fishingPlayer.ufpsWeaponCamera.cullingMask = Utilities.AddToLayerMask(fishingPlayer.ufpsWeaponCamera.cullingMask, "Debug");
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.ufpsWeaponCamera.cullingMask = Utilities.RemoveFromLayerMask(fishingPlayer.ufpsWeaponCamera.cullingMask, "Debug");
|
|
}
|
|
}
|
|
if (Input.GetKey(KeyCode.LeftControl))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Space) && fishingPlayer.currentHands.bait.isOnWater)
|
|
{
|
|
fishingPlayer.currentHands.bait.rigidbody.isKinematic = true;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.KeypadMultiply))
|
|
{
|
|
weatherLevelManager.SetPrecipitation((!(weatherLevelManager.GetPercipitation() > 0f)) ? 1f : 0f);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad7))
|
|
{
|
|
Terrain[] array = UnityEngine.Object.FindObjectsOfType<Terrain>();
|
|
Terrain[] array2 = array;
|
|
foreach (Terrain terrain in array2)
|
|
{
|
|
terrain.enabled = !terrain.enabled;
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad9))
|
|
{
|
|
fishingPlayer.currentHands.reel.maxLineLength = 1000f;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad4))
|
|
{
|
|
foreach (GameObject item in terrainsNormal)
|
|
{
|
|
if (item != null)
|
|
{
|
|
Terrain component = item.GetComponent<Terrain>();
|
|
if (component != null)
|
|
{
|
|
component.drawTreesAndFoliage = !component.drawTreesAndFoliage;
|
|
}
|
|
}
|
|
}
|
|
if (FoliageCore_MainManager.instance == null)
|
|
{
|
|
return;
|
|
}
|
|
if (FoliageCore_MainManager.instance.density == 0f)
|
|
{
|
|
FoliageCore_MainManager.instance.density = 1f;
|
|
}
|
|
else
|
|
{
|
|
FoliageCore_MainManager.instance.density = 0f;
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad5))
|
|
{
|
|
if ((bool)fishSpawnersParent)
|
|
{
|
|
fishSpawnersParent.SetActive(!fishSpawnersParent.activeSelf);
|
|
}
|
|
else
|
|
{
|
|
for (int num2 = 0; num2 < fishSpawners.Count; num2++)
|
|
{
|
|
fishSpawners[num2].gameObject.SetActive(!fishSpawners[num2].gameObject.activeSelf);
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad6) && (bool)water)
|
|
{
|
|
water.gameObject.SetActive(!water.gameObject.activeSelf);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.KeypadDivide))
|
|
{
|
|
Debug.LogError("Fish count: " + fishSpawnersParent.GetComponentsInChildren<Fish>(false).Length + " / " + fishSpawnersParent.GetComponentsInChildren<Fish>(true).Length);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad8))
|
|
{
|
|
if (Time.fixedDeltaTime == 0.02f)
|
|
{
|
|
Time.fixedDeltaTime = 0.03f;
|
|
}
|
|
else if (Time.fixedDeltaTime == 0.03f)
|
|
{
|
|
Time.fixedDeltaTime = 0.04f;
|
|
}
|
|
else
|
|
{
|
|
Time.fixedDeltaTime = 0.02f;
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetKey(KeyCode.LeftControl))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.U))
|
|
{
|
|
SwitchScreenshotMode(!hudManager.gameObject.activeSelf);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad2))
|
|
{
|
|
fishingPlayer.currentHands.HideHandsCamera(fishingPlayer.isHandsCameraVisible);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad3))
|
|
{
|
|
foreach (GameObject testHideObject in testHideObjects)
|
|
{
|
|
if ((bool)testHideObject)
|
|
{
|
|
testHideObject.SetActive(!testHideObject.activeSelf);
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.T))
|
|
{
|
|
weatherLevelManager.ChangeTimeScale();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.X))
|
|
{
|
|
fightTest = !fightTest;
|
|
fishingPlayer.currentHands.FLC.ropeStretchThreshold = ((!fightTest) ? 0f : 5f);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.N) || Input.GetKeyDown(KeyCode.Space))
|
|
{
|
|
alwaysWantBait = !alwaysWantBait;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.F))
|
|
{
|
|
bool flag = !fishingPlayer.freeCamera.enabled;
|
|
fishingPlayer.ChangeFreeCamera(flag);
|
|
SwitchScreenshotMode(!flag);
|
|
WaterProjectSettings.Instance.ClipWaterCameraRange = !flag;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Space) && fishingPlayer.freeCamera.enabled)
|
|
{
|
|
fishingPlayer.freeCamera.AttachToTarget(GetRandomFish().transform);
|
|
fishingPlayer.ufpsWeaponCamera.cullingMask = Utilities.RemoveFromLayerMask(fishingPlayer.ufpsWeaponCamera.cullingMask, "Debug");
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.UpArrow))
|
|
{
|
|
Fish.useAvoidance = !Fish.useAvoidance;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.DownArrow))
|
|
{
|
|
Fish.disableLogic = !Fish.disableLogic;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.RightArrow))
|
|
{
|
|
Fish.disableLogic2 = !Fish.disableLogic2;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.LeftArrow))
|
|
{
|
|
fishingPlayer.fishDistanceBehavior = ((fishingPlayer.fishDistanceBehavior != 150f) ? 150f : 70f);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
{
|
|
fishingPlayer.fishDistanceBehaviorSphere.gameObject.SetActive(!fishingPlayer.fishDistanceBehaviorSphere.gameObject.activeSelf);
|
|
}
|
|
}
|
|
else if (Input.GetKey(KeyCode.End))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Keypad1))
|
|
{
|
|
quickCheckBehaviorDistance = !quickCheckBehaviorDistance;
|
|
}
|
|
if (Input.GetKey(KeyCode.PageDown))
|
|
{
|
|
fishingPlayer.underwaterWaterCamera.RenderWaterDepth = !fishingPlayer.underwaterWaterCamera.RenderWaterDepth;
|
|
fishingPlayer.underwaterWaterCamera.RenderVolumes = !fishingPlayer.underwaterWaterCamera.RenderVolumes;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad2))
|
|
{
|
|
WaterCamera waterCamera = fishingPlayer.waterCamera;
|
|
if (waterCamera.RenderMode == WaterRenderMode.DefaultQueue)
|
|
{
|
|
waterCamera.RenderMode = WaterRenderMode.ImageEffectForward;
|
|
}
|
|
else if (waterCamera.RenderMode == WaterRenderMode.ImageEffectForward)
|
|
{
|
|
waterCamera.RenderMode = WaterRenderMode.ImageEffectDeferred;
|
|
}
|
|
else
|
|
{
|
|
waterCamera.RenderMode = WaterRenderMode.DefaultQueue;
|
|
}
|
|
fishingPlayer.underwaterWaterCamera.RenderMode = fishingPlayer.waterCamera.RenderMode;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad3))
|
|
{
|
|
foreach (GameObject item2 in testHideObjects2)
|
|
{
|
|
if ((bool)item2)
|
|
{
|
|
item2.SetActive(!item2.activeSelf);
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad4))
|
|
{
|
|
if (fishingPlayer.ufpsCamera.GetComponent<PostProcessLayer>().antialiasingMode == PostProcessLayer.Antialiasing.FastApproximateAntialiasing)
|
|
{
|
|
fishingPlayer.ufpsCamera.GetComponent<PostProcessLayer>().antialiasingMode = PostProcessLayer.Antialiasing.TemporalAntialiasing;
|
|
}
|
|
else if (fishingPlayer.ufpsCamera.GetComponent<PostProcessLayer>().antialiasingMode == PostProcessLayer.Antialiasing.TemporalAntialiasing)
|
|
{
|
|
fishingPlayer.ufpsCamera.GetComponent<PostProcessLayer>().antialiasingMode = PostProcessLayer.Antialiasing.None;
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.ufpsCamera.GetComponent<PostProcessLayer>().antialiasingMode = PostProcessLayer.Antialiasing.FastApproximateAntialiasing;
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad6))
|
|
{
|
|
fishingPlayer.dustParticles.gameObject.SetActive(!fishingPlayer.dustParticles.gameObject.activeSelf);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad7))
|
|
{
|
|
foreach (GameObject item3 in terrainsMeshTest)
|
|
{
|
|
if (item3 != null)
|
|
{
|
|
item3.SetActive(!item3.activeSelf);
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Keypad8))
|
|
{
|
|
if (QualitySettings.shadowResolution == ShadowResolution.VeryHigh)
|
|
{
|
|
QualitySettings.shadowResolution = ShadowResolution.High;
|
|
}
|
|
else if (QualitySettings.shadowResolution == ShadowResolution.High)
|
|
{
|
|
QualitySettings.shadowResolution = ShadowResolution.Medium;
|
|
}
|
|
else if (QualitySettings.shadowResolution == ShadowResolution.Medium)
|
|
{
|
|
QualitySettings.shadowResolution = ShadowResolution.VeryHigh;
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.F8))
|
|
{
|
|
fishingPlayer.currentHands.ToggleArmRenderers();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.F7))
|
|
{
|
|
fishingPlayer.currentHands.ToggleVRArmRenderers();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Alpha0))
|
|
{
|
|
fishingPlayer.currentHands.currentShirtMaterial++;
|
|
if (fishingPlayer.currentHands.currentShirtMaterial >= fishingPlayer.currentHands.shirtMaterials.Count)
|
|
{
|
|
fishingPlayer.currentHands.currentShirtMaterial = 0;
|
|
}
|
|
fishingPlayer.currentHands.ChangeShirtMaterial(fishingPlayer.currentHands.currentShirtMaterial);
|
|
}
|
|
}
|
|
if ((bool)water && hideWater)
|
|
{
|
|
water.gameObject.SetActive(false);
|
|
}
|
|
UpdateNightObjects();
|
|
weatherLevelManager.UpdateHourWeather();
|
|
}
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
}
|
|
|
|
public void ChangeHour(bool inc)
|
|
{
|
|
if (((bool)fishingPlayer.fish || (isTournament && tournamentManager.tournamentActive)) && (!GlobalSettings.Instance || !GlobalSettings.Instance.turnOnCheats))
|
|
{
|
|
return;
|
|
}
|
|
if (inc)
|
|
{
|
|
if ((bool)azureSkyController)
|
|
{
|
|
azureSkyController.TIME_of_DAY += 0.5f;
|
|
}
|
|
RenderAllProbes();
|
|
weatherLevelManager.ChangeWeather(true);
|
|
}
|
|
if (!inc)
|
|
{
|
|
if ((bool)azureSkyController)
|
|
{
|
|
azureSkyController.TIME_of_DAY -= 0.5f;
|
|
}
|
|
RenderAllProbes();
|
|
weatherLevelManager.ChangeWeather(true);
|
|
}
|
|
if ((bool)azureSkyController)
|
|
{
|
|
if (azureSkyController.TIME_of_DAY >= 24f)
|
|
{
|
|
azureSkyController.TIME_of_DAY = 0f;
|
|
}
|
|
if (azureSkyController.TIME_of_DAY < 0f)
|
|
{
|
|
azureSkyController.TIME_of_DAY = 23.9f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void RenderAllProbes()
|
|
{
|
|
for (int i = 0; i < reflectionProbes.Length; i++)
|
|
{
|
|
reflectionProbes[i].RenderProbe();
|
|
}
|
|
}
|
|
|
|
public void UpdateTerrains()
|
|
{
|
|
}
|
|
|
|
public void UpdateNightObjects(bool init = false)
|
|
{
|
|
if (!azureSkyController)
|
|
{
|
|
return;
|
|
}
|
|
bool flag = weatherLevelManager.GetHour() < 5 || weatherLevelManager.GetHour() > 19;
|
|
if ((bool)fishingPlayer.sunShafts)
|
|
{
|
|
fishingPlayer.sunShafts.enabled = weatherLevelManager.GetHour() >= 6 && weatherLevelManager.GetHour() <= 19;
|
|
}
|
|
if (flag == isNight && !init)
|
|
{
|
|
return;
|
|
}
|
|
if ((bool)azureSkyController && (bool)fishingPlayer.sunShafts)
|
|
{
|
|
fishingPlayer.sunShafts.sunTransform = azureSkyController.SunShaftTransform;
|
|
}
|
|
if (init && nightObjects != null)
|
|
{
|
|
for (int i = 0; i < nightObjects.Length; i++)
|
|
{
|
|
nightObjects[i].SetActive(false);
|
|
}
|
|
}
|
|
isNight = flag;
|
|
levelSoundManager.StartDay(!isNight, init);
|
|
if (nightObjects != null)
|
|
{
|
|
for (int j = 0; j < nightObjects.Length; j++)
|
|
{
|
|
nightObjects[j].SetActive(flag);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void CreateWaterCollider()
|
|
{
|
|
}
|
|
|
|
public IEnumerator ResetPlayer(bool fade)
|
|
{
|
|
resetingPlayer = true;
|
|
if (fade)
|
|
{
|
|
hudManager.FadeDark(1f, 0.3f);
|
|
yield return new WaitForSeconds(0.3f);
|
|
}
|
|
if (fade)
|
|
{
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
fishingPlayer.ResetPlayer(spawnPoints[iceLevel ? 1 : 0]);
|
|
if (fade)
|
|
{
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
if (fade)
|
|
{
|
|
hudManager.FadeDark(0f, 0.3f);
|
|
}
|
|
resetingPlayer = false;
|
|
}
|
|
|
|
public void QuickJump()
|
|
{
|
|
if (quickJumpPoints.Count != 0)
|
|
{
|
|
fishingPlayer.ResetPlayer(quickJumpPoints[currentQuickJump]);
|
|
currentQuickJump++;
|
|
if (currentQuickJump >= quickJumpPoints.Count)
|
|
{
|
|
currentQuickJump = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
public IEnumerator QuickJumpMap(Transform jumpPosition)
|
|
{
|
|
resetingPlayer = true;
|
|
hudManager.FadeDark(1f, 0.3f);
|
|
yield return new WaitForSeconds(0.3f);
|
|
fishingPlayer.isTeleporting = true;
|
|
fishingPlayer.ResetPlayer(jumpPosition.gameObject);
|
|
yield return new WaitForSeconds(2f);
|
|
fishingPlayer.isTeleporting = false;
|
|
hudManager.FadeDark(0f, 0.3f);
|
|
resetingPlayer = false;
|
|
}
|
|
|
|
public void SwitchScreenshotMode(bool turnOn)
|
|
{
|
|
hudManager.gameObject.SetActive(turnOn);
|
|
ShowBaitIndicator(turnOn);
|
|
TutorialManager.Instance.gameObject.SetActive(turnOn);
|
|
}
|
|
|
|
public void ShowBaitIndicator(bool show)
|
|
{
|
|
if ((bool)globalSettings && !globalSettings.playerSettings.IsCasual())
|
|
{
|
|
show = false;
|
|
}
|
|
if (VRManager.IsVROn())
|
|
{
|
|
if (!show)
|
|
{
|
|
fishingPlayer.ufpsCameraCamera.cullingMask = Utilities.RemoveFromLayerMask(fishingPlayer.ufpsCameraCamera.cullingMask, "UI3D");
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.ufpsCameraCamera.cullingMask = Utilities.AddToLayerMask(fishingPlayer.ufpsCameraCamera.cullingMask, "UI3D");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.baitIndicatorCamera.enabled = show;
|
|
}
|
|
}
|
|
|
|
public void ShowFloatWindow(bool show)
|
|
{
|
|
if (fishingPlayer.floatCamera.isTurnedOn)
|
|
{
|
|
hudManager.hudFishing.floatCameraWidget.SetActive(show);
|
|
}
|
|
}
|
|
|
|
public void SetFloatSizeMultiplier(float size)
|
|
{
|
|
fishingPlayer.currentHands.floatSizeMultiplier = 1f + size * 0.25f;
|
|
}
|
|
|
|
public void SetTensionWidgetType(HUDFishing.TensionWidgetType newType)
|
|
{
|
|
HUDManager.Instance.hudFishing.ChangeTensionWidget(newType);
|
|
}
|
|
|
|
public int GetFisheryId()
|
|
{
|
|
if ((bool)fisheryEditorGame)
|
|
{
|
|
return fisheryEditorGame.fisheryId;
|
|
}
|
|
return (!iceLevel) ? fisheryId : fisheryIceId;
|
|
}
|
|
|
|
public List<TournamentManager.TournamentFish> GetAvailableSpecies()
|
|
{
|
|
List<TournamentManager.TournamentFish> list = new List<TournamentManager.TournamentFish>();
|
|
for (int i = 0; i < fishSpawners.Count; i++)
|
|
{
|
|
list.Add(TournamentManager.FishToTournamentFish(fishSpawners[i].fishPrefab));
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public void GetAvailableFishMaterials()
|
|
{
|
|
for (int i = 0; i < fishSpawners.Count; i++)
|
|
{
|
|
if (fishSpawners[i].fishPrefabsDLC.Count > 0)
|
|
{
|
|
foreach (Fish item in fishSpawners[i].fishPrefabsDLC)
|
|
{
|
|
GetAvailableFishMaterials(item);
|
|
}
|
|
}
|
|
if (fishSpawners[i].fishPrefabs.Count > 0)
|
|
{
|
|
foreach (Fish fishPrefab in fishSpawners[i].fishPrefabs)
|
|
{
|
|
GetAvailableFishMaterials(fishPrefab);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GetAvailableFishMaterials(fishSpawners[i].fishPrefab);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void GetAvailableFishMaterials(Fish fishPrefab)
|
|
{
|
|
if (fishPrefab.mainMaterial != null)
|
|
{
|
|
fishMaterials.Add(fishPrefab.mainMaterial);
|
|
}
|
|
for (int i = 0; i < fishPrefab.additionalMainMaterials.Count; i++)
|
|
{
|
|
if (fishPrefab.additionalMainMaterials[i] != null)
|
|
{
|
|
fishMaterials.Add(fishPrefab.additionalMainMaterials[i]);
|
|
}
|
|
}
|
|
if (fishPrefab.transparentMaterial != null)
|
|
{
|
|
fishTransparentMaterials.Add(fishPrefab.transparentMaterial);
|
|
}
|
|
}
|
|
|
|
public void ResetHunterFishMaterials()
|
|
{
|
|
for (int i = 0; i < fishMaterials.Count; i++)
|
|
{
|
|
fishMaterials[i].shader = fishShaderNormal;
|
|
fishMaterials[i].color = Color.white;
|
|
}
|
|
}
|
|
|
|
public void UpdateHunterFishMaterials(bool hunterVision, float tweenTime)
|
|
{
|
|
if (fishingPlayer == null || fishingPlayer.hunterCamera == null)
|
|
{
|
|
return;
|
|
}
|
|
if (tweenTime > 0f)
|
|
{
|
|
Vector2 turnOnTime = new Vector2(0.1f, 0.2f);
|
|
LeanTween.value((!hunterVision) ? 1f : 0f, (!hunterVision) ? 0f : 1f, tweenTime).setOnUpdate(delegate(float value)
|
|
{
|
|
if (!(fishingPlayer == null) && !(fishingPlayer.hunterCamera == null))
|
|
{
|
|
if (hunterVision && !fishingPlayer.hunterCamera.enabled && value > turnOnTime.x)
|
|
{
|
|
fishingPlayer.hunterCamera.enabled = true;
|
|
fishingPlayer.hunterBrightness.enabled = true;
|
|
for (int i = 0; i < fishMaterials.Count; i++)
|
|
{
|
|
fishMaterials[i].shader = fishShaderHunter;
|
|
fishMaterials[i].SetFloat("_FresnelStrength", 1f);
|
|
fishMaterials[i].color = hunterMaterialColor;
|
|
}
|
|
}
|
|
else if (!hunterVision && fishingPlayer.hunterCamera.enabled && value < turnOnTime.y)
|
|
{
|
|
fishingPlayer.hunterCamera.enabled = false;
|
|
fishingPlayer.hunterBrightness.enabled = false;
|
|
for (int j = 0; j < fishMaterials.Count; j++)
|
|
{
|
|
fishMaterials[j].shader = fishShaderNormal;
|
|
fishMaterials[j].color = Color.white;
|
|
}
|
|
}
|
|
Color color = Color.Lerp(Color.black, Color.yellow, value);
|
|
for (int k = 0; k < fishMaterials.Count; k++)
|
|
{
|
|
fishingPlayer.hunterCamera.GetComponent<UnityStandardAssets.ImageEffects.Bloom>().bloomIntensity = (value - ((!hunterVision) ? turnOnTime.y : turnOnTime.x)) * 3f;
|
|
fishingPlayer.hunterBrightness._Brightness = Mathf.Lerp(0.19f, 1f, 1f - (value - ((!hunterVision) ? turnOnTime.y : turnOnTime.x)));
|
|
if (fishMaterials[k].HasProperty("_EmissiveIntensity"))
|
|
{
|
|
fishMaterials[k].SetFloat("_EmissiveIntensity", hunterMaterialCurve.Evaluate(value));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
for (int num = 0; num < fishMaterials.Count; num++)
|
|
{
|
|
if (fishMaterials[num].HasProperty("_EmissiveIntensity"))
|
|
{
|
|
fishMaterials[num].SetFloat("_EmissiveIntensity", 0f);
|
|
}
|
|
}
|
|
if ((bool)fishingPlayer.hunterCamera)
|
|
{
|
|
fishingPlayer.hunterCamera.enabled = false;
|
|
fishingPlayer.hunterCamera.GetComponent<UnityStandardAssets.ImageEffects.Bloom>().bloomIntensity = 0f;
|
|
}
|
|
if ((bool)fishingPlayer.hunterBrightness)
|
|
{
|
|
fishingPlayer.hunterBrightness.enabled = false;
|
|
}
|
|
}
|
|
|
|
public void UpdateTransparentFishMaterials(bool isUnderwater)
|
|
{
|
|
for (int i = 0; i < fishTransparentMaterials.Count; i++)
|
|
{
|
|
Utilities.SetupMaterialWithBlendMode(fishTransparentMaterials[i], isUnderwater ? Utilities.BlendMode.Cutout : Utilities.BlendMode.Fade);
|
|
}
|
|
}
|
|
|
|
public bool IsPauseMenu()
|
|
{
|
|
return hudManager.currentHudState == HUDManager.HUDState.PAUSE;
|
|
}
|
|
|
|
public bool IsQuickMenu()
|
|
{
|
|
return hudManager.vrQuickMenuCanvas.gameObject.activeSelf;
|
|
}
|
|
|
|
public void FisheryExitEnter()
|
|
{
|
|
fisheryExitCounter++;
|
|
if (fisheryExitCounter == 1)
|
|
{
|
|
hudManager.infoFisheryExit.SetActive(true);
|
|
fisheryExitTimer = ((!fishingPlayer.boatSimulator) ? fisheryExitDelay : fisheryExitBoatDelay);
|
|
}
|
|
}
|
|
|
|
public void FisheryExitExit()
|
|
{
|
|
fisheryExitCounter--;
|
|
if (fisheryExitCounter <= 0)
|
|
{
|
|
hudManager.infoFisheryExit.SetActive(false);
|
|
fisheryExitTimer = 0f;
|
|
}
|
|
if (fisheryExitCounter < 0)
|
|
{
|
|
Debug.LogError("fisheryExitTimer < 0");
|
|
fisheryExitCounter = 0;
|
|
}
|
|
Debug.Log("FisheryExitExit fisheryExitCounter: " + fisheryExitCounter);
|
|
}
|
|
|
|
public void ChangeWaterGeometryType(bool isCameraMoving)
|
|
{
|
|
}
|
|
|
|
public void PlayWaterRipple(Vector3 position, float force, float radius)
|
|
{
|
|
position.y = 0f;
|
|
List<WaterForce.Data> list = new List<WaterForce.Data>();
|
|
list.Add(new WaterForce.Data
|
|
{
|
|
Position = position,
|
|
Force = force
|
|
});
|
|
List<WaterForce.Data> data = list;
|
|
UltimateWater.WaterRipples.AddForce(data, radius);
|
|
}
|
|
|
|
public void ShowIceBottom(bool showBottom)
|
|
{
|
|
if (iceLevel && !(iceBottom == null) && !(iceTop == null))
|
|
{
|
|
iceBottom.GetComponent<MeshRenderer>().enabled = showBottom;
|
|
iceTop.GetComponent<MeshRenderer>().enabled = !showBottom;
|
|
if (showBottom)
|
|
{
|
|
iceBottom.transform.localPosition = new Vector3(iceBottom.transform.localPosition.x, iceTop.transform.position.y - fishingPlayer.drillingController.currentHole.Data.Depth - 0.01f, iceBottom.transform.localPosition.z);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ShowFishEscapeColliders(bool show)
|
|
{
|
|
for (int i = 0; i < fishEscapeColliders.Count; i++)
|
|
{
|
|
fishEscapeColliders[i].SetActive(show);
|
|
}
|
|
}
|
|
|
|
public bool MakeDarkDuringRain()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public Fish GetRandomFish()
|
|
{
|
|
FishSpawner fishSpawner = fishSpawners[UnityEngine.Random.Range(0, spawnersCount)];
|
|
return fishSpawner.fishList[UnityEngine.Random.Range(0, fishSpawner.fishList.Count)];
|
|
}
|
|
|
|
public void CheckBehaviorDistanceQuick()
|
|
{
|
|
for (int i = 0; i < fishSpawners.Count; i++)
|
|
{
|
|
if (fishSpawners[i].gameObject.activeSelf)
|
|
{
|
|
fishSpawners[i].CheckBehaviorDistanceQuick();
|
|
}
|
|
}
|
|
}
|
|
|
|
[Button]
|
|
public void CheckAllSpawnersUnderTerrain()
|
|
{
|
|
FishSpawner[] array = UnityEngine.Object.FindObjectsOfType<FishSpawner>();
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
array[i].CheckIsUnderTerrain();
|
|
}
|
|
}
|
|
|
|
[Button]
|
|
public void UpdateTerrainTile()
|
|
{
|
|
for (int i = 0; i < reliefTerrainsToChangeTiles.Count; i++)
|
|
{
|
|
float num = ((!fishingPlayer.underwaterCamera.isTurnedOn) ? tilesSize.x : tilesSize.y);
|
|
reliefTerrainsToChangeTiles[i].globalSettingsHolder.ReliefTransform.x = num;
|
|
reliefTerrainsToChangeTiles[i].globalSettingsHolder.ReliefTransform.y = num;
|
|
reliefTerrainsToChangeTiles[i].globalSettingsHolder.RefreshAll();
|
|
}
|
|
}
|
|
|
|
public void CheckGrassMapAndResize(FoliageGrassMap grassMap)
|
|
{
|
|
if (!grassIds.Contains(grassMap.prototypeID))
|
|
{
|
|
grassMap.Resize(4);
|
|
}
|
|
}
|
|
|
|
public void RefreshBoatsRodStands()
|
|
{
|
|
if (allBoats == null)
|
|
{
|
|
return;
|
|
}
|
|
for (int i = 0; i < allBoats.Length; i++)
|
|
{
|
|
if (allBoats[i] != null && allBoats[i].gameObject.activeSelf)
|
|
{
|
|
allBoats[i].RefreshRodStands();
|
|
}
|
|
}
|
|
}
|
|
}
|