123 lines
2.5 KiB
C#
123 lines
2.5 KiB
C#
using BitStrap;
|
|
using UnityEngine;
|
|
|
|
public class BoatInteractive : vp_Interactable
|
|
{
|
|
public GameObject Target;
|
|
|
|
public string TargetMessage = string.Empty;
|
|
|
|
public BoatSimulator boatSimulator;
|
|
|
|
public bool enterBoat = true;
|
|
|
|
public bool driveBoat;
|
|
|
|
[ReadOnly]
|
|
public bool canInteract = true;
|
|
|
|
[HideInInspector]
|
|
public MeshRenderer meshRenderer;
|
|
|
|
protected override void Start()
|
|
{
|
|
if (boatSimulator == null)
|
|
{
|
|
boatSimulator = base.gameObject.GetComponent<BoatSimulator>();
|
|
}
|
|
m_InteractCrosshair = null;
|
|
meshRenderer = GetComponent<MeshRenderer>();
|
|
base.Start();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!FisheryEditor.Instance && UtilitiesInput.GetButtonDown("BOAT_ENTER"))
|
|
{
|
|
TryInteract(null);
|
|
}
|
|
}
|
|
|
|
public override void UpdateSeeing(bool isSeeing)
|
|
{
|
|
if (isSeeingMe != isSeeing && (!isSeeing || !GameController.Instance.hudManager.cursorEnterBoat.gameObject.activeSelf) && (!isSeeing || !GameController.Instance.fishingPlayer.boatSimulator))
|
|
{
|
|
GameController.Instance.hudManager.ShowEnterBoatCursor(isSeeing);
|
|
base.UpdateSeeing(isSeeing);
|
|
}
|
|
}
|
|
|
|
public override bool TryInteract(vp_PlayerEventHandler player)
|
|
{
|
|
FishingPlayer fishingPlayer = GameController.Instance.fishingPlayer;
|
|
if (fishingPlayer.currentHands.baitWasThrown)
|
|
{
|
|
return false;
|
|
}
|
|
if ((bool)fishingPlayer.boatSimulator)
|
|
{
|
|
return false;
|
|
}
|
|
if (player != null)
|
|
{
|
|
return false;
|
|
}
|
|
if (!isSeeingMe)
|
|
{
|
|
return false;
|
|
}
|
|
if (!canInteract)
|
|
{
|
|
return false;
|
|
}
|
|
if ((bool)BugReporter.Instance && BugReporter.Instance.isVisible)
|
|
{
|
|
return false;
|
|
}
|
|
if (GameController.Instance.IsQuickMenu())
|
|
{
|
|
return false;
|
|
}
|
|
if (HUDManager.Instance.hudMultiplayer.isInInputMode || HUDManager.Instance.fadeDark.color.a > 0f)
|
|
{
|
|
return false;
|
|
}
|
|
if (!UtilitiesInput.GetButtonDown("BOAT_ENTER"))
|
|
{
|
|
return false;
|
|
}
|
|
if (m_Player == null && player != null)
|
|
{
|
|
m_Player = player;
|
|
}
|
|
if (!driveBoat)
|
|
{
|
|
if (!GlobalSettings.Instance || (bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.USE_BOATS_1).isUnlocked)
|
|
{
|
|
StartCoroutine(fishingPlayer.EnterBoat(enterBoat, boatSimulator));
|
|
}
|
|
else
|
|
{
|
|
GameController.Instance.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/NO_SKILL"));
|
|
}
|
|
Debug.Log("Enter boat ");
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void ShowVisual(bool show)
|
|
{
|
|
if ((bool)meshRenderer)
|
|
{
|
|
meshRenderer.enabled = show;
|
|
}
|
|
}
|
|
|
|
protected override void OnTriggerEnter(Collider col)
|
|
{
|
|
if (InteractType == vp_InteractType.Trigger)
|
|
{
|
|
}
|
|
}
|
|
}
|