player
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using NBC;
|
||||
using NBF.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -48,6 +49,11 @@ namespace NBF
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using ECM2;
|
||||
using ECM2.Examples.FirstPerson;
|
||||
using Fantasy;
|
||||
using NBF.Fishing2;
|
||||
using NBF.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -23,6 +26,9 @@ namespace NBF
|
||||
|
||||
public FPlayerData Data { get; private set; }
|
||||
|
||||
public readonly List<FTackle> Tackles = new List<FTackle>();
|
||||
public FTackle HandTackle { get; private set; }
|
||||
|
||||
protected override void OnAwake()
|
||||
{
|
||||
Character = gameObject.GetComponent<CharacterMovement>();
|
||||
@@ -48,7 +54,6 @@ namespace NBF
|
||||
RemoveInputEvent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 角色模型
|
||||
|
||||
@@ -62,5 +67,29 @@ namespace NBF
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 使用物品
|
||||
|
||||
public IEnumerator UseItem(ItemInfo item)
|
||||
{
|
||||
var itemType = item?.ConfigId.GetItemType();
|
||||
if (itemType == ItemType.Rod)
|
||||
{
|
||||
if (HandTackle)
|
||||
{
|
||||
yield return HandTackle.Remove();
|
||||
Tackles.Remove(HandTackle);
|
||||
HandTackle = null;
|
||||
}
|
||||
|
||||
//判断旧的是否要收回
|
||||
var tackle = FTackle.Create(item);
|
||||
HandTackle = tackle;
|
||||
yield return tackle.Show(item);
|
||||
Tackles.Add(tackle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user