70 lines
1.5 KiB
C#
70 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using Fantasy;
|
|
using Fantasy.Entitas;
|
|
using NBF.Utils;
|
|
using UnityEngine;
|
|
|
|
namespace NBF
|
|
{
|
|
/// <summary>
|
|
/// 玩家物品
|
|
/// </summary>
|
|
public class PlayerItem : Entity
|
|
{
|
|
public Player Owner;
|
|
|
|
/// <summary>
|
|
/// 配置id
|
|
/// </summary>
|
|
public int ConfigID;
|
|
|
|
public List<int> BindItems = new List<int>();
|
|
|
|
#region Rod专属
|
|
|
|
/// <summary>
|
|
/// 线长度
|
|
/// </summary>
|
|
public float LineLength = 1.5f;
|
|
|
|
/// <summary>
|
|
/// 浮漂线长度
|
|
/// </summary>
|
|
public float FloatLength = 0.5f;
|
|
|
|
private float _tension;
|
|
|
|
/// <summary>
|
|
/// 拉力
|
|
/// </summary>
|
|
public float Tension
|
|
{
|
|
get => _tension;
|
|
private set
|
|
{
|
|
if (!Mathf.Approximately(_tension, value))
|
|
{
|
|
_tension = value;
|
|
// OnTensionChanged?.Invoke(_tension);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
public void Init(Player player, int configId, List<int> bindItems)
|
|
{
|
|
Owner = player;
|
|
ConfigID = configId;
|
|
BindItems.Clear();
|
|
BindItems.AddRange(bindItems);
|
|
// var itemType = bindInfo.Item.GetItemType();
|
|
// if (itemType == ItemType.Rod)
|
|
// {
|
|
// var rod = AddComponent<PlayerItemRod>();
|
|
// rod.Init(bindInfo);
|
|
// }
|
|
}
|
|
}
|
|
} |