upfste
This commit is contained in:
17
Assets/Scripts/ArmTest.cs
Normal file
17
Assets/Scripts/ArmTest.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class ArmTest : MonoBehaviour
|
||||
{
|
||||
public Vector3 target;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
target = transform.localEulerAngles;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
transform.localEulerAngles = target;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/ArmTest.cs.meta
Normal file
2
Assets/Scripts/ArmTest.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad83af85ff21b474ca9354a150f14517
|
||||
8
Assets/Scripts/Def/GameDef.cs
Normal file
8
Assets/Scripts/Def/GameDef.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace NBF
|
||||
{
|
||||
public class GameDef
|
||||
{
|
||||
public const int NormalFOV = 50;
|
||||
public const int ZoomedFOV = 25;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Def/GameDef.cs.meta
Normal file
3
Assets/Scripts/Def/GameDef.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0e959f45daf44f2b7bf1efe6e8fbc2b
|
||||
timeCreated: 1747147951
|
||||
@@ -26,6 +26,7 @@ namespace NBF
|
||||
|
||||
public float currentReelingSpeed;
|
||||
public bool isHandOnHandle;
|
||||
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
@@ -36,6 +37,16 @@ namespace NBF
|
||||
/// </summary>
|
||||
public float reelSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// 打开手电筒
|
||||
/// </summary>
|
||||
public bool openLight;
|
||||
|
||||
/// <summary>
|
||||
/// 打开望远镜
|
||||
/// </summary>
|
||||
public bool openTelescope;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using NBC;
|
||||
using NBF;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
|
||||
@@ -40,10 +41,10 @@ public partial class FPlayer : MonoBehaviour
|
||||
|
||||
public FPlayerUseGear Gears;
|
||||
|
||||
public LineRenderer LineRenderer;
|
||||
|
||||
public LureTrajectorySimulator LureTrajectorySimulator;
|
||||
|
||||
public Transform Light;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
PlayerAnimatorCtrl = gameObject.GetComponent<PlayerAnimator>();
|
||||
@@ -58,7 +59,6 @@ public partial class FPlayer : MonoBehaviour
|
||||
Gears = gameObject.AddComponent<FPlayerUseGear>();
|
||||
}
|
||||
|
||||
LineRenderer = gameObject.GetComponent<LineRenderer>();
|
||||
LureTrajectorySimulator = gameObject.AddComponent<LureTrajectorySimulator>();
|
||||
|
||||
PlayerAnimatorCtrl.Player = this;
|
||||
@@ -156,17 +156,44 @@ public partial class FPlayer : MonoBehaviour
|
||||
Gears?.Update();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F))
|
||||
SyncLight();
|
||||
}
|
||||
|
||||
private void SyncLight()
|
||||
{
|
||||
if (Light)
|
||||
{
|
||||
var points = LureTrajectorySimulator.Test(BaseCamera.Main.transform);
|
||||
|
||||
// FishingCastInput exampleInput = FishingCastInput.Default();
|
||||
// points = LureTrajectorySimulator.CalculateTrajectory(exampleInput);
|
||||
|
||||
|
||||
Light.localRotation = BaseCamera.Main.transform.localRotation;
|
||||
if (Light.gameObject.activeSelf != Data.openLight)
|
||||
{
|
||||
Light.gameObject.SetActive(Data.openLight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Tween _fovTween; // 存储当前的Tween动画,方便中断
|
||||
private float _zoomDuration = 0.2f; // 缩放动画时间
|
||||
|
||||
/// <summary>
|
||||
/// 切换望远镜效果(打开/关闭)
|
||||
/// </summary>
|
||||
/// <param name="isZoomIn">true=打开望远镜,false=关闭望远镜</param>
|
||||
public void ToggleTelescope()
|
||||
{
|
||||
// 如果已经有动画在运行,先停止
|
||||
_fovTween?.Kill();
|
||||
|
||||
// 根据传入的参数决定目标FOV
|
||||
float targetFOV = Data.openTelescope ? GameDef.ZoomedFOV : GameDef.NormalFOV;
|
||||
|
||||
// 使用DoTween平滑过渡FOV
|
||||
_fovTween = DOTween.To(
|
||||
() => BaseCamera.Main.fieldOfView, // 获取当前FOV
|
||||
x => BaseCamera.Main.fieldOfView = x, // 设置新FOV
|
||||
targetFOV, // 目标FOV
|
||||
_zoomDuration // 动画时间
|
||||
).SetEase(Ease.InOutQuad); // 使用缓动函数让动画更平滑
|
||||
}
|
||||
|
||||
public bool CanChangeGear()
|
||||
{
|
||||
|
||||
@@ -36,11 +36,15 @@ namespace NBF
|
||||
App.Inst.SetMouseCurrsor(false);
|
||||
|
||||
InputManager.OnQuickIndexAction += OnQuickIndexAction;
|
||||
InputManager.OnUseTorchAction += OnUseTorchAction;
|
||||
InputManager.OnUseTelescopeAction += OnUseTelescopeAction;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
InputManager.OnQuickIndexAction -= OnQuickIndexAction;
|
||||
InputManager.OnUseTorchAction -= OnUseTorchAction;
|
||||
InputManager.OnUseTelescopeAction -= OnUseTelescopeAction;
|
||||
}
|
||||
|
||||
private void EnableFirstPersonController()
|
||||
@@ -53,6 +57,23 @@ namespace NBF
|
||||
nextShowSlotIndex = index;
|
||||
}
|
||||
|
||||
private void OnUseTorchAction(bool ret)
|
||||
{
|
||||
if (!ret)
|
||||
{
|
||||
_player.Data.openLight = !_player.Data.openLight;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUseTelescopeAction(bool ret)
|
||||
{
|
||||
if (!ret)
|
||||
{
|
||||
_player.Data.openTelescope = !_player.Data.openTelescope;
|
||||
_player.ToggleTelescope();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var movementAxis = InputManager.GetMovementInput();
|
||||
|
||||
@@ -398,6 +398,24 @@ namespace NBF
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Back"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""6b649cc4-0104-4234-bfe9-2d647df3862d"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""ReUse"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""45a833e1-2aaf-4907-ae1e-1d97ee260b18"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
@@ -961,6 +979,28 @@ namespace NBF
|
||||
""action"": ""Quick9"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""9f16f60c-4749-4672-bdaf-9fb804c0b6f1"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Back"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""7e0ce3aa-9cf2-4b1e-9995-756ccbdeeda4"",
|
||||
""path"": ""<Keyboard>/y"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ReUse"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1092,6 +1132,8 @@ namespace NBF
|
||||
m_Normal_Quick7 = m_Normal.FindAction("Quick7", throwIfNotFound: true);
|
||||
m_Normal_Quick8 = m_Normal.FindAction("Quick8", throwIfNotFound: true);
|
||||
m_Normal_Quick9 = m_Normal.FindAction("Quick9", throwIfNotFound: true);
|
||||
m_Normal_Back = m_Normal.FindAction("Back", throwIfNotFound: true);
|
||||
m_Normal_ReUse = m_Normal.FindAction("ReUse", throwIfNotFound: true);
|
||||
// UI
|
||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||
m_UI_Roll = m_UI.FindAction("Roll", throwIfNotFound: true);
|
||||
@@ -1210,6 +1252,8 @@ namespace NBF
|
||||
private readonly InputAction m_Normal_Quick7;
|
||||
private readonly InputAction m_Normal_Quick8;
|
||||
private readonly InputAction m_Normal_Quick9;
|
||||
private readonly InputAction m_Normal_Back;
|
||||
private readonly InputAction m_Normal_ReUse;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Normal".
|
||||
/// </summary>
|
||||
@@ -1358,6 +1402,14 @@ namespace NBF
|
||||
/// </summary>
|
||||
public InputAction @Quick9 => m_Wrapper.m_Normal_Quick9;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Normal/Back".
|
||||
/// </summary>
|
||||
public InputAction @Back => m_Wrapper.m_Normal_Back;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Normal/ReUse".
|
||||
/// </summary>
|
||||
public InputAction @ReUse => m_Wrapper.m_Normal_ReUse;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Normal; }
|
||||
@@ -1485,6 +1537,12 @@ namespace NBF
|
||||
@Quick9.started += instance.OnQuick9;
|
||||
@Quick9.performed += instance.OnQuick9;
|
||||
@Quick9.canceled += instance.OnQuick9;
|
||||
@Back.started += instance.OnBack;
|
||||
@Back.performed += instance.OnBack;
|
||||
@Back.canceled += instance.OnBack;
|
||||
@ReUse.started += instance.OnReUse;
|
||||
@ReUse.performed += instance.OnReUse;
|
||||
@ReUse.canceled += instance.OnReUse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1598,6 +1656,12 @@ namespace NBF
|
||||
@Quick9.started -= instance.OnQuick9;
|
||||
@Quick9.performed -= instance.OnQuick9;
|
||||
@Quick9.canceled -= instance.OnQuick9;
|
||||
@Back.started -= instance.OnBack;
|
||||
@Back.performed -= instance.OnBack;
|
||||
@Back.canceled -= instance.OnBack;
|
||||
@ReUse.started -= instance.OnReUse;
|
||||
@ReUse.performed -= instance.OnReUse;
|
||||
@ReUse.canceled -= instance.OnReUse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2037,6 +2101,20 @@ namespace NBF
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnQuick9(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Back" 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 OnBack(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "ReUse" 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 OnReUse(InputAction.CallbackContext context);
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace NBF
|
||||
private const long GameEpoch = 1672531200000; // 2023-01-01 00:00:00 UTC
|
||||
|
||||
// 时间加速比例 (1现实秒 = 15游戏秒)
|
||||
private const int TimeAcceleration = 20;
|
||||
private const int TimeAcceleration = 200;
|
||||
|
||||
//一天, 一小时, 一分钟固定时长(毫秒)
|
||||
public const long DAY_MILLS = 86400000;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SceneSettings : MonoBehaviour
|
||||
private void Start()
|
||||
{
|
||||
// EnviroManager.instance.Time.Settings.simulate = true;
|
||||
EnviroManager.instance.Time.SetTimeOfDay(0.4f * 24f);
|
||||
EnviroManager.instance.Time.SetTimeOfDay(0.1f * 24f);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
Reference in New Issue
Block a user