150 lines
3.6 KiB
C#
150 lines
3.6 KiB
C#
using Obvious.Soap;
|
|
using SoapCustomVariable;
|
|
using UnityEngine;
|
|
|
|
public class UI_HUDHotkeys : MonoBehaviour
|
|
{
|
|
public FSMVariable PlayerFSM;
|
|
|
|
public BoolVariable IsFishingSetEquiped;
|
|
|
|
public BoolVariable IsLeaveWaterPosible;
|
|
|
|
public BoolVariable IsBoatInRange;
|
|
|
|
public GameObjectVariable bobberObject;
|
|
|
|
[Header("UI Elements")]
|
|
public GameObject EnterBoat;
|
|
|
|
public GameObject FishingSet1;
|
|
|
|
public GameObject FishingSet2;
|
|
|
|
public GameObject CastFar;
|
|
|
|
public GameObject CastPrecise;
|
|
|
|
public GameObject ExitBoat;
|
|
|
|
public GameObject ChangeSeat;
|
|
|
|
public GameObject CallBoat;
|
|
|
|
public GameObject LeaveWater;
|
|
|
|
public GameObject cutLine;
|
|
|
|
public GameObject cancelPreciseCast;
|
|
|
|
public GameObject doPreciseCast;
|
|
|
|
public GameObject zoom;
|
|
|
|
public GameObject resetLine;
|
|
|
|
public GameObject boatLights;
|
|
|
|
private void Start()
|
|
{
|
|
cancelPreciseCast.SetActive(value: false);
|
|
doPreciseCast.SetActive(value: false);
|
|
zoom.SetActive(value: false);
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
CallBoat.SetActive(value: false);
|
|
OnFishingSetUnequipOnOnRaised();
|
|
PlayerFSMOnOnValueChanged(PlayerFSM.Value);
|
|
IsLeaveWaterPosibleOnOnValueChanged(isPosible: false);
|
|
PlayerFSM.OnValueChanged += PlayerFSMOnOnValueChanged;
|
|
IsFishingSetEquiped.OnValueChanged += OnFishingSetEquipOnOnRaised;
|
|
IsLeaveWaterPosible.OnValueChanged += IsLeaveWaterPosibleOnOnValueChanged;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
PlayerFSM.OnValueChanged -= PlayerFSMOnOnValueChanged;
|
|
IsFishingSetEquiped.OnValueChanged -= OnFishingSetEquipOnOnRaised;
|
|
IsLeaveWaterPosible.OnValueChanged -= IsLeaveWaterPosibleOnOnValueChanged;
|
|
}
|
|
|
|
private void PlayerFSMOnOnValueChanged(State newState)
|
|
{
|
|
boatLights.SetActive(newState == State.vehicle);
|
|
if (PlayerFSM.PreviousValue == State.preciseCastIdle)
|
|
{
|
|
cancelPreciseCast.SetActive(value: false);
|
|
doPreciseCast.SetActive(value: false);
|
|
}
|
|
switch (newState)
|
|
{
|
|
case State.idle:
|
|
case State.move:
|
|
case State.vehicleFishing:
|
|
FishingSet1.SetActive(value: true);
|
|
FishingSet2.SetActive(value: true);
|
|
CastFar.SetActive(IsFishingSetEquiped.Value);
|
|
CastPrecise.SetActive(IsFishingSetEquiped.Value);
|
|
break;
|
|
case State.preciseCastIdle:
|
|
cancelPreciseCast.SetActive(value: true);
|
|
doPreciseCast.SetActive(value: true);
|
|
FishingSet1.SetActive(value: false);
|
|
FishingSet2.SetActive(value: false);
|
|
CastFar.SetActive(value: false);
|
|
CastPrecise.SetActive(value: false);
|
|
break;
|
|
default:
|
|
FishingSet1.SetActive(value: false);
|
|
FishingSet2.SetActive(value: false);
|
|
CastFar.SetActive(value: false);
|
|
CastPrecise.SetActive(value: false);
|
|
break;
|
|
}
|
|
switch (newState)
|
|
{
|
|
default:
|
|
ExitBoat.SetActive(value: false);
|
|
ChangeSeat.SetActive(value: false);
|
|
cutLine.SetActive(value: false);
|
|
resetLine.SetActive(value: false);
|
|
zoom.SetActive(value: false);
|
|
break;
|
|
case State.fishing:
|
|
case State.fight:
|
|
resetLine.SetActive(newState == State.fishing);
|
|
cutLine.SetActive(newState == State.fight);
|
|
zoom.SetActive(bobberObject.Value);
|
|
break;
|
|
case State.vehicle:
|
|
case State.vehicleFishing:
|
|
cutLine.SetActive(value: false);
|
|
resetLine.SetActive(value: false);
|
|
CallBoat.SetActive(value: false);
|
|
ExitBoat.SetActive(value: true);
|
|
ChangeSeat.SetActive(value: true);
|
|
zoom.SetActive(value: false);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void OnFishingSetEquipOnOnRaised(bool isEquiped)
|
|
{
|
|
CastFar.SetActive(isEquiped);
|
|
CastPrecise.SetActive(isEquiped);
|
|
}
|
|
|
|
private void IsLeaveWaterPosibleOnOnValueChanged(bool isPosible)
|
|
{
|
|
LeaveWater.SetActive(isPosible);
|
|
}
|
|
|
|
private void OnFishingSetUnequipOnOnRaised()
|
|
{
|
|
CastFar.SetActive(value: false);
|
|
CastPrecise.SetActive(value: false);
|
|
}
|
|
}
|