船相关脚本呢
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4372,6 +4372,8 @@ MonoBehaviour:
|
||||
LureTrajectorySimulator: {fileID: 0}
|
||||
Light: {fileID: 4424852676135480966}
|
||||
BackSpine: {fileID: 2935101413777606001}
|
||||
Collider: {fileID: 8570688911153839359}
|
||||
Rigidbody: {fileID: 3149647016773794308}
|
||||
--- !u!114 &8072573713298176091
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -25,12 +25,6 @@ namespace NBF
|
||||
new(0.6626424f, 0.1791001f, 0.8680198f, 0.8680198f), new(1, 1, 3.38758f, 3.38758f)
|
||||
});
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 使用中
|
||||
/// </summary>
|
||||
public bool IsUse;
|
||||
|
||||
/// <summary>
|
||||
/// 船站立位置
|
||||
/// </summary>
|
||||
@@ -40,22 +34,23 @@ namespace NBF
|
||||
/// 浮力组件
|
||||
/// </summary>
|
||||
private FloatingObject _floatingObject;
|
||||
|
||||
|
||||
private float _BuoyancyFactor = 1f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (_floatingObject == null) _floatingObject = GetComponent<FloatingObject>();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
|
||||
public void BoatInput(Vector2 moveInput)
|
||||
{
|
||||
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
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace NBF
|
||||
Data = datasource;
|
||||
}
|
||||
|
||||
public FPlayer SelfPlayer;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
// FishingData = fishingData;
|
||||
|
||||
@@ -26,7 +26,6 @@ public partial class FPlayer : MonoBehaviour
|
||||
|
||||
public PlayerAnimator PlayerAnimatorCtrl;
|
||||
|
||||
|
||||
public FPlayerUseGear Gears;
|
||||
|
||||
public LureTrajectorySimulator LureTrajectorySimulator;
|
||||
@@ -34,6 +33,10 @@ public partial class FPlayer : MonoBehaviour
|
||||
public Transform Light;
|
||||
|
||||
public Transform BackSpine;
|
||||
|
||||
public CapsuleCollider Collider;
|
||||
|
||||
public Rigidbody Rigidbody;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -53,6 +56,7 @@ public partial class FPlayer : MonoBehaviour
|
||||
|
||||
PlayerAnimatorCtrl.Player = this;
|
||||
Arms = GetComponentsInChildren<PlayerArm>();
|
||||
Collider = GetComponent<CapsuleCollider>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@@ -72,6 +76,7 @@ public partial class FPlayer : MonoBehaviour
|
||||
|
||||
if (data.PlayerID == GameModel.RoleID)
|
||||
{
|
||||
Fishing.Inst.Player.SelfPlayer = this;
|
||||
BaseCamera.Main.transform.SetParent(CameraRoot);
|
||||
BaseCamera.Main.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
@@ -158,6 +163,8 @@ public partial class FPlayer : MonoBehaviour
|
||||
private Tween _fovTween; // 存储当前的Tween动画,方便中断
|
||||
private float _zoomDuration = 0.2f; // 缩放动画时间
|
||||
|
||||
public Boat NowBoat { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 切换望远镜效果(打开/关闭)
|
||||
/// </summary>
|
||||
@@ -183,4 +190,20 @@ public partial class FPlayer : MonoBehaviour
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void EnterBoat(Boat boat)
|
||||
{
|
||||
NowBoat = boat;
|
||||
transform.parent = boat.standPlace;
|
||||
transform.localPosition = Vector3.zero;
|
||||
Collider.enabled = false;
|
||||
Rigidbody.isKinematic = false;
|
||||
}
|
||||
|
||||
public void ExitBoat()
|
||||
{
|
||||
NowBoat = null;
|
||||
Collider.enabled = true;
|
||||
Rigidbody.isKinematic = true;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerBoat.cs
Normal file
11
Assets/Scripts/Fishing/Player/PlayerCharacter/PlayerBoat.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 玩家船控制
|
||||
/// </summary>
|
||||
public class PlayerBoat : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2b9c0a2b0754a908bc071754c1ed74b
|
||||
timeCreated: 1748275883
|
||||
@@ -5,13 +5,11 @@ using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
|
||||
public class PlayerCharacter : Character
|
||||
{
|
||||
private float _cameraPitch;
|
||||
private FPlayer _player;
|
||||
|
||||
|
||||
[Space(10.0f)] public float maxSprintSpeed = 10.0f;
|
||||
|
||||
public GameObject cameraParent;
|
||||
@@ -25,7 +23,6 @@ namespace NBF
|
||||
[HideInInspector] public int nextShowSlotIndex = -1;
|
||||
public bool IsSelf;
|
||||
|
||||
|
||||
public LookAtIK lookAtIK; // 挂在背部上的 LookAtIK 脚本
|
||||
public float aimDistance = 1.5f; // 目标点离相机多远
|
||||
|
||||
@@ -70,7 +67,16 @@ namespace NBF
|
||||
private void Update()
|
||||
{
|
||||
InteractiveCheck();
|
||||
UpdatePlayerPositionAndRotation();
|
||||
if (_player.NowBoat)
|
||||
{
|
||||
_player.NowBoat.BoatInput(InputManager.GetMovementInput());
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdatePlayerPosition();
|
||||
}
|
||||
|
||||
UpdatePlayerRotation();
|
||||
UpdateGear();
|
||||
}
|
||||
|
||||
@@ -189,7 +195,7 @@ namespace NBF
|
||||
private bool _isSprinting;
|
||||
private bool _sprintInputPressed;
|
||||
|
||||
private void UpdatePlayerPositionAndRotation()
|
||||
private void UpdatePlayerPosition()
|
||||
{
|
||||
// Move
|
||||
Vector2 movementInput = InputManager.GetMovementInput();
|
||||
@@ -203,7 +209,10 @@ namespace NBF
|
||||
movementDirection.relativeTo(cameraTransform, GetUpVector());
|
||||
|
||||
SetMovementDirection(movementDirection);
|
||||
}
|
||||
|
||||
private void UpdatePlayerRotation()
|
||||
{
|
||||
// Look
|
||||
Vector2 lookInput = InputManager.GetLookInput() * sensitivity;
|
||||
|
||||
|
||||
@@ -50,7 +50,19 @@ namespace NBF
|
||||
{
|
||||
if (string.IsNullOrEmpty(_interactiveData.Use1)) return;
|
||||
Debug.Log(_interactiveData.Use1);
|
||||
UI.Inst.OpenUI<FishingShopPanel>();
|
||||
|
||||
if (_interactiveObject.Type == UIDef.InteractiveType.Boat)
|
||||
{
|
||||
//上船
|
||||
Debug.Log("上船===");
|
||||
var boat = _interactiveObject.gameObject.GetComponent<Boat>();
|
||||
Fishing.Inst.Player.SelfPlayer.EnterBoat(boat);
|
||||
// Fishing.Inst.Player
|
||||
}
|
||||
else if (_interactiveObject.Type == UIDef.InteractiveType.FishingShop)
|
||||
{
|
||||
UI.Inst.OpenUI<FishingShopPanel>();
|
||||
}
|
||||
}
|
||||
|
||||
public void Use2()
|
||||
|
||||
@@ -9,35 +9,35 @@ EditorUserSettings:
|
||||
value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b07a68ffab74f9ee2a3a30300cea1a11320d0beb1a0c25f7060f494b4cc80018eb09361fc211cb1f862d19c51d19dcc413d6ade0d8ddfcddf9f4d9d29195fcfde6ebeae6f0a9c9afa6f8c5b89ff7a1aacececac4eba4d7c9d28bda
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-0:
|
||||
value: 5305560255545f5f5f5d5d74427306444e154e2f7d2e7e66797b4862b4e3663c
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-1:
|
||||
value: 52530c5601535f020f565a2043770d1612154d2f747975692c7b4e66b5e3303b
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-2:
|
||||
RecentlyUsedSceneGuid-1:
|
||||
value: 0709525704545b5d09590a2346775b46144f402b7e7a72632c7d4860e7e4353e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-3:
|
||||
RecentlyUsedSceneGuid-2:
|
||||
value: 5b520400060d5a5a5b5b557641770b43424f1c28787d25612b2d196ab0b66068
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
RecentlyUsedSceneGuid-3:
|
||||
value: 0657525703505b030b5f5d2141255e4445164c7a7d71716475284f6bb6e33668
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-5:
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 51090c5503010d5d5f0b0e26427a0b444215402f287e7f327b2c1f30e6b8303c
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-6:
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 5553075e5c0d59080f0d597347770f44444f4a7f78787e36782f4967bae43769
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-8:
|
||||
RecentlyUsedSceneGuid-6:
|
||||
value: 5b08565357035d0c0f5d0a774277071242154029757170697b784e66e6b33060
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-9:
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 020056535456585e0f0d0a7541210d441215482c2d297f36752c1b65b3b0376e
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-8:
|
||||
value: 0150055704510808545c0a26467506444516197a747874637b7e1860b5b6616c
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-9:
|
||||
value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
flags: 0
|
||||
|
||||
Reference in New Issue
Block a user