using System.Collections.Generic;
using Fantasy;
using Fantasy.Entitas;
using UnityEngine;
namespace NBF
{
public class Player : Entity
{
///
/// 是否本地玩家
///
public bool IsLocalPlayer;
public bool IsLureRod => false;
public bool IsSelf => RoleModel.Instance.Id == Id;
// ========== 物理状态(高频同步) ==========
public Vector3 position;
public Quaternion rotation;
public Vector2 MoveInput;
public float Speed;
public float RotationSpeed;
public bool IsGrounded;
public bool Run;
// ========== 钓鱼相关状态(中频同步) ==========
public float currentReelingSpeed;
public float lineLength;
public float reelSpeed;
public float EyeAngle;
///
/// 标志量
///
public long TagValue;
// ========== 状态机 ==========
private PlayerState _previousPlayerState = PlayerState.Idle;
private PlayerState _playerState;
public PlayerState PreviousState => _previousPlayerState;
///
/// 当前状态的进入参数(本地和远程都适用)
///
public StateEnterParams CurrentStateParams { get; private set; } = new StateEnterParams();
public PlayerState State
{
get => _playerState;
set
{
if (_playerState != value)
{
_previousPlayerState = _playerState;
_playerState = value;
}
}
}
///
/// 玩家的物品
///
public Dictionary Items = new Dictionary();
///
/// 当前手持物品id
///
public long HandItemId;
///
/// 当前手持物品
///
public PlayerItem HandItem => Items[HandItemId];
public void InitPlayer(MapUnitInfo unitInfo)
{
AddComponent();
if (unitInfo.Id == RoleModel.Instance.Id)
{
//自己
AddComponent();
}
}
public void UnUseItem()
{
}
public void UseItem(ItemInfo item)
{
}
}
}