船相关脚本呢

This commit is contained in:
2025-05-27 20:27:48 +08:00
parent 7ad9f351c7
commit 8dac46c92a
10 changed files with 60840 additions and 60783 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,11 @@
using UnityEngine;
namespace NBF
{
/// <summary>
/// 玩家船控制
/// </summary>
public class PlayerBoat : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d2b9c0a2b0754a908bc071754c1ed74b
timeCreated: 1748275883

View File

@@ -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;