修改提交

This commit is contained in:
Bob.Song
2026-03-09 17:50:20 +08:00
parent 68beeb3417
commit 27b85fd875
228 changed files with 30829 additions and 1509 deletions

View File

@@ -1,93 +0,0 @@
using NBC;
using NBF.Utils;
using UnityEngine;
using UnityEngine.InputSystem;
namespace NBF
{
public partial class FPlayer
{
#region Input
private void AddInputEvent()
{
InputManager.OnPlayerPerformed += OnPlayerCanceled;
InputManager.OnPlayerPerformed += OnPlayerPerformed;
InputManager.OnPlayerValueCanceled += OnPlayerValueCanceled;
InputManager.OnPlayerValuePerformed += OnPlayerValuePerformed;
}
private void RemoveInputEvent()
{
InputManager.OnPlayerPerformed += OnPlayerCanceled;
InputManager.OnPlayerPerformed += OnPlayerPerformed;
InputManager.OnPlayerValueCanceled += OnPlayerValueCanceled;
InputManager.OnPlayerValuePerformed += OnPlayerValuePerformed;
}
private void OnPlayerPerformed(string action)
{
if (action == InputDef.Player.Run)
{
Data.Run = true;
}
}
private void OnPlayerCanceled(string action)
{
if (action == InputDef.Player.Run)
{
Data.Run = false;
}
else if (action == InputDef.Player.ToBag)
{
//取消手持物品
Log.Info($"取消手持物品");
Game.Instance.StartCoroutine(UnUseItem());
}
else if (action.StartsWith(InputDef.Player.QuickStarts))
{
var index = int.Parse(action.Replace(InputDef.Player.QuickStarts, string.Empty));
Log.Info($"快速使用===={index}");
var item = RoleModel.Instance.GetSlotItem(index - 1);
if (item != null)
{
Game.Instance.StartCoroutine(UseItem(item));
}
}
}
private void OnPlayerValueCanceled(InputAction.CallbackContext context)
{
var actionName = context.action.name;
if (actionName == InputDef.Player.Move)
{
// var v2 = context.ReadValue<Vector2>();
Data.MoveInput = Vector2.zero;
// SendMoveMessage(v2, true);
}
}
private void OnPlayerValuePerformed(InputAction.CallbackContext context)
{
// var mapUnit = Parent as MapUnit;
// Log.Info($"OnPlayerValuePerformed IsSelf={mapUnit.IsSelf()} id={mapUnit.Id}");
var actionName = context.action.name;
if (actionName == InputDef.Player.Move)
{
var v2 = context.ReadValue<Vector2>();
Data.MoveInput = v2;
// SendMoveMessage(v2, false);
}
else if (actionName == InputDef.Player.Look)
{
var v2 = context.ReadValue<Vector2>();
// UpdatePlayerRotation(v2);
}
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ea2c2e2d4b4344f0bc9d58ba0aeec6fd
timeCreated: 1766505279

View File

@@ -1,146 +0,0 @@
using UnityEngine;
namespace NBF
{
public partial class FPlayer
{
#region Move
private Quaternion lastRotation;
private void UpdateMove()
{
UpdateGrounded();
UpdateWater();
ProcessMoveStates();
UpdateLookInput();
}
private void UpdateGrounded()
{
Data.IsGrounded = FirstPerson.IsGrounded();
Data.Speed = FirstPerson.velocity.magnitude;
Quaternion rotation = FirstPerson.transform.rotation;
// 计算当前帧与上一帧的旋转差异
Quaternion rotationDelta = rotation * Quaternion.Inverse(lastRotation);
// 将四元数转换为角度轴表示
rotationDelta.ToAngleAxis(out float angle, out Vector3 axis);
// 确保角度在0-360范围内
if (angle > 180f) angle -= 360f;
// 获取Y轴旋转分量归一化处理
float yRotation = 0f;
if (Mathf.Abs(angle) > 0.001f && Mathf.Abs(axis.y) > 0.1f)
{
// 计算Y轴方向的旋转角度考虑旋转轴方向
yRotation = angle * Mathf.Sign(axis.y);
}
float maxTurnSpeed = 180f; // 度/秒
// 转换为角速度并归一化到[-1, 1]
float angularSpeed = yRotation / Time.deltaTime;
float turnValue = Mathf.Clamp(angularSpeed / maxTurnSpeed, -1f, 1f);
Data.RotationSpeed = turnValue;
lastRotation = rotation;
}
private void UpdateWater()
{
// SceneSettings.Instance.Water.w
}
private void ProcessMoveStates()
{
// if (CameraView.Value == CameraViewType.TPP)
// {
// float num = (IsRunPressed.Value ? MovementSpeed.Value : (MovementSpeed.Value * 0.5f));
// num = (IsFlyModeEnabled ? (num * (float)FlySpeed) : num);
// Vector3 zero = Vector3.zero;
// zero += Vector3.right * MovementDirection.Value.x;
// zero += Vector3.forward * MovementDirection.Value.y;
// zero = zero.relativeTo(_CameraTPPTarget, _Character.GetUpVector());
// _Character.RotateTowards(zero, Time.deltaTime * _RotateTPPSpeed);
// float value = Vector3.Dot(_Character.GetForwardVector(), zero);
// Vector3 vector = _Character.GetForwardVector() * Mathf.Clamp01(value) * num;
// if (checkWaterBound)
// {
// SetMovementDirectionWithRaycastCheck(vector);
// }
// else
// {
// _Character.SetMovementDirection(vector);
// }
// }
// else
{
var num2 = Data.Run ? 7 : 5;
//(IsRunPressed.Value ? MovementSpeed.Value : (MovementSpeed.Value * 0.5f));
// num2 = (IsFlyModeEnabled ? (num2 * (float)FlySpeed) : num2);
Vector3 vector2 = FirstPerson.GetRightVector() * Data.MoveInput.x * num2;
vector2 += FirstPerson.GetForwardVector() * Data.MoveInput.y * num2;
// if (checkWaterBound)
// {
// SetMovementDirectionWithRaycastCheck(vector2);
// }
// else
{
FirstPerson.SetMovementDirection(vector2);
}
}
}
#endregion
#region Look
public float MouseSensitivity = 0.1f;
[Space(15f)] public bool invertLook = true;
public float minPitch = -60f;
public float maxPitch = 60f;
private void UpdateLookInput()
{
// TPPLookTarget.position = base.transform.position;
// if (CameraView.Value == CameraViewType.TPP)
// {
// lookXRot -= MouseInput.Value.y;
// lookXRot = Mathf.Clamp(lookXRot, -25f, 55f);
// lookYRot += MouseInput.Value.x;
// lookYRot = Mathf.Repeat(lookYRot, 360f);
// TPPLookTarget.localEulerAngles = new Vector3(lookXRot, lookYRot, 0f);
// }
// else if (CameraView.Value == CameraViewType.FPP)
{
// if (_IsInVehicle && PlayerState.Value == State.vehicle)
// {
// lookXRot -= MouseInput.Value.y;
// lookXRot = Mathf.Clamp(lookXRot, VehicleLookXMinMax.x, VehicleLookXMinMax.y);
// lookYRot += MouseInput.Value.x;
// lookYRot = Mathf.Clamp(lookYRot, VehicleLookYMinMax.x, VehicleLookYMinMax.y);
// VehicleLookTargetParent.localEulerAngles = new Vector3(lookXRot, lookYRot, 0f);
// _character.CameraPitch = 0f;
// }
// else
{
Vector2 value = InputManager.GetLookInput();
FirstPerson.AddControlYawInput(value.x * (float)MouseSensitivity);
FirstPerson.AddControlPitchInput((invertLook ? (0f - value.y) : value.y) * (float)MouseSensitivity,
minPitch, maxPitch);
// lookXRot = base.transform.eulerAngles.x;
// lookYRot = base.transform.eulerAngles.y;
}
}
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ae72860c045147af8022a3cbb30481ab
timeCreated: 1766471468

View File

@@ -1,165 +1,142 @@
using System;
using System.Collections;
using System.Collections.Generic;
using ECM2;
using ECM2.Examples.FirstPerson;
using Fantasy;
using NBC;
using NBF.Fishing2;
using NBF.Utils;
using UnityEngine;
using UnityEngine.InputSystem;
using Object = UnityEngine.Object;
namespace NBF
{
public partial class FPlayer : MonoService<FPlayer>
{
public Transform Root;
public Transform Eye;
public Transform FppLook;
public Transform IK;
public PlayerModelAsset ModelAsset;
public CharacterMovement Character;
public FirstPersonCharacter FirstPerson;
public GameObject ModelGameObject { get; set; }
public FPlayerData Data { get; private set; }
public readonly List<FRod> Tackles = new List<FRod>();
public FRod Rod { get; private set; }
public Fsm<FPlayer> Fsm { get; private set; }
public event Action<FHandItem> OnFishingSetEquiped;
public event Action OnFishingSetUnequip;
protected override void OnAwake()
{
Character = gameObject.GetComponent<CharacterMovement>();
FirstPerson = gameObject.GetComponent<FirstPersonCharacter>();
Data = FPlayerData.Instance;
transform.localPosition = new Vector3(484, 1, 422);
// Data.NeedChangeRightArmAngle = true;
}
private void Start()
{
InitFsm();
AddInputEvent();
CreatePlayerModel();
}
private void Update()
{
}
private void LateUpdate()
{
UpdateMove();
Fsm?.Update();
Data.EyeAngle = GameUtils.GetVerticalAngle(transform, FppLook);
}
private void OnDestroy()
{
RemoveInputEvent();
}
#region
private void InitFsm()
{
Fsm = new Fsm<FPlayer>("Player", this, true);
Fsm.RegisterState<PlayerStateIdle>();
Fsm.RegisterState<PlayerStateThrow>();
Fsm.RegisterState<PlayerStateFishing>();
Fsm.RegisterState<PlayerStateFight>();
Fsm.RegisterState<PlayerStatePrepare>();
Fsm.Start<PlayerStateIdle>();
}
#endregion
#region
private void CreatePlayerModel()
{
var modelObject = PrefabsHelper.CreatePlayer(Root, "Human_Male");
modelObject.transform.localPosition = Vector3.zero;
ModelGameObject = modelObject;
ModelAsset = modelObject.GetComponent<PlayerModelAsset>();
ModelAsset.SetPlayer(this);
}
#endregion
#region 使
public IEnumerator UseItem(ItemInfo item)
{
if (Data.ChangeItem) yield break;
Data.ChangeItem = true;
var itemType = item?.ConfigId.GetItemType();
if (itemType == ItemType.Rod)
{
//判断旧的是否要收回
yield return UnUseItemConfirm();
Data.IsLureRod = true;
var rodType = (ItemSubType)item.Config.Type;
if (rodType == ItemSubType.RodTele)
{
Data.IsLureRod = false;
}
Rod =
item.Config.InstantiateAndComponent<FRod>(SceneSettings.Instance.GearNode, Vector3.zero,
Quaternion.identity);
yield return Rod.InitRod(this, item);
Tackles.Add(Rod);
OnFishingSetEquiped?.Invoke(Rod);
}
Data.ChangeItem = false;
}
public IEnumerator UnUseItem()
{
if (Data.ChangeItem) yield break;
Data.ChangeItem = true;
yield return UnUseItemConfirm();
Data.ChangeItem = false;
}
private IEnumerator UnUseItemConfirm()
{
if (Rod != null)
{
OnFishingSetUnequip?.Invoke();
yield return Rod.Destroy();
yield return new WaitForSeconds(0.35f);
Destroy(Rod.gameObject);
Tackles.Remove(Rod);
Rod = null;
yield return new WaitForSeconds(0.15f);
}
}
#endregion
/// <summary>
/// 线断了
/// </summary>
/// <param name="msg"></param>
/// <param name="loseBaitChance"></param>
public void LineBreak(string msg, float loseBaitChance)
{
}
}
}
// using System;
// using System.Collections;
// using System.Collections.Generic;
// using ECM2;
// using ECM2.Examples.FirstPerson;
// using Fantasy;
// using NBC;
// using NBF.Fishing2;
// using NBF.Utils;
// using UnityEngine;
// using UnityEngine.InputSystem;
// using Object = UnityEngine.Object;
//
// namespace NBF
// {
// public partial class FPlayer : MonoService<FPlayer>
// {
// public Transform Root;
// public Transform Eye;
// public Transform FppLook;
// public Transform IK;
// public PlayerModelAsset ModelAsset;
// public CharacterMovement Character;
// public FirstPersonCharacter FirstPerson;
// public GameObject ModelGameObject { get; set; }
//
//
// // public FPlayerData Data { get; private set; }
//
// public readonly List<FRod> Tackles = new List<FRod>();
// public FRod Rod { get; private set; }
// public Fsm<FPlayer> Fsm { get; private set; }
//
// public event Action<FHandItem> OnFishingSetEquiped;
// public event Action OnFishingSetUnequip;
//
// protected override void OnAwake()
// {
// Character = gameObject.GetComponent<CharacterMovement>();
// FirstPerson = gameObject.GetComponent<FirstPersonCharacter>();
// // Data = PlayerDataManager.Instance.Self;
// transform.localPosition = new Vector3(484, 1, 422);
// // Data.NeedChangeRightArmAngle = true;
// }
//
// private void Start()
// {
// InitFsm();
// CreatePlayerModel();
// }
//
//
// private void LateUpdate()
// {
// Fsm?.Update();
// }
//
// #region 状态机
//
// private void InitFsm()
// {
// Fsm = new Fsm<FPlayer>("Player", this, true);
// Fsm.RegisterState<PlayerStateIdle>();
// Fsm.RegisterState<PlayerStateThrow>();
// Fsm.RegisterState<PlayerStateFishing>();
// Fsm.RegisterState<PlayerStateFight>();
// Fsm.RegisterState<PlayerStatePrepare>();
// Fsm.Start<PlayerStateIdle>();
// }
//
// #endregion
//
// #region 角色模型
//
// private void CreatePlayerModel()
// {
// var modelObject = PrefabsHelper.CreatePlayer(Root, "Human_Male");
// modelObject.transform.localPosition = Vector3.zero;
// ModelGameObject = modelObject;
// ModelAsset = modelObject.GetComponent<PlayerModelAsset>();
// ModelAsset.SetPlayer(this);
// }
//
// #endregion
//
// #region 使用物品
//
// public IEnumerator UseItem(ItemInfo item)
// {
// // if (Data.ChangeItem) yield break;
// // Data.ChangeItem = true;
// // var itemType = item?.ConfigId.GetItemType();
// // if (itemType == ItemType.Rod)
// // {
// // //判断旧的是否要收回
// // yield return UnUseItemConfirm();
// //
// // Data.IsLureRod = true;
// // var rodType = (ItemSubType)item.Config.Type;
// // if (rodType == ItemSubType.RodTele)
// // {
// // Data.IsLureRod = false;
// // }
// //
// // Rod =
// // item.Config.InstantiateAndComponent<FRod>(SceneSettings.Instance.GearNode, Vector3.zero,
// // Quaternion.identity);
// // yield return Rod.InitRod(this, item);
// // Tackles.Add(Rod);
// // OnFishingSetEquiped?.Invoke(Rod);
// // }
// //
// // Data.ChangeItem = false;
// yield return null;
// }
//
// public IEnumerator UnUseItem()
// {
// // if (Data.ChangeItem) yield break;
// // Data.ChangeItem = true;
// // yield return UnUseItemConfirm();
// // Data.ChangeItem = false;
// yield return null;
// }
//
// private IEnumerator UnUseItemConfirm()
// {
// if (Rod != null)
// {
// OnFishingSetUnequip?.Invoke();
// yield return Rod.Destroy();
// yield return new WaitForSeconds(0.35f);
// Destroy(Rod.gameObject);
// Tackles.Remove(Rod);
// Rod = null;
// yield return new WaitForSeconds(0.15f);
// }
// }
//
// #endregion
// }
// }

View File

@@ -1,87 +0,0 @@
// using System;
// using UnityEngine;
//
// namespace NBF
// {
// // [Serializable]
// // public enum PlayerState
// // {
// // idle = 0,
// // move = 1,
// // prepare = 2,
// // casting = 3,
// // fishing = 4,
// // baitFlies = 5,
// // fight = 6,
// // fishView = 7,
// // collectFish = 8,
// // throwFish = 9,
// // vehicle = 10,
// // swiming = 11,
// // flyModeDebug = 12,
// // vehicleFishing = 13,
// // preciseCastIdle = 14,
// // preciseCastThrow = 15
// // }
//
//
// public class FPlayerData : MonoService<FPlayerData>
// {
// private PlayerState _previousPlayerState = PlayerState.Idle;
// private PlayerState _playerState;
//
// public bool ChangeItem;
// public bool Run;
// public bool IsGrounded;
// public float Speed;
// public float RotationSpeed;
// public float ReelSpeed;
// public float LineTension;
//
// /// <summary>
// /// 是否路亚竿
// /// </summary>
// public bool IsLureRod;
//
// public Vector2 MoveInput;
//
// /// <summary>
// ///
// /// </summary>
// public float EyeAngle;
//
//
// public PlayerState PreviousState => _previousPlayerState;
//
// public PlayerState State
// {
// get => _playerState;
// set
// {
// _previousPlayerState = _playerState;
// _playerState = value;
// NextState = value;
// OnStateChange?.Invoke(_playerState);
// }
// }
//
// [SerializeField] private PlayerState NextState;
//
// public event Action<PlayerState> OnStateChange;
//
//
// private void Start()
// {
// NextState = State;
// }
//
// private void Update()
// {
// if (NextState != State)
// {
// State = NextState;
// }
// }
// }
// }

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 53629a9cec2b4caf9a739c21f7abdf3c
timeCreated: 1766471002

View File

@@ -1,306 +0,0 @@
using System;
using KINEMATION.MagicBlend.Runtime;
using NBC;
using UnityEngine;
namespace NBF
{
public class PlayerAnimator : MonoBehaviour
{
public Animator _Animator;
public FPlayer Player { get; private set; }
private bool _isRodLayerEnabled;
private bool _isInit;
private PlayerIK _IK;
private MagicBlending _magicBlending;
private bool _IsInVehicle;
#region
// public static readonly int IsSwiming = Animator.StringToHash("Swim");
//
// public static readonly int ThrowFar = Animator.StringToHash("ThrowFar");
//
// public static readonly int BoatDriving = Animator.StringToHash("BoatDriving");
//
// public static readonly int BaitInWater = Animator.StringToHash("BaitInWater");
//
// public static readonly int HeldRod = Animator.StringToHash("HeldRod");
//
// public static readonly int RodArming = Animator.StringToHash("RodArming");
public static readonly int Forward = Animator.StringToHash("Forward");
public static readonly int Turn = Animator.StringToHash("Turn");
public static readonly int OnGroundHash = Animator.StringToHash("OnGround");
public static readonly int PrepareThrowHash = Animator.StringToHash("PrepareThrow");
public static readonly int StartThrowHash = Animator.StringToHash("StartThrow");
public static readonly int BaitThrownHash = Animator.StringToHash("BaitThrown");
private static readonly int FishingUpHash = Animator.StringToHash("FishingUp");
public static readonly string LureRodLayer = "LureRod";
public static readonly string HandRodLayer = "HandRod";
public float FishingUp
{
get => _Animator.GetFloat(FishingUpHash);
set => _Animator.SetFloat(FishingUpHash, value);
}
public bool OnGround
{
get => _Animator.GetBool(OnGroundHash);
set => _Animator.SetBool(OnGroundHash, value);
}
public bool StartThrow
{
get => _Animator.GetBool(StartThrowHash);
set => _Animator.SetBool(StartThrowHash, value);
}
public bool BaitThrown
{
get => _Animator.GetBool(BaitThrownHash);
set => _Animator.SetBool(BaitThrownHash, value);
}
public bool PrepareThrow
{
get => _Animator.GetBool(PrepareThrowHash);
set => _Animator.SetBool(PrepareThrowHash, value);
}
#endregion
private void Awake()
{
Player = GetComponentInParent<FPlayer>();
_magicBlending = GetComponent<MagicBlending>();
_Animator = GetComponent<Animator>();
_Animator.keepAnimatorStateOnDisable = true;
_IK = GetComponent<PlayerIK>();
_isInit = true;
Player.OnFishingSetEquiped += OnFishingSetEquiped_OnRaised;
Player.OnFishingSetUnequip += OnFishingSetUnequip;
Player.Data.OnStateChange += PlayerFSMState_OnValueChanged;
}
private void OnDestroy()
{
Player.OnFishingSetEquiped -= OnFishingSetEquiped_OnRaised;
Player.OnFishingSetUnequip -= OnFishingSetUnequip;
Player.Data.OnStateChange += PlayerFSMState_OnValueChanged;
}
private void OnFishingSetUnequip()
{
_isRodLayerEnabled = false;
// _IK.SetBipedLeftHandIK(enabled: false, null);
}
private void OnFishingSetEquiped_OnRaised(FHandItem item)
{
if (item is FRod rod)
{
_isRodLayerEnabled = true;
// var reel = Player.Rod.Reel;
// _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor);
}
else
{
}
}
public void SetLayerWeight(string layer, float weight)
{
_Animator.SetLayerWeight(_Animator.GetLayerIndex(layer), weight);
}
private void PlayerFSMState_OnValueChanged(PlayerState state)
{
// switch (Player.Data.PreviousState)
// {
// case PlayerState.vehicle:
// _IsInVehicle = false;
// _Animator.SetBool(BoatDriving, value: false);
// break;
// case PlayerState.swiming:
// _Animator.SetBool(IsSwiming, value: false);
// break;
// case PlayerState.preciseCastIdle:
// _Animator.SetBool(PreciseIdle, value: false);
// break;
// case PlayerState.prepare:
// _Animator.SetBool(RodArming, value: false);
// break;
// case PlayerState.casting:
// _Animator.SetBool(ThrowFar, value: false);
// break;
// case PlayerState.collectFish:
// _magicBlending.BlendAsset.globalWeight = 0f;
// break;
// }
//
// switch (state)
// {
// switch (Player.Data.PreviousState)
// {
// case PlayerState.vehicle:
// _IsInVehicle = false;
// _Animator.SetBool(BoatDriving, value: false);
// break;
// case PlayerState.swiming:
// _Animator.SetBool(IsSwiming, value: false);
// break;
// case PlayerState.preciseCastIdle:
// _Animator.SetBool(PreciseIdle, value: false);
// break;
// case PlayerState.prepare:
// _Animator.SetBool(RodArming, value: false);
// break;
// case PlayerState.casting:
// _Animator.SetBool(ThrowFar, value: false);
// break;
// case PlayerState.collectFish:
// _magicBlending.BlendAsset.globalWeight = 0f;
// break;
// }
//
// switch (state)
// {
// case PlayerState.idle:
// case PlayerState.move:
// _Animator.SetBool(BaitInWater, value: false);
// _Animator.SetBool(HeldRod, value: false);
// _Animator.SetBool(ThrowFar, value: false);
// _Animator.SetBool(RodArming, value: false);
// break;
// case PlayerState.prepare:
// _Animator.SetBool(RodArming, value: true);
// _Animator.SetBool(HeldRod, value: true);
// break;
// case PlayerState.fishing:
// _Animator.SetBool(HeldRod, value: true);
// _Animator.SetBool(BaitInWater, value: true);
// break;
// case PlayerState.vehicle:
// _Animator.SetBool(BaitInWater, value: false);
// _Animator.SetBool(HeldRod, value: false);
// _Animator.SetBool(ThrowFar, value: false);
// _Animator.SetBool(RodArming, value: false);
// _Animator.SetBool(BoatDriving, value: true);
// _IK.SetBipedLeftHandIK(enabled: true);
// _IsInVehicle = true;
// break;
// case PlayerState.vehicleFishing:
// _Animator.SetBool(BaitInWater, value: false);
// _Animator.SetBool(HeldRod, value: false);
// _Animator.SetBool(ThrowFar, value: false);
// _Animator.SetBool(RodArming, value: false);
// _IsInVehicle = true;
// break;
// case PlayerState.swiming:
// _Animator.SetBool(IsSwiming, value: true);
// break;
// case PlayerState.collectFish:
// _Animator.SetBool(BaitInWater, value: false);
// _IK.SetAimIK(enabled: false);
// _magicBlending.BlendAsset.globalWeight = 1f;
// break;
// case PlayerState.preciseCastIdle:
// _Animator.SetBool(PreciseIdle, value: true);
// break;
// case PlayerState.casting:
// case PlayerState.baitFlies:
// case PlayerState.fight:
// case PlayerState.fishView:
// case PlayerState.throwFish:
// case PlayerState.flyModeDebug:
// break;
// }
}
private void LateUpdate()
{
// if (Player.Data.State == PlayerState.swiming)
// {
// float value = Mathf.Lerp(_Animator.GetFloat(Forward), Player.Data.Speed / 2.5f,
// Time.deltaTime * 5f);
// float value2 = Mathf.Lerp(_Animator.GetFloat(Turn), Player.Data.RotationSpeed, Time.deltaTime * 5f);
// _Animator.SetFloat(Forward, Mathf.Clamp01(value));
// _Animator.SetFloat(Turn, Mathf.Clamp(value2, -1f, 1f));
// }
// else
{
float value3 = Mathf.Lerp(_Animator.GetFloat(Forward), Player.Data.Speed / 5f,
Time.deltaTime * 20f);
float value4 = Mathf.Lerp(_Animator.GetFloat(Turn), Player.Data.RotationSpeed, Time.deltaTime * 15f);
_Animator.SetFloat(Forward, Mathf.Clamp01(value3));
_Animator.SetFloat(Turn, Mathf.Clamp(value4, -1f, 1f));
}
// var rod = Vector3.zero;
// if (Player.Rod)
// {
// rod = Player.Rod.transform.position;
// }
_Animator.SetBool(OnGroundHash, _IsInVehicle || Player.Data.IsGrounded);
var isHandRodLayerEnabled = _isRodLayerEnabled && !Player.Data.IsLureRod ? 1 : 0;
float handRodLayerWeight = _Animator.GetLayerWeight(_Animator.GetLayerIndex(HandRodLayer));
SetLayerWeight(HandRodLayer,
Mathf.MoveTowards(handRodLayerWeight, isHandRodLayerEnabled, Time.deltaTime * 3f));
var isLureRodLayerEnabled = _isRodLayerEnabled && Player.Data.IsLureRod ? 1 : 0;
float lureRodLayerWeight = _Animator.GetLayerWeight(_Animator.GetLayerIndex(LureRodLayer));
SetLayerWeight(LureRodLayer,
Mathf.MoveTowards(lureRodLayerWeight, isLureRodLayerEnabled, Time.deltaTime * 3f));
}
#region
/// <summary>
/// 抬杆到底动画事件
/// </summary>
public void OnRodPowerUp()
{
}
/// <summary>
/// 开始抛出动画事件
/// </summary>
public void OnRodThrowStart()
{
if (Player.Fsm.CurrentState is PlayerStateThrow playerStateThrow)
{
playerStateThrow.OnRodThrowStart();
}
}
/// <summary>
/// 抛竿结束动画事件
/// </summary>
public void OnRodThrownEnd()
{
if (Player.Fsm.CurrentState is PlayerStateThrow playerStateThrow)
{
playerStateThrow.OnRodThrownEnd();
}
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 0fc336a939c4416db623f3b4ae855265
timeCreated: 1766470716

View File

@@ -1,29 +0,0 @@
using System;
using RootMotion.FinalIK;
using UnityEngine;
namespace NBF
{
public class PlayerArm : MonoBehaviour
{
public bool FixLowerArm;
public bool IsLeft;
public LimbIK IK;
public Transform LowerArm;
public Transform RodContainer;
public FingerRig FingerRig;
[HideInInspector] public float interactionTargetWeight;
private const int MaxFixEyeAngle = 15;
public void Awake()
{
}
private void LateUpdate()
{
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 01ef40348d8b4d4da250acf0a921fc2a
timeCreated: 1768660096

View File

@@ -1,25 +0,0 @@
using UnityEngine;
namespace NBF
{
public class PlayerChest : MonoBehaviour
{
private const int MaxFixEyeAngle = 15;
private const int MinFixEyeAngle = -10;
private void LateUpdate()
{
FixArmAngle();
}
private void FixArmAngle()
{
var angle = FPlayerData.Instance.EyeAngle;
if (angle > MaxFixEyeAngle) angle = MaxFixEyeAngle;
else if (angle < MinFixEyeAngle) angle = MinFixEyeAngle;
var val = transform.localEulerAngles;
transform.localEulerAngles = new Vector3(val.x, val.y, val.z - angle);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e152a74e74b54d17ace5403a1570e12a
timeCreated: 1768668096

View File

@@ -1,156 +0,0 @@
using System;
using RootMotion.FinalIK;
using UnityEngine;
namespace NBF
{
public class PlayerIK : MonoBehaviour
{
public enum UpdateType
{
Update = 0,
FixedUpdate = 1,
LateUpdate = 2,
Default = 3
}
public UpdateType UpdateSelected;
// [SerializeField] private Transform _LeftHandTransform;
private LookAtIK _LookAtIK;
// private AimIK _AimIK;
// private FullBodyBipedIK _FullBodyIK;
// private ArmIK _ArmIK;
// private bool _isLeftHandEnabled;
// private bool _isRightHandEnabled;
// public bool isAimEnabled;
private bool _isFishingLeftArmEnabled;
[SerializeField] private float transitionWeightTimeScale = 1f;
// public Transform CurrentTarget => _FullBodyIK.solver.leftHandEffector.target;
// public Transform LeftHandTransform => _LeftHandTransform;
private void Awake()
{
_LookAtIK = GetComponent<LookAtIK>();
// _AimIK = GetComponent<AimIK>();
// _FullBodyIK = GetComponent<FullBodyBipedIK>();
// _ArmIK = GetComponent<ArmIK>();
// SetAimIK(enabled: false);
}
public void SetBipedIK(bool enabled)
{
}
public void SetFishingLeftArm(bool enabled)
{
_isFishingLeftArmEnabled = enabled;
}
// public void SetFishingLeftArm(bool enabled, Transform target)
// {
// _isFishingLeftArmEnabled = enabled;
// _ArmIK.solver.arm.target = target;
// }
// public void SetBipedLeftHandIK(bool enabled, bool instant = false)
// {
// _isLeftHandEnabled = enabled;
// if (instant)
// {
// _FullBodyIK.solver.leftArmMapping.weight = (enabled ? 1f : 0f);
// }
// }
// public void SetBipedRightHandIK(bool enabled, bool instant = false)
// {
// _isRightHandEnabled = enabled;
// if (instant)
// {
// _FullBodyIK.solver.rightArmMapping.weight = (enabled ? 1f : 0f);
// }
// }
// public void SetBipedLeftHandIK(bool enabled, Transform target, bool instant = false)
// {
// _isLeftHandEnabled = enabled;
// _FullBodyIK.solver.leftHandEffector.target = target;
// if (instant)
// {
// _FullBodyIK.solver.leftArmMapping.weight = (enabled ? 1f : 0f);
// }
// }
// public void SetBipedRightHandIK(bool enabled, Transform target, bool instant = false)
// {
// _isRightHandEnabled = enabled;
// _FullBodyIK.solver.rightHandEffector.target = target;
// if (instant)
// {
// _FullBodyIK.solver.rightArmMapping.weight = (enabled ? 1f : 0f);
// }
// }
// public void SetAimIK(bool enabled)
// {
// isAimEnabled = enabled;
// }
private void Update()
{
if (UpdateSelected == UpdateType.Update)
{
IKUpdateHandler();
}
}
private void FixedUpdate()
{
if (UpdateSelected == UpdateType.FixedUpdate)
{
IKUpdateHandler();
}
}
private void LateUpdate()
{
if (UpdateSelected == UpdateType.LateUpdate)
{
IKUpdateHandler();
}
}
private void IKUpdateHandler()
{
// _AimIK.UpdateSolverExternal();
_LookAtIK.UpdateSolverExternal();
// _FullBodyIK.UpdateSolverExternal();
// _FullBodyIK.solver.Update();
// _AimIK.solver.IKPositionWeight = Mathf.MoveTowards(_AimIK.solver.IKPositionWeight, isAimEnabled ? 1f : 0f,
// Time.deltaTime * transitionWeightTimeScale);
// _FullBodyIK.solver.leftArmMapping.weight = Mathf.MoveTowards(_FullBodyIK.solver.leftArmMapping.weight,
// _isLeftHandEnabled ? 1f : 0f, Time.deltaTime * transitionWeightTimeScale);
// _FullBodyIK.solver.rightArmMapping.weight = Mathf.MoveTowards(_FullBodyIK.solver.rightArmMapping.weight,
// _isRightHandEnabled ? 1f : 0f, Time.deltaTime * transitionWeightTimeScale);
// _FullBodyIK.solver.IKPositionWeight = Mathf.MoveTowards(_FullBodyIK.solver.IKPositionWeight,
// _isLeftHandEnabled ? 1f : 0f, Time.deltaTime * transitionWeightTimeScale);
// _ArmIK.solver.IKPositionWeight = Mathf.MoveTowards(_ArmIK.solver.IKPositionWeight,
// _isFishingLeftArmEnabled ? 1f : 0f, Time.deltaTime * transitionWeightTimeScale);
// _ArmIK.solver.IKRotationWeight = Mathf.MoveTowards(_ArmIK.solver.IKRotationWeight,
// _isFishingLeftArmEnabled ? 1f : 0f, Time.deltaTime * transitionWeightTimeScale);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: cb36ecc5b1784d948837600cf18808cd
timeCreated: 1765121426

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a3b57223c7f94237869524280afe1672
timeCreated: 1768138483

View File

@@ -3,9 +3,9 @@ using UnityEngine;
namespace NBF
{
public abstract class PlayerStateBase : FsmBaseState<FPlayer>
public abstract class PlayerStateBase : FsmBaseState<Player>
{
protected FPlayer Player => _owner;
protected Player Player => _owner;
/// <summary>
/// 检查状态超时

View File

@@ -29,25 +29,25 @@ namespace NBF
if (InputManager.IsOp1)
{
if (!Player.Data.IsLureRod)
{
//抬杆
isUpRod = true;
}
else
{
//收线
isSubLine = true;
}
// if (!Player.Data.IsLureRod)
// {
// //抬杆
// isUpRod = true;
// }
// else
// {
// //收线
// isSubLine = true;
// }
}
if (InputManager.IsOp2)
{
if (Player.Data.IsLureRod)
{
//抬杆
isUpRod = true;
}
// if (Player.Data.IsLureRod)
// {
// //抬杆
// isUpRod = true;
// }
}
//Player.ModelAsset.PlayerAnimator.FishingUp = 0;