using System.Collections.Generic;
using Fantasy;
using Fantasy.Entitas;
using NBF.Utils;
using UnityEngine;
namespace NBF
{
///
/// 玩家物品
///
public class PlayerItem : Entity
{
public Player Owner;
///
/// 配置id
///
public int ConfigID;
public List BindItems = new List();
#region Rod专属
private bool _stretchRope = true;
public bool StretchRope
{
get => _stretchRope;
set
{
_stretchRope = value;
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
{
Item = this
});
}
}
private float _lineLength = 4.2f;
///
/// 线长度
///
public float LineLength
{
get => _lineLength;
set
{
_lineLength = value;
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
{
Item = this
});
}
}
private float _floatLength = 0.7f;
///
/// 浮漂线长度
///
public float FloatLength
{
get => _floatLength;
set
{
_floatLength = value;
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
{
Item = this
});
}
}
private float _tension;
///
/// 拉力
///
public float Tension
{
get => _tension;
set
{
if (!Mathf.Approximately(_tension, value))
{
_tension = value;
}
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
{
Item = this
});
}
}
#endregion
public void Init(Player player, int configId, List bindItems)
{
Owner = player;
ConfigID = configId;
BindItems.Clear();
BindItems.AddRange(bindItems);
// var itemType = bindInfo.Item.GetItemType();
// if (itemType == ItemType.Rod)
// {
// var rod = AddComponent();
// rod.Init(bindInfo);
// }
}
}
}