修改提交
This commit is contained in:
97
Assets/Scripts/Fishing/New/Data/Player.cs
Normal file
97
Assets/Scripts/Fishing/New/Data/Player.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Entitas;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class Player : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否本地玩家
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// 标志量
|
||||
/// </summary>
|
||||
public long TagValue;
|
||||
|
||||
|
||||
// ========== 状态机 ==========
|
||||
private PlayerState _previousPlayerState = PlayerState.Idle;
|
||||
private PlayerState _playerState;
|
||||
public PlayerState PreviousState => _previousPlayerState;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态的进入参数(本地和远程都适用)
|
||||
/// </summary>
|
||||
public StateEnterParams CurrentStateParams { get; private set; } = new StateEnterParams();
|
||||
|
||||
public PlayerState State
|
||||
{
|
||||
get => _playerState;
|
||||
set
|
||||
{
|
||||
if (_playerState != value)
|
||||
{
|
||||
_previousPlayerState = _playerState;
|
||||
_playerState = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 玩家的物品
|
||||
/// </summary>
|
||||
public Dictionary<long, PlayerItem> Items = new Dictionary<long, PlayerItem>();
|
||||
|
||||
/// <summary>
|
||||
/// 当前手持物品id
|
||||
/// </summary>
|
||||
public long HandItemId;
|
||||
|
||||
/// <summary>
|
||||
/// 当前手持物品
|
||||
/// </summary>
|
||||
public PlayerItem HandItem => Items[HandItemId];
|
||||
|
||||
public void InitPlayer(MapUnitInfo unitInfo)
|
||||
{
|
||||
AddComponent<PlayerViewComponent>();
|
||||
if (unitInfo.Id == RoleModel.Instance.Id)
|
||||
{
|
||||
//自己
|
||||
AddComponent<PlayerInputComponent>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UnUseItem()
|
||||
{
|
||||
}
|
||||
|
||||
public void UseItem(ItemInfo item)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user