注释脚本
This commit is contained in:
115
Assets/Scripts/Fishing~/New/Data/Item/PlayerItem.cs
Normal file
115
Assets/Scripts/Fishing~/New/Data/Item/PlayerItem.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
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专属
|
||||
|
||||
private bool _stretchRope = true;
|
||||
|
||||
public bool StretchRope
|
||||
{
|
||||
get => _stretchRope;
|
||||
set
|
||||
{
|
||||
_stretchRope = value;
|
||||
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
|
||||
{
|
||||
Item = this
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private float _lineLength = 4.2f;
|
||||
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
public float LineLength
|
||||
{
|
||||
get => _lineLength;
|
||||
set
|
||||
{
|
||||
_lineLength = value;
|
||||
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
|
||||
{
|
||||
Item = this
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private float _floatLength = 0.7f;
|
||||
|
||||
/// <summary>
|
||||
/// 浮漂线长度
|
||||
/// </summary>
|
||||
public float FloatLength
|
||||
{
|
||||
get => _floatLength;
|
||||
set
|
||||
{
|
||||
_floatLength = value;
|
||||
Scene.EventComponent.Publish(new PlayerItemRodLingChangeEvent
|
||||
{
|
||||
Item = this
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private float _tension;
|
||||
|
||||
/// <summary>
|
||||
/// 拉力
|
||||
/// </summary>
|
||||
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<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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user