提交动画相关内容个、
This commit is contained in:
@@ -73,15 +73,19 @@ namespace NBF
|
||||
|
||||
public IEnumerator UseItem(ItemInfo item)
|
||||
{
|
||||
if (Data.ChangeItem) yield break;
|
||||
Data.ChangeItem = true;
|
||||
var itemType = item?.ConfigId.GetItemType();
|
||||
if (itemType == ItemType.Rod)
|
||||
{
|
||||
//判断旧的是否要收回
|
||||
if (Rod != null)
|
||||
yield return UnUseItemConfirm();
|
||||
|
||||
Data.IsLureRod = true;
|
||||
var rodType = (ItemSubType)item.Config.Type;
|
||||
if (rodType == ItemSubType.RodTele)
|
||||
{
|
||||
yield return Rod.Destroy();
|
||||
Tackles.Remove(Rod);
|
||||
Rod = null;
|
||||
Data.IsLureRod = false;
|
||||
}
|
||||
|
||||
Rod =
|
||||
@@ -91,15 +95,25 @@ namespace NBF
|
||||
Tackles.Add(Rod);
|
||||
OnFishingSetEquiped?.Invoke(Rod);
|
||||
}
|
||||
|
||||
Data.ChangeItem = false;
|
||||
}
|
||||
|
||||
public IEnumerator UnUseItem()
|
||||
{
|
||||
OnFishingSetUnequip?.Invoke();
|
||||
if (Data.ChangeItem) yield break;
|
||||
Data.ChangeItem = true;
|
||||
yield return UnUseItemConfirm();
|
||||
Data.ChangeItem = false;
|
||||
}
|
||||
|
||||
private IEnumerator UnUseItemConfirm()
|
||||
{
|
||||
if (Rod != null)
|
||||
{
|
||||
yield return new WaitForSeconds(0.35f);
|
||||
OnFishingSetUnequip?.Invoke();
|
||||
yield return Rod.Destroy();
|
||||
yield return new WaitForSeconds(0.35f);
|
||||
Destroy(Rod.gameObject);
|
||||
Tackles.Remove(Rod);
|
||||
Rod = null;
|
||||
|
||||
@@ -8,10 +8,18 @@ namespace NBF
|
||||
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;
|
||||
|
||||
@@ -25,10 +33,27 @@ namespace NBF
|
||||
{
|
||||
_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace NBF
|
||||
public Animator _Animator;
|
||||
public FPlayer Player { get; private set; }
|
||||
|
||||
private bool _isTorsoLayerEnabled;
|
||||
private bool _isRodLayerEnabled;
|
||||
private bool _isInit;
|
||||
private PlayerIK _IK;
|
||||
private MagicBlending _magicBlending;
|
||||
@@ -45,7 +45,8 @@ namespace NBF
|
||||
public static readonly int PreciseIdle = Animator.StringToHash("Precise Idle");
|
||||
|
||||
|
||||
public static readonly string Torso = "Torso";
|
||||
public static readonly string LureRodLayer = "LureRod";
|
||||
public static readonly string HandRodLayer = "HandRod";
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -73,7 +74,7 @@ namespace NBF
|
||||
|
||||
private void OnFishingSetUnequip()
|
||||
{
|
||||
_isTorsoLayerEnabled = false;
|
||||
_isRodLayerEnabled = false;
|
||||
_IK.SetBipedLeftHandIK(enabled: false, null);
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ namespace NBF
|
||||
{
|
||||
if (item is FRod rod)
|
||||
{
|
||||
_isTorsoLayerEnabled = true;
|
||||
_isRodLayerEnabled = true;
|
||||
// var reel = Player.Rod.Reel;
|
||||
// _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor);
|
||||
}
|
||||
@@ -229,9 +230,19 @@ namespace NBF
|
||||
_Animator.SetBool(OnGround, _IsInVehicle || Player.Data.IsGrounded);
|
||||
_Animator.SetFloat(RodRight, rod.x);
|
||||
_Animator.SetFloat(RodForward, rod.y);
|
||||
float layerWeight = _Animator.GetLayerWeight(_Animator.GetLayerIndex(Torso));
|
||||
SetLayerWeight(Torso,
|
||||
Mathf.MoveTowards(layerWeight, _isTorsoLayerEnabled ? 1f : 0f, Time.deltaTime * 3f));
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user