ECM2
This commit is contained in:
@@ -25,12 +25,17 @@ namespace NBF
|
||||
public Quaternion rotation;
|
||||
|
||||
public float currentReelingSpeed;
|
||||
|
||||
public bool isHandOnHandle;
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
public float lineLength;
|
||||
|
||||
/// <summary>
|
||||
/// 收线速度
|
||||
/// </summary>
|
||||
public float reelSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
|
||||
@@ -686,29 +686,29 @@ public class FFish : MonoBehaviour
|
||||
currentBaitLure.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
|
||||
if (currentRod.linelenghtDiferent > 0f &&
|
||||
Vector3.Distance(transform.position, currentRod.transform.position) < 5f && InputManager.isPullUpRod)
|
||||
{
|
||||
getFishCounter = Mathf.MoveTowards(getFishCounter, 1f, Time.deltaTime * 0.5f);
|
||||
// FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(getFishCounter);
|
||||
if (Mathf.Approximately(getFishCounter, 1f))
|
||||
{
|
||||
GetFish();
|
||||
// FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(-1f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (currentRod.linelenghtDiferent > 0f &&
|
||||
Vector3.Distance(transform.position, currentRod.transform.position) < 5f)
|
||||
{
|
||||
getFishCounter = 0f;
|
||||
// FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
getFishCounter = 0f;
|
||||
// FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(-1f);
|
||||
}
|
||||
// if (currentRod.linelenghtDiferent > 0f &&
|
||||
// Vector3.Distance(transform.position, currentRod.transform.position) < 5f && InputManager.isPullUpRod)
|
||||
// {
|
||||
// getFishCounter = Mathf.MoveTowards(getFishCounter, 1f, Time.deltaTime * 0.5f);
|
||||
// // FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(getFishCounter);
|
||||
// if (Mathf.Approximately(getFishCounter, 1f))
|
||||
// {
|
||||
// GetFish();
|
||||
// // FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(-1f);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else if (currentRod.linelenghtDiferent > 0f &&
|
||||
// Vector3.Distance(transform.position, currentRod.transform.position) < 5f)
|
||||
// {
|
||||
// getFishCounter = 0f;
|
||||
// // FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(0f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// getFishCounter = 0f;
|
||||
// // FScriptsHandler.Instance.m_HudManager.ShowGetFishCircle(-1f);
|
||||
// }
|
||||
|
||||
if (CheckUnnhookFish() && getFishCounter == 0f)
|
||||
{
|
||||
@@ -724,62 +724,62 @@ public class FFish : MonoBehaviour
|
||||
var reel = currentRod.Owner.Gears.Reel;
|
||||
if ((bool)currentRod.Owner)
|
||||
{
|
||||
if (InputManager.isPullUpRod)
|
||||
{
|
||||
pullingTime += Time.deltaTime;
|
||||
if (currentRod.Owner.handPullUp < 1f)
|
||||
{
|
||||
if (reel.reelingDrag > 0f)
|
||||
{
|
||||
if (reel.reelingDrag < 1f)
|
||||
{
|
||||
fishingReel = true;
|
||||
}
|
||||
|
||||
int num2 = 2;
|
||||
if (pullingTime < num2)
|
||||
{
|
||||
float num3 = currentRod.Owner.handPullUp *
|
||||
currentRod.currentLineStrenght * 0.25f / fishWeight;
|
||||
num -= num3;
|
||||
fishStrenght -= num3;
|
||||
fishStamina = Mathf.MoveTowards(fishStamina, 0.03f, Time.deltaTime * num3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reel.reelingDrag > 0f)
|
||||
{
|
||||
fishingReel = true;
|
||||
fishStamina = Mathf.MoveTowards(fishStamina, 0.03f,
|
||||
Time.deltaTime * 0.025f * currentRod.currentLineStrenght *
|
||||
reel.reelingDrag);
|
||||
if (fishStamina <= 0.035 && fishWeight >= 300f)
|
||||
{
|
||||
Vector3 position = SceneSettings.Instance.transform.position;
|
||||
Quaternion b = Quaternion.LookRotation(position - transform.position);
|
||||
float value = Vector3.Distance(transform.position, position);
|
||||
rigidbody.rotation = Quaternion.Slerp(rigidbody.rotation, b, Time.deltaTime * (5f + speed));
|
||||
rigidbody.transform.Translate(Vector3.forward * Time.deltaTime * speed);
|
||||
speed = Mathf.MoveTowards(speed, Mathf.Clamp01(value) * 0.25f + 0.1f, Time.deltaTime);
|
||||
SetAngularAnim(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pullingTime != 0f)
|
||||
{
|
||||
pullingTime = 0f;
|
||||
}
|
||||
|
||||
fishingReel = false;
|
||||
if (reel.reelingDrag > 0f)
|
||||
{
|
||||
fishStamina = Mathf.MoveTowards(fishStamina, 0.03f,
|
||||
Time.deltaTime * 0.001f * currentRod.currentLineStrenght *
|
||||
reel.reelingDrag);
|
||||
}
|
||||
}
|
||||
// if (InputManager.isPullUpRod)
|
||||
// {
|
||||
// pullingTime += Time.deltaTime;
|
||||
// if (currentRod.Owner.handPullUp < 1f)
|
||||
// {
|
||||
// if (reel.reelingDrag > 0f)
|
||||
// {
|
||||
// if (reel.reelingDrag < 1f)
|
||||
// {
|
||||
// fishingReel = true;
|
||||
// }
|
||||
//
|
||||
// int num2 = 2;
|
||||
// if (pullingTime < num2)
|
||||
// {
|
||||
// float num3 = currentRod.Owner.handPullUp *
|
||||
// currentRod.currentLineStrenght * 0.25f / fishWeight;
|
||||
// num -= num3;
|
||||
// fishStrenght -= num3;
|
||||
// fishStamina = Mathf.MoveTowards(fishStamina, 0.03f, Time.deltaTime * num3);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (reel.reelingDrag > 0f)
|
||||
// {
|
||||
// fishingReel = true;
|
||||
// fishStamina = Mathf.MoveTowards(fishStamina, 0.03f,
|
||||
// Time.deltaTime * 0.025f * currentRod.currentLineStrenght *
|
||||
// reel.reelingDrag);
|
||||
// if (fishStamina <= 0.035 && fishWeight >= 300f)
|
||||
// {
|
||||
// Vector3 position = SceneSettings.Instance.transform.position;
|
||||
// Quaternion b = Quaternion.LookRotation(position - transform.position);
|
||||
// float value = Vector3.Distance(transform.position, position);
|
||||
// rigidbody.rotation = Quaternion.Slerp(rigidbody.rotation, b, Time.deltaTime * (5f + speed));
|
||||
// rigidbody.transform.Translate(Vector3.forward * Time.deltaTime * speed);
|
||||
// speed = Mathf.MoveTowards(speed, Mathf.Clamp01(value) * 0.25f + 0.1f, Time.deltaTime);
|
||||
// SetAngularAnim(position);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (pullingTime != 0f)
|
||||
// {
|
||||
// pullingTime = 0f;
|
||||
// }
|
||||
//
|
||||
// fishingReel = false;
|
||||
// if (reel.reelingDrag > 0f)
|
||||
// {
|
||||
// fishStamina = Mathf.MoveTowards(fishStamina, 0.03f,
|
||||
// Time.deltaTime * 0.001f * currentRod.currentLineStrenght *
|
||||
// reel.reelingDrag);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// if ((bool)currentRod.currentPlayer &&
|
||||
|
||||
129
Assets/Scripts/Fishing/InputManager.cs
Normal file
129
Assets/Scripts/Fishing/InputManager.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using System.Runtime.InteropServices;
|
||||
// using Rewired;
|
||||
using UnityEngine;
|
||||
|
||||
public class InputManager : MonoBehaviour
|
||||
{
|
||||
public struct POINT
|
||||
{
|
||||
public int X;
|
||||
|
||||
public int Y;
|
||||
}
|
||||
|
||||
|
||||
// [Tooltip("Rewired Input Manager's player used for handling player's input")]
|
||||
// private Player player;
|
||||
|
||||
public bool IgnoreAllInput = false;
|
||||
|
||||
|
||||
public static bool IsMouseLeft;
|
||||
public static bool IsMouseRight;
|
||||
|
||||
|
||||
public static bool isShowSlot0;
|
||||
|
||||
public static bool isShowSlot1;
|
||||
|
||||
public static bool isShowSlot2;
|
||||
|
||||
public static bool isShowSlot3;
|
||||
|
||||
public static bool isShowSlot4;
|
||||
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool SetCursorPos(int X, int Y);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool GetCursorPos(out POINT lpPoint);
|
||||
|
||||
|
||||
private PlayerInputControl _playerInputControl;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_playerInputControl = new PlayerInputControl();
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (IgnoreAllInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
IsMouseLeft = true;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
{
|
||||
IsMouseLeft = false;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
IsMouseRight = true;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonUp(1))
|
||||
{
|
||||
IsMouseRight = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha0))
|
||||
{
|
||||
isShowSlot0 = true;
|
||||
Debug.LogError("showSlot0======");
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot0 = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
||||
{
|
||||
isShowSlot1 = true;
|
||||
Debug.LogError("showSlot1======");
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot1 = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha2))
|
||||
{
|
||||
isShowSlot2 = true;
|
||||
Debug.LogError("showSlot2======");
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot2 = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha3))
|
||||
{
|
||||
isShowSlot3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot3 = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha4))
|
||||
{
|
||||
isShowSlot4 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isShowSlot4 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing/InputManager.cs.meta
Normal file
3
Assets/Scripts/Fishing/InputManager.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fecc50928be248b896f6ee0a17e7b76d
|
||||
timeCreated: 1746892722
|
||||
@@ -21,6 +21,11 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddPlayer(FPlayerData player)
|
||||
{
|
||||
Players[player.PlayerID] = player;
|
||||
@@ -176,7 +181,6 @@ namespace NBF
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
@@ -184,8 +188,6 @@ namespace NBF
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -110,5 +110,10 @@ namespace NBF
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
using NBC;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class Fishing
|
||||
{
|
||||
Fishing()
|
||||
{
|
||||
MonoManager.Inst.OnUpdate += Update;
|
||||
}
|
||||
|
||||
private static Fishing _inst;
|
||||
|
||||
public static Fishing Inst => _inst ??= new Fishing();
|
||||
@@ -33,6 +36,12 @@ namespace NBF
|
||||
#endregion
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
Datasource?.Update();
|
||||
Player?.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入地图成功
|
||||
/// </summary>
|
||||
|
||||
@@ -85,7 +85,7 @@ public partial class FPlayer
|
||||
interactionCCDIK = component;
|
||||
if (Gears.Reel)
|
||||
{
|
||||
Gears.Reel.isHandOnHandle = false;
|
||||
Data.isHandOnHandle = false;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -99,7 +99,7 @@ public partial class FPlayer
|
||||
interactionCCDIK = component;
|
||||
if ((bool)Gears.Rod && (bool)Gears.Reel)
|
||||
{
|
||||
Gears.Reel.isHandOnHandle = true;
|
||||
Data.isHandOnHandle = true;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -110,11 +110,10 @@ public partial class FPlayer
|
||||
interactionCCDIK = component;
|
||||
if ((bool)Gears.Rod && (bool)Gears.Reel)
|
||||
{
|
||||
Gears.Reel.isHandOnHandle = false;
|
||||
Data.isHandOnHandle = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,22 +167,22 @@ public class FFloat : FPlayerGear
|
||||
currentFloatDeepth = newDeepth;
|
||||
}
|
||||
|
||||
if (InputManager.isDeepthFloatUp)
|
||||
{
|
||||
newDeepth += 0.1f;
|
||||
newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
}
|
||||
|
||||
if (InputManager.isDeepthFloatDown)
|
||||
{
|
||||
newDeepth -= 0.1f;
|
||||
newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
|
||||
Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
}
|
||||
// if (InputManager.isDeepthFloatUp)
|
||||
// {
|
||||
// newDeepth += 0.1f;
|
||||
// newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
// Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// // GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isDeepthFloatDown)
|
||||
// {
|
||||
// newDeepth -= 0.1f;
|
||||
// newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
//
|
||||
// Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// // GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
// }
|
||||
|
||||
if (Owner.Data.selectorRodSetting == SelectorRodSetting.Leeder &&
|
||||
Input.mouseScrollDelta.y != 0f && Time.timeScale != 0f)
|
||||
|
||||
@@ -137,9 +137,9 @@ public class FLineHandler : MonoBehaviour
|
||||
LineConnector_1.maxDistance = 0.1f + Rod.Owner.Data.lineLength;
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
var speed = 1;
|
||||
obiRopeCursor_1.ChangeLength(LineConnector_1.maxDistance);
|
||||
Debug.Log(obiRopeSegment_1.restLength);
|
||||
// var speed = 1;
|
||||
// obiRopeCursor_1.ChangeLength(LineConnector_1.maxDistance);
|
||||
// Debug.Log(obiRopeSegment_1.restLength);
|
||||
}
|
||||
|
||||
// var addLength = LineConnector_1.maxDistance - obiRopeSegment_1.restLength;
|
||||
|
||||
@@ -6,15 +6,9 @@ public class FReel : FPlayerGear
|
||||
{
|
||||
public bool isBlockLineByFinger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手是否放在手柄上
|
||||
/// </summary>
|
||||
[HideInInspector]
|
||||
public bool isHandOnHandle { get; set; }
|
||||
|
||||
|
||||
[SerializeField] public float reelingDrag = 1f;
|
||||
|
||||
|
||||
|
||||
public ReelAsset reelAsset;
|
||||
|
||||
@@ -37,6 +31,12 @@ public class FReel : FPlayerGear
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
AnimatorCtrl.Reeling = Owner.Data.reelSpeed;
|
||||
if (Owner.Data.reelSpeed > 0)
|
||||
{
|
||||
Unlock();
|
||||
}
|
||||
// Reeling();
|
||||
}
|
||||
|
||||
public void Unlock(bool unlock = true)
|
||||
|
||||
@@ -218,7 +218,7 @@ public class FRod : FPlayerGear
|
||||
if ((bool)lineHandler)
|
||||
{
|
||||
ObiSolver component = lineHandler.GetComponent<ObiSolver>();
|
||||
// SceneSettings.Instance.obiFixedUpdater.solvers.Remove(component);
|
||||
SceneSettings.Instance.obiFixedUpdater.solvers.Remove(component);
|
||||
Destroy(lineHandler.gameObject);
|
||||
lineHandler = null;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class FRod : FPlayerGear
|
||||
// lineHandler.toRodConnector.target = rodAsset.lineConnector;
|
||||
lineHandler.Rod = this;
|
||||
var obiSolver = lineHandler.GetComponent<ObiSolver>();
|
||||
// SceneSettings.Instance.obiFixedUpdater.solvers.Add(obiSolver);
|
||||
SceneSettings.Instance.obiFixedUpdater.solvers.Add(obiSolver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ namespace NBF
|
||||
|
||||
private void Update()
|
||||
{
|
||||
firstPersonController.horizontal = InputManager.movementAxis.x;
|
||||
firstPersonController.vertical = InputManager.movementAxis.y;
|
||||
|
||||
firstPersonController.isJumping = InputManager.isJumping;
|
||||
firstPersonController.isRuning = InputManager.isRunning;
|
||||
// firstPersonController.horizontal = InputManager.movementAxis.x;
|
||||
// firstPersonController.vertical = InputManager.movementAxis.y;
|
||||
//
|
||||
// firstPersonController.isJumping = InputManager.isJumping;
|
||||
// firstPersonController.isRuning = InputManager.isRunning;
|
||||
|
||||
// firstPersonController.m_MouseLook.ControllerHandMode = GameManager.Instance._playerData
|
||||
// .Player[GameManager.Instance._playerData.currentPlayerProfileIndex].controllerSetup;
|
||||
@@ -77,30 +77,30 @@ namespace NBF
|
||||
|
||||
if (_player.CanChangeGear())
|
||||
{
|
||||
if (InputManager.isShowSlot0)
|
||||
{
|
||||
nextShowSlotIndex = 0;
|
||||
}
|
||||
|
||||
if (InputManager.isShowSlot1)
|
||||
{
|
||||
nextShowSlotIndex = 1;
|
||||
}
|
||||
|
||||
if (InputManager.isShowSlot2)
|
||||
{
|
||||
nextShowSlotIndex = 2;
|
||||
}
|
||||
|
||||
if (InputManager.isShowSlot3)
|
||||
{
|
||||
nextShowSlotIndex = 3;
|
||||
}
|
||||
|
||||
if (InputManager.isShowSlot4)
|
||||
{
|
||||
nextShowSlotIndex = 4;
|
||||
}
|
||||
// if (InputManager.isShowSlot0)
|
||||
// {
|
||||
// nextShowSlotIndex = 0;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot1)
|
||||
// {
|
||||
// nextShowSlotIndex = 1;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot2)
|
||||
// {
|
||||
// nextShowSlotIndex = 2;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot3)
|
||||
// {
|
||||
// nextShowSlotIndex = 3;
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isShowSlot4)
|
||||
// {
|
||||
// nextShowSlotIndex = 4;
|
||||
// }
|
||||
|
||||
if (nextShowSlotIndex != -1)
|
||||
{
|
||||
|
||||
311
Assets/Scripts/Fishing/PlayerInputControl.cs
Normal file
311
Assets/Scripts/Fishing/PlayerInputControl.cs
Normal file
@@ -0,0 +1,311 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.14.0
|
||||
// from Assets/PlayerInputControl.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/PlayerInputControl.inputactions".
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// using namespace UnityEngine;
|
||||
/// using UnityEngine.InputSystem;
|
||||
///
|
||||
/// // Example of using an InputActionMap named "Player" from a UnityEngine.MonoBehaviour implementing callback interface.
|
||||
/// public class Example : MonoBehaviour, MyActions.IPlayerActions
|
||||
/// {
|
||||
/// private MyActions_Actions m_Actions; // Source code representation of asset.
|
||||
/// private MyActions_Actions.PlayerActions m_Player; // Source code representation of action map.
|
||||
///
|
||||
/// void Awake()
|
||||
/// {
|
||||
/// m_Actions = new MyActions_Actions(); // Create asset object.
|
||||
/// m_Player = m_Actions.Player; // Extract action map object.
|
||||
/// m_Player.AddCallbacks(this); // Register callback interface IPlayerActions.
|
||||
/// }
|
||||
///
|
||||
/// void OnDestroy()
|
||||
/// {
|
||||
/// m_Actions.Dispose(); // Destroy asset object.
|
||||
/// }
|
||||
///
|
||||
/// void OnEnable()
|
||||
/// {
|
||||
/// m_Player.Enable(); // Enable all actions within map.
|
||||
/// }
|
||||
///
|
||||
/// void OnDisable()
|
||||
/// {
|
||||
/// m_Player.Disable(); // Disable all actions within map.
|
||||
/// }
|
||||
///
|
||||
/// #region Interface implementation of MyActions.IPlayerActions
|
||||
///
|
||||
/// // Invoked when "Move" action is either started, performed or canceled.
|
||||
/// public void OnMove(InputAction.CallbackContext context)
|
||||
/// {
|
||||
/// Debug.Log($"OnMove: {context.ReadValue<Vector2>()}");
|
||||
/// }
|
||||
///
|
||||
/// // Invoked when "Attack" action is either started, performed or canceled.
|
||||
/// public void OnAttack(InputAction.CallbackContext context)
|
||||
/// {
|
||||
/// Debug.Log($"OnAttack: {context.ReadValue<float>()}");
|
||||
/// }
|
||||
///
|
||||
/// #endregion
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
public partial class @PlayerInputControl: IInputActionCollection2, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the underlying asset instance.
|
||||
/// </summary>
|
||||
public InputActionAsset asset { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public @PlayerInputControl()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""PlayerInputControl"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""Normal"",
|
||||
""id"": ""e27ef1cb-bee4-466d-b123-4e3933d36713"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Jump"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""23ec065e-8aa4-4703-9210-e986bf59a239"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""622e8738-80f9-4c47-bdfc-febb097cff74"",
|
||||
""path"": ""<Keyboard>/space"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Jump"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": []
|
||||
}");
|
||||
// Normal
|
||||
m_Normal = asset.FindActionMap("Normal", throwIfNotFound: true);
|
||||
m_Normal_Jump = m_Normal.FindAction("Jump", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
~@PlayerInputControl()
|
||||
{
|
||||
UnityEngine.Debug.Assert(!m_Normal.enabled, "This will cause a leak and performance issues, PlayerInputControl.Normal.Disable() has not been called.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroys this asset and all associated <see cref="InputAction"/> instances.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.Destroy(asset);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindingMask" />
|
||||
public InputBinding? bindingMask
|
||||
{
|
||||
get => asset.bindingMask;
|
||||
set => asset.bindingMask = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.devices" />
|
||||
public ReadOnlyArray<InputDevice>? devices
|
||||
{
|
||||
get => asset.devices;
|
||||
set => asset.devices = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.controlSchemes" />
|
||||
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Contains(InputAction)" />
|
||||
public bool Contains(InputAction action)
|
||||
{
|
||||
return asset.Contains(action);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.GetEnumerator()" />
|
||||
public IEnumerator<InputAction> GetEnumerator()
|
||||
{
|
||||
return asset.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IEnumerable.GetEnumerator()" />
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Enable()" />
|
||||
public void Enable()
|
||||
{
|
||||
asset.Enable();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.Disable()" />
|
||||
public void Disable()
|
||||
{
|
||||
asset.Disable();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.bindings" />
|
||||
public IEnumerable<InputBinding> bindings => asset.bindings;
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindAction(string, bool)" />
|
||||
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
||||
{
|
||||
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionAsset.FindBinding(InputBinding, out InputAction)" />
|
||||
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
||||
{
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// Normal
|
||||
private readonly InputActionMap m_Normal;
|
||||
private List<INormalActions> m_NormalActionsCallbackInterfaces = new List<INormalActions>();
|
||||
private readonly InputAction m_Normal_Jump;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Normal".
|
||||
/// </summary>
|
||||
public struct NormalActions
|
||||
{
|
||||
private @PlayerInputControl m_Wrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance of the input action map wrapper class.
|
||||
/// </summary>
|
||||
public NormalActions(@PlayerInputControl wrapper) { m_Wrapper = wrapper; }
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Normal/Jump".
|
||||
/// </summary>
|
||||
public InputAction @Jump => m_Wrapper.m_Normal_Jump;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Normal; }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Enable()" />
|
||||
public void Enable() { Get().Enable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.Disable()" />
|
||||
public void Disable() { Get().Disable(); }
|
||||
/// <inheritdoc cref="UnityEngine.InputSystem.InputActionMap.enabled" />
|
||||
public bool enabled => Get().enabled;
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see ref="NormalActions" /> to an <see ref="InputActionMap" /> instance.
|
||||
/// </summary>
|
||||
public static implicit operator InputActionMap(NormalActions set) { return set.Get(); }
|
||||
/// <summary>
|
||||
/// Adds <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <param name="instance">Callback instance.</param>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c> or <paramref name="instance"/> have already been added this method does nothing.
|
||||
/// </remarks>
|
||||
/// <seealso cref="NormalActions" />
|
||||
public void AddCallbacks(INormalActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_NormalActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_NormalActionsCallbackInterfaces.Add(instance);
|
||||
@Jump.started += instance.OnJump;
|
||||
@Jump.performed += instance.OnJump;
|
||||
@Jump.canceled += instance.OnJump;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes <see cref="InputAction.started"/>, <see cref="InputAction.performed"/> and <see cref="InputAction.canceled"/> callbacks provided via <param cref="instance" /> on all input actions contained in this map.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Calling this method when <paramref name="instance" /> have not previously been registered has no side-effects.
|
||||
/// </remarks>
|
||||
/// <seealso cref="NormalActions" />
|
||||
private void UnregisterCallbacks(INormalActions instance)
|
||||
{
|
||||
@Jump.started -= instance.OnJump;
|
||||
@Jump.performed -= instance.OnJump;
|
||||
@Jump.canceled -= instance.OnJump;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters <param cref="instance" /> and unregisters all input action callbacks via <see cref="NormalActions.UnregisterCallbacks(INormalActions)" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="NormalActions.UnregisterCallbacks(INormalActions)" />
|
||||
public void RemoveCallbacks(INormalActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_NormalActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces all existing callback instances and previously registered input action callbacks associated with them with callbacks provided via <param cref="instance" />.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <paramref name="instance" /> is <c>null</c>, calling this method will only unregister all existing callbacks but not register any new callbacks.
|
||||
/// </remarks>
|
||||
/// <seealso cref="NormalActions.AddCallbacks(INormalActions)" />
|
||||
/// <seealso cref="NormalActions.RemoveCallbacks(INormalActions)" />
|
||||
/// <seealso cref="NormalActions.UnregisterCallbacks(INormalActions)" />
|
||||
public void SetCallbacks(INormalActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_NormalActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_NormalActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Provides a new <see cref="NormalActions" /> instance referencing this action map.
|
||||
/// </summary>
|
||||
public NormalActions @Normal => new NormalActions(this);
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "Normal" which allows adding and removing callbacks.
|
||||
/// </summary>
|
||||
/// <seealso cref="NormalActions.AddCallbacks(INormalActions)" />
|
||||
/// <seealso cref="NormalActions.RemoveCallbacks(INormalActions)" />
|
||||
public interface INormalActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Jump" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnJump(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Fishing/PlayerInputControl.cs.meta
Normal file
2
Assets/Scripts/Fishing/PlayerInputControl.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdaa795bad2ccc34faab0c9036785b02
|
||||
File diff suppressed because it is too large
Load Diff
@@ -122,13 +122,13 @@ namespace NBF
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
InputManager inputManager = FindObjectOfType<InputManager>();
|
||||
// InputManager inputManager = FindObjectOfType<InputManager>();
|
||||
if (controllerType == ControllerType.KeyboardMouse)
|
||||
{
|
||||
Cursor.visible = true;
|
||||
}
|
||||
|
||||
inputManager.SetCursorPositionToScreenCenter();
|
||||
// inputManager.SetCursorPositionToScreenCenter();
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
else if (controllerType == ControllerType.KeyboardMouse)
|
||||
|
||||
Reference in New Issue
Block a user