709 lines
20 KiB
C#
709 lines
20 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UFS2.Gameplay;
|
|
using UnityEngine;
|
|
|
|
public class RodSupport : MonoBehaviour
|
|
{
|
|
public int indexId;
|
|
|
|
private FPlayer currentPlayer;
|
|
|
|
public float supportHeight = -0.5f;
|
|
|
|
public float playerRange = 2f;
|
|
|
|
public float playerRangeToGetRod = 1f;
|
|
|
|
private bool isValidStayOnTerrain;
|
|
|
|
private static float lastRodSupportChangeTime;
|
|
|
|
public int numOfRodSlots = 1;
|
|
|
|
public RodSupportCheckGround[] supportTerrainChecker;
|
|
|
|
public Transform[] rodContainer;
|
|
|
|
public GameObject[] glowRod;
|
|
|
|
public GameObject[] handlerRod;
|
|
|
|
public GameObject[] handlerRodRenderer;
|
|
|
|
public GameObject[] getRodPointer;
|
|
|
|
[SerializeField]
|
|
private FRod currentRod_1;
|
|
|
|
[SerializeField]
|
|
private FRod currentRod_2;
|
|
|
|
[SerializeField]
|
|
private FRod currentRod_3;
|
|
|
|
public BiteSignalizer[] biteSignalizer;
|
|
|
|
public bool dropped;
|
|
|
|
[SerializeField]
|
|
private Transform[] rodSlotNumberPoint;
|
|
|
|
[SerializeField]
|
|
private GameObject rodSlotNumberPrefab;
|
|
|
|
[SerializeField]
|
|
private List<UIrodPodSlotNumber> currentRodSlotNumber = new List<UIrodPodSlotNumber>();
|
|
|
|
private bool isValisDropRod;
|
|
|
|
private bool isValisGetRod;
|
|
|
|
public static bool IsRodSupportChanging => Time.time - lastRodSupportChangeTime < 2f;
|
|
|
|
private bool IsRodDropBlocked
|
|
{
|
|
get
|
|
{
|
|
if ((bool)currentPlayer.currentRod && !FishEntity.CurrentFishInFight && !currentPlayer.currentRod.isThrowing && !currentPlayer.underWaterCamera && !currentPlayer.firstPersonController.frezzePosition && Time.timeScale != 0f && !IsRodSupportChanging)
|
|
{
|
|
return InventoryManager.IsInventoryChanging;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
private bool IsRodGetBlocked
|
|
{
|
|
get
|
|
{
|
|
if (!currentPlayer.currentRod && !currentPlayer.underWaterCamera && !currentPlayer.firstPersonController.frezzePosition && Time.timeScale != 0f && !IsRodSupportChanging)
|
|
{
|
|
return InventoryManager.IsInventoryChanging;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static event Action<RodSupport> OnSupportTake;
|
|
|
|
public static event Action<RodSupport> OnSupportDrop;
|
|
|
|
public static event Action<FRod> OnRodTake;
|
|
|
|
public static event Action<FRod> OnRodPutDown;
|
|
|
|
private void Start()
|
|
{
|
|
currentPlayer = FScriptsHandler.Instance.m_PlayerMain;
|
|
InstallSignalizators();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (GameManager.Instance.addectiveSceneLoaded != "none")
|
|
{
|
|
return;
|
|
}
|
|
CheckBiteForSignalizator();
|
|
if (FScriptsHandler.Instance.m_InventoryManager.currentAccesory != null && FScriptsHandler.Instance.m_InventoryManager.currentAccesory != base.gameObject)
|
|
{
|
|
return;
|
|
}
|
|
if ((bool)currentPlayer.currentRod && !dropped)
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: true);
|
|
DestroySupport();
|
|
return;
|
|
}
|
|
bool flag = false;
|
|
bool flag2 = false;
|
|
bool flag3 = false;
|
|
float num = Vector3.Angle(new Vector3(base.transform.position.x, currentPlayer.transform.position.y, base.transform.position.z) - currentPlayer.transform.position, currentPlayer.transform.forward);
|
|
flag = ((num > -15f && num < 15f) ? true : false);
|
|
DropRod();
|
|
GetRod();
|
|
ShowHideSlotsNumber();
|
|
if (glowRod.Length != 0 && (bool)currentRod_1 && glowRod[0].activeSelf)
|
|
{
|
|
glowRod[0].SetActive(value: false);
|
|
}
|
|
if (glowRod.Length > 1 && (bool)currentRod_2 && glowRod[1].activeSelf)
|
|
{
|
|
glowRod[1].SetActive(value: false);
|
|
}
|
|
if (glowRod.Length > 2 && (bool)currentRod_3 && glowRod[2].activeSelf)
|
|
{
|
|
glowRod[2].SetActive(value: false);
|
|
}
|
|
if (!currentPlayer.currentRod && !currentRod_1 && !currentRod_2 && !currentRod_3)
|
|
{
|
|
if (!dropped)
|
|
{
|
|
base.transform.position = currentPlayer.transform.position + currentPlayer.transform.forward * 1.5f;
|
|
base.transform.rotation = currentPlayer.transform.rotation;
|
|
isValidStayOnTerrain = true;
|
|
for (int i = 0; i < supportTerrainChecker.Length; i++)
|
|
{
|
|
if (!supportTerrainChecker[i].isTerrain)
|
|
{
|
|
isValidStayOnTerrain = false;
|
|
}
|
|
}
|
|
if (Time.timeScale != 0f && GameManager.Instance.player.GetButtonDown("cancelSupportButton"))
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: true);
|
|
DestroySupport();
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!(Vector3.Distance(currentPlayer.transform.position, base.transform.position) < playerRange && flag))
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: true);
|
|
return;
|
|
}
|
|
flag2 = true;
|
|
}
|
|
if (isValidStayOnTerrain)
|
|
{
|
|
if (!dropped)
|
|
{
|
|
flag3 = true;
|
|
}
|
|
if (Time.timeScale != 0f && GameManager.Instance.player.GetButtonDown("dropGetSupportButton"))
|
|
{
|
|
if (!dropped)
|
|
{
|
|
base.transform.position = new Vector3(supportTerrainChecker[0].dropPoint.x, supportTerrainChecker[0].dropPoint.y - supportHeight, supportTerrainChecker[0].dropPoint.z);
|
|
for (int j = 0; j < supportTerrainChecker.Length; j++)
|
|
{
|
|
supportTerrainChecker[j].hideOutlines = true;
|
|
}
|
|
dropped = true;
|
|
flag3 = false;
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: true);
|
|
FScriptsHandler.Instance.m_InventoryManager.currentAccesory = null;
|
|
RodSupport.OnSupportDrop?.Invoke(this);
|
|
}
|
|
else if (Vector3.Distance(currentPlayer.transform.position, base.transform.position) < playerRange && flag)
|
|
{
|
|
for (int k = 0; k < supportTerrainChecker.Length; k++)
|
|
{
|
|
supportTerrainChecker[k].hideOutlines = false;
|
|
}
|
|
dropped = false;
|
|
FScriptsHandler.Instance.m_InventoryManager.currentAccesory = base.gameObject;
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: true);
|
|
RodSupport.OnSupportTake?.Invoke(this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (isValisDropRod)
|
|
{
|
|
if (GameManager.Instance.controllerType == GameManager.ControllerType.GamePad)
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: false, LanguageManager.Instance.GetText("DROP_ROD_TO_SUPPORT_PAD"));
|
|
}
|
|
else
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: false, LanguageManager.Instance.GetText("DROP_ROD_TO_SUPPORT_MOUSE"));
|
|
}
|
|
}
|
|
else if (isValisGetRod)
|
|
{
|
|
if (GameManager.Instance.controllerType == GameManager.ControllerType.GamePad)
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: false, LanguageManager.Instance.GetText("GET_ROD_FROM_SUPPORT_PAD"));
|
|
}
|
|
else
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: false, LanguageManager.Instance.GetText("GET_ROD_FROM_SUPPORT_MOUSE"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: true);
|
|
}
|
|
if (flag3)
|
|
{
|
|
if (GameManager.Instance.controllerType == GameManager.ControllerType.GamePad)
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: false, 0, LanguageManager.Instance.GetText("DROP_SUPPORT_PAD"), LanguageManager.Instance.GetText("CANCEL_SUPPORT_PAD"));
|
|
}
|
|
else
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: false, 0, LanguageManager.Instance.GetText("DROP_SUPPORT_MOUSE"), LanguageManager.Instance.GetText("CANCEL_SUPPORT_MOUSE"));
|
|
}
|
|
}
|
|
else if (flag2)
|
|
{
|
|
if (GameManager.Instance.controllerType == GameManager.ControllerType.GamePad)
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: false, 0, LanguageManager.Instance.GetText("RELOCATE_SUPPORT_PAD"));
|
|
}
|
|
else
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: false, 0, LanguageManager.Instance.GetText("RELOCATE_SUPPORT_MOUSE"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropSupportPanel(hide: true);
|
|
}
|
|
if (GameManager.Instance.controllerType == GameManager.ControllerType.GamePad)
|
|
{
|
|
for (int l = 0; l < currentRodSlotNumber.Count; l++)
|
|
{
|
|
currentRodSlotNumber[l].gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int m = 0; m < currentRodSlotNumber.Count; m++)
|
|
{
|
|
currentRodSlotNumber[m].gameObject.SetActive(value: true);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ViewSetRodPointer(int indexOfSlot)
|
|
{
|
|
if (getRodPointer.Length == 0)
|
|
{
|
|
return;
|
|
}
|
|
for (int i = 0; i < getRodPointer.Length; i++)
|
|
{
|
|
if (i != indexOfSlot)
|
|
{
|
|
getRodPointer[i].SetActive(value: false);
|
|
}
|
|
}
|
|
if (getRodPointer.Length > indexOfSlot && indexOfSlot > -1)
|
|
{
|
|
getRodPointer[indexOfSlot].SetActive(value: true);
|
|
}
|
|
}
|
|
|
|
private void DropRod()
|
|
{
|
|
isValisDropRod = false;
|
|
if (IsRodDropBlocked)
|
|
{
|
|
return;
|
|
}
|
|
if (rodContainer.Length != 0 && CheckToDropRod(0) && currentRod_1 == null)
|
|
{
|
|
if (InputManager.isGetUpRod)
|
|
{
|
|
StartCoroutine(ReConnectRod(1));
|
|
}
|
|
isValisDropRod = true;
|
|
}
|
|
if (rodContainer.Length > 1 && CheckToDropRod(1) && currentRod_2 == null)
|
|
{
|
|
if (InputManager.isGetUpRod)
|
|
{
|
|
StartCoroutine(ReConnectRod(2));
|
|
}
|
|
isValisDropRod = true;
|
|
}
|
|
if (rodContainer.Length > 2 && CheckToDropRod(2) && currentRod_3 == null)
|
|
{
|
|
if (InputManager.isGetUpRod)
|
|
{
|
|
StartCoroutine(ReConnectRod(3));
|
|
}
|
|
isValisDropRod = true;
|
|
}
|
|
}
|
|
|
|
private IEnumerator ReConnectRod(int indexOfSlot)
|
|
{
|
|
Debug.Log("Started Drop rod indexOfSlot:" + indexOfSlot);
|
|
lastRodSupportChangeTime = Time.time;
|
|
RodSupport.OnRodPutDown?.Invoke(currentPlayer.currentRod);
|
|
currentPlayer.FullBodyAvatar.HideRod(bySlot: false);
|
|
currentPlayer.firstPersonController.frezzePosition = true;
|
|
currentPlayer.firstPersonController.frezzeRotation = true;
|
|
yield return new WaitForSeconds(0.9f);
|
|
if ((bool)currentPlayer.currentRod)
|
|
{
|
|
currentPlayer.currentRod.currentReel.isHandOnHandle = false;
|
|
}
|
|
switch (indexOfSlot)
|
|
{
|
|
case 1:
|
|
currentRod_1 = FScriptsHandler.Instance.m_InventoryManager.DropRod(rodContainer[0]);
|
|
if (biteSignalizer[0] != null)
|
|
{
|
|
biteSignalizer[0].isRodDroped = true;
|
|
}
|
|
break;
|
|
case 2:
|
|
currentRod_2 = FScriptsHandler.Instance.m_InventoryManager.DropRod(rodContainer[1]);
|
|
if (biteSignalizer[1] != null)
|
|
{
|
|
biteSignalizer[1].isRodDroped = true;
|
|
}
|
|
break;
|
|
case 3:
|
|
currentRod_3 = FScriptsHandler.Instance.m_InventoryManager.DropRod(rodContainer[2]);
|
|
if (biteSignalizer[2] != null)
|
|
{
|
|
biteSignalizer[2].isRodDroped = true;
|
|
}
|
|
break;
|
|
}
|
|
Debug.Log("Finished Coroutine at timestamp : " + Time.time);
|
|
currentPlayer.InteractiveLeftHand(null);
|
|
yield return new WaitForSeconds(0.7f);
|
|
currentPlayer.firstPersonController.frezzePosition = false;
|
|
currentPlayer.firstPersonController.frezzeRotation = false;
|
|
}
|
|
|
|
private void GetRodBySlotIndex()
|
|
{
|
|
if (IsRodGetBlocked)
|
|
{
|
|
return;
|
|
}
|
|
int indexOfSlot = -1;
|
|
if (InputManager.isShowSlot0)
|
|
{
|
|
indexOfSlot = 0;
|
|
}
|
|
else if (InputManager.isShowSlot1)
|
|
{
|
|
indexOfSlot = 1;
|
|
}
|
|
else if (InputManager.isShowSlot2)
|
|
{
|
|
indexOfSlot = 2;
|
|
}
|
|
else if (InputManager.isShowSlot3)
|
|
{
|
|
indexOfSlot = 3;
|
|
}
|
|
else if (InputManager.isShowSlot4)
|
|
{
|
|
indexOfSlot = 4;
|
|
}
|
|
FRod fRod = checkAndGetRodIsViewNumberByIndex(indexOfSlot);
|
|
if ((bool)fRod)
|
|
{
|
|
if (currentRod_1 == fRod)
|
|
{
|
|
StartCoroutine(ConnectRod(1));
|
|
}
|
|
if (currentRod_2 == fRod)
|
|
{
|
|
StartCoroutine(ConnectRod(2));
|
|
}
|
|
if (currentRod_3 == fRod)
|
|
{
|
|
StartCoroutine(ConnectRod(3));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void GetRod()
|
|
{
|
|
isValisGetRod = false;
|
|
if (IsRodGetBlocked)
|
|
{
|
|
ViewSetRodPointer(-1);
|
|
return;
|
|
}
|
|
int indexOfSlot = -1;
|
|
if (CheckRodToGet(currentRod_1))
|
|
{
|
|
if (InputManager.isGetUpRod && currentRod_1 != null)
|
|
{
|
|
StartCoroutine(ConnectRod(1));
|
|
}
|
|
if (currentRod_1 != null)
|
|
{
|
|
isValisGetRod = true;
|
|
indexOfSlot = 0;
|
|
}
|
|
}
|
|
else if (CheckRodToGet(currentRod_2))
|
|
{
|
|
if (InputManager.isGetUpRod && currentRod_2 != null)
|
|
{
|
|
StartCoroutine(ConnectRod(2));
|
|
}
|
|
if (currentRod_2 != null)
|
|
{
|
|
isValisGetRod = true;
|
|
indexOfSlot = 1;
|
|
}
|
|
}
|
|
else if (CheckRodToGet(currentRod_3))
|
|
{
|
|
if (InputManager.isGetUpRod && currentRod_3 != null)
|
|
{
|
|
StartCoroutine(ConnectRod(3));
|
|
}
|
|
if (currentRod_3 != null)
|
|
{
|
|
isValisGetRod = true;
|
|
indexOfSlot = 2;
|
|
}
|
|
}
|
|
ViewSetRodPointer(indexOfSlot);
|
|
}
|
|
|
|
private IEnumerator ConnectRod(int indexOfSlot)
|
|
{
|
|
Debug.Log("Started Drop rod");
|
|
lastRodSupportChangeTime = Time.time;
|
|
switch (indexOfSlot)
|
|
{
|
|
case 1:
|
|
RodSupport.OnRodTake?.Invoke(currentRod_1);
|
|
break;
|
|
case 2:
|
|
RodSupport.OnRodTake?.Invoke(currentRod_2);
|
|
break;
|
|
case 3:
|
|
RodSupport.OnRodTake?.Invoke(currentRod_3);
|
|
break;
|
|
}
|
|
currentPlayer.FullBodyAvatar.ShowRod(bySlot: false);
|
|
currentPlayer.firstPersonController.frezzePosition = true;
|
|
currentPlayer.firstPersonController.frezzeRotation = true;
|
|
yield return new WaitForSeconds(0.7f);
|
|
switch (indexOfSlot)
|
|
{
|
|
case 1:
|
|
FScriptsHandler.Instance.m_InventoryManager.GetRodToHand(currentRod_1);
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: true);
|
|
DestroySlotIndexNumberUI(currentRod_1);
|
|
currentRod_1 = null;
|
|
if (biteSignalizer[0] != null)
|
|
{
|
|
biteSignalizer[0].isRodDroped = false;
|
|
}
|
|
break;
|
|
case 2:
|
|
FScriptsHandler.Instance.m_InventoryManager.GetRodToHand(currentRod_2);
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: true);
|
|
DestroySlotIndexNumberUI(currentRod_2);
|
|
currentRod_2 = null;
|
|
if (biteSignalizer[1] != null)
|
|
{
|
|
biteSignalizer[1].isRodDroped = false;
|
|
}
|
|
break;
|
|
case 3:
|
|
FScriptsHandler.Instance.m_InventoryManager.GetRodToHand(currentRod_3);
|
|
FScriptsHandler.Instance.m_HudManager.ShowGetDropPanel(hide: true);
|
|
DestroySlotIndexNumberUI(currentRod_3);
|
|
currentRod_3 = null;
|
|
if (biteSignalizer[2] != null)
|
|
{
|
|
biteSignalizer[2].isRodDroped = false;
|
|
}
|
|
break;
|
|
}
|
|
Debug.Log("Finished Coroutine at timestamp : " + Time.time);
|
|
yield return new WaitForSeconds(0.7f);
|
|
currentPlayer.firstPersonController.frezzePosition = false;
|
|
currentPlayer.firstPersonController.frezzeRotation = false;
|
|
}
|
|
|
|
private bool CheckToDropRod(int indexOfSlot)
|
|
{
|
|
if (Vector3.Distance(currentPlayer.transform.position, glowRod[indexOfSlot].transform.position) < playerRangeToGetRod)
|
|
{
|
|
float num = Vector3.Angle(new Vector3(glowRod[indexOfSlot].transform.position.x, currentPlayer.transform.position.y, glowRod[indexOfSlot].transform.position.z) - currentPlayer.transform.position, currentPlayer.transform.forward);
|
|
if (num > -10f && num < 10f)
|
|
{
|
|
glowRod[indexOfSlot].SetActive(value: true);
|
|
return true;
|
|
}
|
|
glowRod[indexOfSlot].SetActive(value: false);
|
|
}
|
|
else
|
|
{
|
|
glowRod[indexOfSlot].SetActive(value: false);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private bool CheckRodToGet(FRod getRod)
|
|
{
|
|
if (getRod != null && Vector3.Distance(currentPlayer.transform.position, getRod.transform.position) < playerRangeToGetRod)
|
|
{
|
|
float num = Vector3.Angle(new Vector3(getRod.transform.position.x, currentPlayer.transform.position.y, getRod.transform.position.z) - currentPlayer.transform.position, currentPlayer.transform.forward);
|
|
if (num > -10f && num < 10f)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void ShowHideSlotsNumber()
|
|
{
|
|
if ((bool)FScriptsHandler.Instance.m_PlayerMain.underWaterCamera)
|
|
{
|
|
DestroyAllSlotIndexNumberUI();
|
|
return;
|
|
}
|
|
if (Vector3.Distance(currentPlayer.transform.position, base.transform.position) < playerRangeToGetRod + 0.5f)
|
|
{
|
|
for (int i = 0; i < rodSlotNumberPoint.Length; i++)
|
|
{
|
|
switch (i)
|
|
{
|
|
case 0:
|
|
if ((bool)currentRod_1 && !checkIsViewNumberIndexOfRod(currentRod_1))
|
|
{
|
|
CreateSlotIndexNumberUI(currentRod_1, rodSlotNumberPoint[i].position);
|
|
}
|
|
break;
|
|
case 1:
|
|
if ((bool)currentRod_2 && !checkIsViewNumberIndexOfRod(currentRod_2))
|
|
{
|
|
CreateSlotIndexNumberUI(currentRod_2, rodSlotNumberPoint[i].position);
|
|
}
|
|
break;
|
|
case 2:
|
|
if ((bool)currentRod_3 && !checkIsViewNumberIndexOfRod(currentRod_3))
|
|
{
|
|
CreateSlotIndexNumberUI(currentRod_3, rodSlotNumberPoint[i].position);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DestroyAllSlotIndexNumberUI();
|
|
}
|
|
GetRodBySlotIndex();
|
|
}
|
|
|
|
private void CreateSlotIndexNumberUI(FRod rod, Vector3 worldPosition)
|
|
{
|
|
UIrodPodSlotNumber component = UnityEngine.Object.Instantiate(rodSlotNumberPrefab, FScriptsHandler.Instance.m_HudManager.transform).GetComponent<UIrodPodSlotNumber>();
|
|
component.currentRod = rod;
|
|
component.worldPosition = worldPosition;
|
|
currentRodSlotNumber.Add(component);
|
|
}
|
|
|
|
private void DestroySlotIndexNumberUI(FRod rod)
|
|
{
|
|
if (!rod)
|
|
{
|
|
return;
|
|
}
|
|
for (int i = 0; i < currentRodSlotNumber.Count; i++)
|
|
{
|
|
if (currentRodSlotNumber[i].currentRod.indexOfslot == rod.indexOfslot)
|
|
{
|
|
UnityEngine.Object.Destroy(currentRodSlotNumber[i].gameObject);
|
|
currentRodSlotNumber.RemoveAt(i);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void DestroyAllSlotIndexNumberUI()
|
|
{
|
|
for (int i = 0; i < currentRodSlotNumber.Count; i++)
|
|
{
|
|
UnityEngine.Object.Destroy(currentRodSlotNumber[i].gameObject);
|
|
}
|
|
currentRodSlotNumber.Clear();
|
|
}
|
|
|
|
private bool checkIsViewNumberIndexOfRod(FRod rod)
|
|
{
|
|
for (int i = 0; i < currentRodSlotNumber.Count; i++)
|
|
{
|
|
if (currentRodSlotNumber[i].currentRod == rod)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private FRod checkAndGetRodIsViewNumberByIndex(int indexOfSlot)
|
|
{
|
|
for (int i = 0; i < currentRodSlotNumber.Count; i++)
|
|
{
|
|
if ((bool)currentRodSlotNumber[i].currentRod && currentRodSlotNumber[i].currentRod.indexOfslot == indexOfSlot)
|
|
{
|
|
return currentRodSlotNumber[i].currentRod;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private void InstallSignalizators()
|
|
{
|
|
int signalizerSlotUniqid_ = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerAccessories[indexId].signalizerSlotUniqid_1;
|
|
int signalizerSlotUniqid_2 = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerAccessories[indexId].signalizerSlotUniqid_2;
|
|
int signalizerSlotUniqid_3 = Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerAccessories[indexId].signalizerSlotUniqid_3;
|
|
if (signalizerSlotUniqid_ > -1)
|
|
{
|
|
int itemIdByUniqueId = GameManager.Instance._playerData.GetItemIdByUniqueId(GameManager.ItemType.Accesories, signalizerSlotUniqid_);
|
|
biteSignalizer[0] = UnityEngine.Object.Instantiate(GameManager.Instance.gameAccesories[itemIdByUniqueId].GetModelPrefab(), handlerRod[0].transform, worldPositionStays: true).GetComponent<BiteSignalizer>();
|
|
biteSignalizer[0].transform.localPosition = Vector3.zero;
|
|
biteSignalizer[0].transform.localEulerAngles = Vector3.zero;
|
|
handlerRodRenderer[0].SetActive(value: false);
|
|
}
|
|
if (signalizerSlotUniqid_2 > -1)
|
|
{
|
|
int itemIdByUniqueId2 = GameManager.Instance._playerData.GetItemIdByUniqueId(GameManager.ItemType.Accesories, signalizerSlotUniqid_2);
|
|
biteSignalizer[1] = UnityEngine.Object.Instantiate(GameManager.Instance.gameAccesories[itemIdByUniqueId2].GetModelPrefab(), handlerRod[1].transform, worldPositionStays: true).GetComponent<BiteSignalizer>();
|
|
biteSignalizer[1].transform.localPosition = Vector3.zero;
|
|
biteSignalizer[1].transform.localEulerAngles = Vector3.zero;
|
|
handlerRodRenderer[1].SetActive(value: false);
|
|
}
|
|
if (signalizerSlotUniqid_3 > -1)
|
|
{
|
|
int itemIdByUniqueId3 = GameManager.Instance._playerData.GetItemIdByUniqueId(GameManager.ItemType.Accesories, signalizerSlotUniqid_3);
|
|
biteSignalizer[2] = UnityEngine.Object.Instantiate(GameManager.Instance.gameAccesories[itemIdByUniqueId3].GetModelPrefab(), handlerRod[2].transform, worldPositionStays: true).GetComponent<BiteSignalizer>();
|
|
biteSignalizer[2].transform.localPosition = Vector3.zero;
|
|
biteSignalizer[2].transform.localEulerAngles = Vector3.zero;
|
|
handlerRodRenderer[2].SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void CheckBiteForSignalizator()
|
|
{
|
|
if (!FScriptsHandler.Instance.m_PlayerMain.underWaterCamera)
|
|
{
|
|
float num = -1000f;
|
|
if ((bool)currentRod_1 && biteSignalizer[0] != null && (bool)currentRod_1.currentFishEntity && currentRod_1.fishingLine.linelenghtDiferent > num)
|
|
{
|
|
biteSignalizer[0].PlaySignal();
|
|
}
|
|
if ((bool)currentRod_2 && biteSignalizer[1] != null && (bool)currentRod_2.currentFishEntity && currentRod_2.fishingLine.linelenghtDiferent > num)
|
|
{
|
|
biteSignalizer[1].PlaySignal();
|
|
}
|
|
if ((bool)currentRod_3 && biteSignalizer[2] != null && (bool)currentRod_3.currentFishEntity && currentRod_3.fishingLine.linelenghtDiferent > num)
|
|
{
|
|
biteSignalizer[2].PlaySignal();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void DestroySupport()
|
|
{
|
|
FScriptsHandler.Instance.m_InventoryManager.currentAccesory = null;
|
|
Singleton<SaveDataManager>.Instance.GetCurrentPlayerData().PlayerAccessories[indexId].isUse = false;
|
|
UnityEngine.Object.Destroy(base.gameObject);
|
|
}
|
|
}
|