水电费第三方
This commit is contained in:
@@ -559,7 +559,7 @@
|
||||
"path": "<Mouse>/scroll",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Zoom",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -102,8 +102,8 @@ namespace WaveHarmonic.Crest.Watercraft.Examples
|
||||
input.z += Keyboard.current[_DriveBackward].isPressed ? -1f : 0f;
|
||||
input.x += Keyboard.current[_SteerLeftward].isPressed ? -1f : 0f;
|
||||
input.x += Keyboard.current[_SteerRightward].isPressed ? 1f : 0f;
|
||||
input.y += Keyboard.current[_FloatUpward].isPressed ? 1f : 0f;
|
||||
input.y += Keyboard.current[_FloatDownward].isPressed ? -1f : 0f;
|
||||
// input.y += Keyboard.current[_FloatUpward].isPressed ? 1f : 0f;
|
||||
// input.y += Keyboard.current[_FloatDownward].isPressed ? -1f : 0f;
|
||||
#else
|
||||
input.z = UnityEngine.Input.GetAxis(_DriveInputAxis);
|
||||
input.x = UnityEngine.Input.GetAxis(_SteerInputAxis);
|
||||
|
||||
@@ -959,7 +959,7 @@ Camera:
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.1
|
||||
far clip plane: 1000
|
||||
far clip plane: 3000
|
||||
field of view: 50
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
|
||||
3
Assets/Scripts/Fishing/Boat.meta
Normal file
3
Assets/Scripts/Fishing/Boat.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e465891621384ba890e69d4f2ee3ec27
|
||||
timeCreated: 1748265766
|
||||
89
Assets/Scripts/Fishing/Boat/Boat.cs
Normal file
89
Assets/Scripts/Fishing/Boat/Boat.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing/Boat/Boat.cs.meta
Normal file
3
Assets/Scripts/Fishing/Boat/Boat.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 206cf1531b7445518ce30ec8ecb0ad2a
|
||||
timeCreated: 1748265785
|
||||
@@ -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;
|
||||
|
||||
@@ -647,7 +647,7 @@ namespace NBF
|
||||
""path"": ""<Mouse>/scroll"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""groups"": "";Keyboard&Mouse"",
|
||||
""action"": ""Zoom"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -21,23 +21,23 @@ EditorUserSettings:
|
||||
value: 5b520400060d5a5a5b5b557641770b43424f1c28787d25612b2d196ab0b66068
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 5b08565357035d0c0f5d0a774277071242154029757170697b784e66e6b33060
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 0657525703505b030b5f5d2141255e4445164c7a7d71716475284f6bb6e33668
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-6:
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 51090c5503010d5d5f0b0e26427a0b444215402f287e7f327b2c1f30e6b8303c
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 020056535456585e0f0d0a7541210d441215482c2d297f36752c1b65b3b0376e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-8:
|
||||
RecentlyUsedSceneGuid-6:
|
||||
value: 5553075e5c0d59080f0d597347770f44444f4a7f78787e36782f4967bae43769
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-9:
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-8:
|
||||
value: 5b08565357035d0c0f5d0a774277071242154029757170697b784e66e6b33060
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-9:
|
||||
value: 020056535456585e0f0d0a7541210d441215482c2d297f36752c1b65b3b0376e
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
flags: 0
|
||||
|
||||
Reference in New Issue
Block a user