水电费第三方

This commit is contained in:
2025-05-26 23:24:36 +08:00
parent 763fa5103f
commit 7ad9f351c7
12 changed files with 66287 additions and 74572 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e465891621384ba890e69d4f2ee3ec27
timeCreated: 1748265766

View File

@@ -0,0 +1,89 @@
using System;
using UnityEngine;
using WaveHarmonic.Crest;
namespace NBF
{
public class Boat : MonoBehaviour
{
[Tooltip("移动力应施加于质心的垂直偏移量。")] [SerializeField]
float _ForceHeightOffset;
[Tooltip("水船因推力而移动的速度有多快。")] [SerializeField]
float _ThrustPower = 10f;
[Tooltip("船舵一转,船身就迅速转向。")] [SerializeField]
float _SteerPower = 1f;
[Tooltip("转弯时要转动船只。")] [Range(0, 1)] [SerializeField]
float _TurningHeel = 0.35f;
[Tooltip("对浮力变化应用曲线处理。")] [SerializeField]
AnimationCurve _BuoyancyCurveFactor = new(new Keyframe[]
{
new(0, 0, 0.01267637f, 0.01267637f),
new(0.6626424f, 0.1791001f, 0.8680198f, 0.8680198f), new(1, 1, 3.38758f, 3.38758f)
});
/// <summary>
/// 使用中
/// </summary>
public bool IsUse;
/// <summary>
/// 船站立位置
/// </summary>
public Transform standPlace;
/// <summary>
/// 浮力组件
/// </summary>
private FloatingObject _floatingObject;
private float _BuoyancyFactor = 1f;
private void Awake()
{
if (_floatingObject == null) _floatingObject = GetComponent<FloatingObject>();
}
private void FixedUpdate()
{
if (!IsUse) return;
if (!_floatingObject.InWater) return;
var input = Vector3.zero;
Vector2 moveInput = InputManager.GetMovementInput();
input.x = moveInput.x; // 水平转向x轴
input.z = moveInput.y; // 前后移动y轴映射到z轴
var rb = _floatingObject.RigidBody;
// Thrust
var forcePosition = rb.worldCenterOfMass + _ForceHeightOffset * Vector3.up;
rb.AddForceAtPosition(_ThrustPower * input.z * transform.forward, forcePosition, ForceMode.Acceleration);
// Steer
var rotation = transform.up + _TurningHeel * transform.forward;
rb.AddTorque(_SteerPower * input.x * rotation, ForceMode.Acceleration);
if (input.y > 0f)
{
if (_BuoyancyFactor < 1f)
{
_BuoyancyFactor += Time.deltaTime * 0.1f;
_BuoyancyFactor = Mathf.Clamp(_BuoyancyFactor, 0f, 1f);
_floatingObject.BuoyancyForceStrength = _BuoyancyCurveFactor.Evaluate(_BuoyancyFactor);
}
}
else if (input.y < 0f)
{
if (_BuoyancyFactor > 0f)
{
_BuoyancyFactor -= Time.deltaTime * 0.1f;
_BuoyancyFactor = Mathf.Clamp(_BuoyancyFactor, 0f, 1f);
_floatingObject.BuoyancyForceStrength = _BuoyancyCurveFactor.Evaluate(_BuoyancyFactor);
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 206cf1531b7445518ce30ec8ecb0ad2a
timeCreated: 1748265785

View File

@@ -5,6 +5,7 @@ using UnityEngine;
namespace NBF
{
public class PlayerCharacter : Character
{
private float _cameraPitch;
@@ -55,7 +56,7 @@ namespace NBF
transform.position = _player.Data.position;
transform.rotation = _player.Data.rotation;
InputManager.OnPlayerCanceled += OnPlayerCanceled;
InputManager.OnPlayerPerformed += OnPlayerPerformed;
// InputManager.OnRunAction += OnRunAction;
@@ -192,7 +193,7 @@ namespace NBF
{
// Move
Vector2 movementInput = InputManager.GetMovementInput();
Vector3 movementDirection = Vector3.zero;
movementDirection += Vector3.forward * movementInput.y;

View File

@@ -647,7 +647,7 @@ namespace NBF
""path"": ""<Mouse>/scroll"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""groups"": "";Keyboard&Mouse"",
""action"": ""Zoom"",
""isComposite"": false,
""isPartOfComposite"": false

View File

@@ -88,9 +88,9 @@ namespace NBF
{
PermanentCommon.Init();
InputDef.LoadIcon();
UI.Inst.OpenUI<FishingShopPanel>();
// UI.Inst.OpenUI<FishingShopPanel>();
LoadData();
// Fishing.Inst.Go(1);
Fishing.Inst.Go(1);
}
private void LoadData()