升级6.4.升级水,升级天气
This commit is contained in:
@@ -1,142 +0,0 @@
|
||||
// using System;
|
||||
// using System.Collections;
|
||||
// using System.Collections.Generic;
|
||||
// using ECM2;
|
||||
// using ECM2.Examples.FirstPerson;
|
||||
// using Fantasy;
|
||||
// using NBC;
|
||||
// using NBF.Fishing2;
|
||||
// using NBF.Utils;
|
||||
// using UnityEngine;
|
||||
// using UnityEngine.InputSystem;
|
||||
// using Object = UnityEngine.Object;
|
||||
//
|
||||
// namespace NBF
|
||||
// {
|
||||
// public partial class FPlayer : MonoService<FPlayer>
|
||||
// {
|
||||
// public Transform Root;
|
||||
// public Transform Eye;
|
||||
// public Transform FppLook;
|
||||
// public Transform IK;
|
||||
// public PlayerModelAsset ModelAsset;
|
||||
// public CharacterMovement Character;
|
||||
// public FirstPersonCharacter FirstPerson;
|
||||
// public GameObject ModelGameObject { get; set; }
|
||||
//
|
||||
//
|
||||
// // public FPlayerData Data { get; private set; }
|
||||
//
|
||||
// public readonly List<FRod> Tackles = new List<FRod>();
|
||||
// public FRod Rod { get; private set; }
|
||||
// public Fsm<FPlayer> Fsm { get; private set; }
|
||||
//
|
||||
// public event Action<FHandItem> OnFishingSetEquiped;
|
||||
// public event Action OnFishingSetUnequip;
|
||||
//
|
||||
// protected override void OnAwake()
|
||||
// {
|
||||
// Character = gameObject.GetComponent<CharacterMovement>();
|
||||
// FirstPerson = gameObject.GetComponent<FirstPersonCharacter>();
|
||||
// // Data = PlayerDataManager.Instance.Self;
|
||||
// transform.localPosition = new Vector3(484, 1, 422);
|
||||
// // Data.NeedChangeRightArmAngle = true;
|
||||
// }
|
||||
//
|
||||
// private void Start()
|
||||
// {
|
||||
// InitFsm();
|
||||
// CreatePlayerModel();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private void LateUpdate()
|
||||
// {
|
||||
// Fsm?.Update();
|
||||
// }
|
||||
//
|
||||
// #region 状态机
|
||||
//
|
||||
// private void InitFsm()
|
||||
// {
|
||||
// Fsm = new Fsm<FPlayer>("Player", this, true);
|
||||
// Fsm.RegisterState<PlayerStateIdle>();
|
||||
// Fsm.RegisterState<PlayerStateThrow>();
|
||||
// Fsm.RegisterState<PlayerStateFishing>();
|
||||
// Fsm.RegisterState<PlayerStateFight>();
|
||||
// Fsm.RegisterState<PlayerStatePrepare>();
|
||||
// Fsm.Start<PlayerStateIdle>();
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region 角色模型
|
||||
//
|
||||
// private void CreatePlayerModel()
|
||||
// {
|
||||
// var modelObject = PrefabsHelper.CreatePlayer(Root, "Human_Male");
|
||||
// modelObject.transform.localPosition = Vector3.zero;
|
||||
// ModelGameObject = modelObject;
|
||||
// ModelAsset = modelObject.GetComponent<PlayerModelAsset>();
|
||||
// ModelAsset.SetPlayer(this);
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region 使用物品
|
||||
//
|
||||
// public IEnumerator UseItem(ItemInfo item)
|
||||
// {
|
||||
// // if (Data.ChangeItem) yield break;
|
||||
// // Data.ChangeItem = true;
|
||||
// // var itemType = item?.ConfigId.GetItemType();
|
||||
// // if (itemType == ItemType.Rod)
|
||||
// // {
|
||||
// // //判断旧的是否要收回
|
||||
// // yield return UnUseItemConfirm();
|
||||
// //
|
||||
// // Data.IsLureRod = true;
|
||||
// // var rodType = (ItemSubType)item.Config.Type;
|
||||
// // if (rodType == ItemSubType.RodTele)
|
||||
// // {
|
||||
// // Data.IsLureRod = false;
|
||||
// // }
|
||||
// //
|
||||
// // Rod =
|
||||
// // item.Config.InstantiateAndComponent<FRod>(SceneSettings.Instance.GearNode, Vector3.zero,
|
||||
// // Quaternion.identity);
|
||||
// // yield return Rod.InitRod(this, item);
|
||||
// // Tackles.Add(Rod);
|
||||
// // OnFishingSetEquiped?.Invoke(Rod);
|
||||
// // }
|
||||
// //
|
||||
// // Data.ChangeItem = false;
|
||||
// yield return null;
|
||||
// }
|
||||
//
|
||||
// public IEnumerator UnUseItem()
|
||||
// {
|
||||
// // if (Data.ChangeItem) yield break;
|
||||
// // Data.ChangeItem = true;
|
||||
// // yield return UnUseItemConfirm();
|
||||
// // Data.ChangeItem = false;
|
||||
// yield return null;
|
||||
// }
|
||||
//
|
||||
// private IEnumerator UnUseItemConfirm()
|
||||
// {
|
||||
// if (Rod != null)
|
||||
// {
|
||||
// OnFishingSetUnequip?.Invoke();
|
||||
// yield return Rod.Destroy();
|
||||
// yield return new WaitForSeconds(0.35f);
|
||||
// Destroy(Rod.gameObject);
|
||||
// Tackles.Remove(Rod);
|
||||
// Rod = null;
|
||||
// yield return new WaitForSeconds(0.15f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
// }
|
||||
// }
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 625346c970c542bab9f3a36f78720a77
|
||||
timeCreated: 1766419452
|
||||
@@ -1,21 +0,0 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public abstract class PlayerStateBase : FsmBaseState<Player>
|
||||
{
|
||||
protected Player Player => _owner;
|
||||
|
||||
/// <summary>
|
||||
/// 检查状态超时
|
||||
/// </summary>
|
||||
public void CheckStateTimeout(float time)
|
||||
{
|
||||
if (Time.time - EnterTime >= time)
|
||||
{
|
||||
Root.Start<PlayerStateIdle>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 080f1176c3ac4eefa37f615b22cac7ed
|
||||
timeCreated: 1768138530
|
||||
@@ -1,20 +0,0 @@
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerStateFight : PlayerStateBase
|
||||
{
|
||||
public override uint StateId => (uint)PlayerState.Fight;
|
||||
|
||||
protected override void onEnter()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void onExit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override uint onUpdate()
|
||||
{
|
||||
return States.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0720dd0d400641bea639e36f169aafde
|
||||
timeCreated: 1768138922
|
||||
@@ -1,102 +0,0 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 钓鱼中
|
||||
/// </summary>
|
||||
public class PlayerStateFishing : PlayerStateBase
|
||||
{
|
||||
public override uint StateId => (uint)PlayerState.Fishing;
|
||||
|
||||
protected override void onEnter()
|
||||
{
|
||||
Debug.LogError("enter PlayerStateFishing");
|
||||
_owner.ModelAsset.PlayerAnimator.BaitThrown = true;
|
||||
}
|
||||
|
||||
protected override void onExit()
|
||||
{
|
||||
_owner.ModelAsset.PlayerAnimator.BaitThrown = false;
|
||||
}
|
||||
|
||||
protected override uint onUpdate()
|
||||
{
|
||||
var ret = States.None;
|
||||
var isUpRod = false;
|
||||
var isSubLine = false;
|
||||
|
||||
if (InputManager.IsOp1)
|
||||
{
|
||||
// if (!Player.Data.IsLureRod)
|
||||
// {
|
||||
// //抬杆
|
||||
// isUpRod = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //收线
|
||||
// isSubLine = true;
|
||||
// }
|
||||
}
|
||||
|
||||
if (InputManager.IsOp2)
|
||||
{
|
||||
// if (Player.Data.IsLureRod)
|
||||
// {
|
||||
// //抬杆
|
||||
// isUpRod = true;
|
||||
// }
|
||||
}
|
||||
|
||||
//Player.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
|
||||
if (isUpRod || Player.ModelAsset.PlayerAnimator.FishingUp > 0)
|
||||
{
|
||||
var upForce = 1;
|
||||
var addNum = upForce * Time.deltaTime;
|
||||
if (!isUpRod)
|
||||
{
|
||||
addNum *= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
addNum *= 0.5f;
|
||||
}
|
||||
|
||||
// Debug.Log($"addNum={addNum}");
|
||||
Player.ModelAsset.PlayerAnimator.FishingUp += addNum;
|
||||
// Debug.LogError($"ishingFinal={Player.ModelAsset.PlayerAnimator.FishingUp}");
|
||||
if (Player.ModelAsset.PlayerAnimator.FishingUp >= 1)
|
||||
{
|
||||
Player.ModelAsset.PlayerAnimator.FishingUp = 1;
|
||||
}
|
||||
else if (Player.ModelAsset.PlayerAnimator.FishingUp < 0)
|
||||
{
|
||||
Player.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
}
|
||||
|
||||
if (Player.ModelAsset.PlayerAnimator.FishingUp >= 0.8f)
|
||||
{
|
||||
ret = CheckTackFish();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#region 检查上鱼或者返回待机
|
||||
|
||||
private uint CheckTackFish()
|
||||
{
|
||||
return (uint)PlayerState.Idle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6953fd92b2c54c6e846a0363520a9010
|
||||
timeCreated: 1768138900
|
||||
@@ -1,44 +0,0 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 闲置中
|
||||
/// </summary>
|
||||
public class PlayerStateIdle : PlayerStateBase
|
||||
{
|
||||
public override uint StateId => (uint)PlayerState.Idle;
|
||||
private bool _nextState = false;
|
||||
|
||||
protected override void onEnter()
|
||||
{
|
||||
Log.Info("enter PlayerStateIdle");
|
||||
_nextState = false;
|
||||
InputManager.OnOp1Action += OnOp1Action;
|
||||
}
|
||||
|
||||
private void OnOp1Action(bool performed)
|
||||
{
|
||||
if (!Player.Rod) return;
|
||||
if (performed)
|
||||
{
|
||||
_nextState = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void onExit()
|
||||
{
|
||||
InputManager.OnOp1Action -= OnOp1Action;
|
||||
}
|
||||
|
||||
protected override uint onUpdate()
|
||||
{
|
||||
if (_nextState)
|
||||
{
|
||||
return (uint)PlayerState.Prepare;
|
||||
}
|
||||
|
||||
return States.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6146dcfbaf54972ac75c8115041ed3e
|
||||
timeCreated: 1768138510
|
||||
@@ -1,76 +0,0 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 准备抛竿中
|
||||
/// </summary>
|
||||
public class PlayerStatePrepare : PlayerStateBase
|
||||
{
|
||||
public override uint StateId => (uint)PlayerState.Prepare;
|
||||
|
||||
public enum Phase
|
||||
{
|
||||
/// <summary>
|
||||
/// 蓄力
|
||||
/// </summary>
|
||||
Charged,
|
||||
|
||||
/// <summary>
|
||||
/// 确认蓄力结果
|
||||
/// </summary>
|
||||
Confirm,
|
||||
}
|
||||
|
||||
public Phase Stage = Phase.Charged;
|
||||
public float ChargedProgress;
|
||||
|
||||
protected override void onEnter()
|
||||
{
|
||||
Log.Info("enter PlayerStatePrepare");
|
||||
Stage = Phase.Charged;
|
||||
Player.ModelAsset.PlayerAnimator.PrepareThrow = true;
|
||||
Player.ModelAsset.PlayerAnimator.FishingUp = 0;
|
||||
}
|
||||
|
||||
protected override uint onUpdate()
|
||||
{
|
||||
if (Stage == Phase.Charged)
|
||||
{
|
||||
ThrowPowerCharged();
|
||||
}
|
||||
else if (Stage == Phase.Confirm)
|
||||
{
|
||||
//确认蓄力结果,
|
||||
Debug.Log($"确认蓄力结果,ChargedProgress={ChargedProgress}");
|
||||
Params.Add(ChargedProgress);
|
||||
return (uint)PlayerState.Throw;
|
||||
}
|
||||
|
||||
return base.onUpdate();
|
||||
}
|
||||
|
||||
|
||||
#region 蓄力中
|
||||
|
||||
private void ThrowPowerCharged()
|
||||
{
|
||||
if (ChargedProgress < 1)
|
||||
{
|
||||
ChargedProgress += Time.deltaTime;
|
||||
}
|
||||
else if (ChargedProgress > 1)
|
||||
{
|
||||
ChargedProgress = 1;
|
||||
}
|
||||
|
||||
if (!InputManager.IsOp1)
|
||||
{
|
||||
Stage = Phase.Confirm;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1301b70435cd44c8ba3cc6085f35a782
|
||||
timeCreated: 1768138823
|
||||
@@ -1,100 +0,0 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 抛竿中
|
||||
/// </summary>
|
||||
public class PlayerStateThrow : PlayerStateBase
|
||||
{
|
||||
public override uint StateId => (uint)PlayerState.Throw;
|
||||
|
||||
// public enum Phase
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 等待动画事件回调
|
||||
// /// </summary>
|
||||
// Waiting,
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 前摇动画
|
||||
// /// </summary>
|
||||
// AnimBegin,
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 抛线动画
|
||||
// /// </summary>
|
||||
// ThrowAnim,
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 结束
|
||||
// /// </summary>
|
||||
// Done,
|
||||
// ErrorDone
|
||||
// }
|
||||
//
|
||||
// public Phase Stage = Phase.Waiting;
|
||||
private bool _nextState = false;
|
||||
public float ChargedProgress;
|
||||
|
||||
protected override void onEnter()
|
||||
{
|
||||
Log.Info("enter PlayerStateThrow");
|
||||
_owner.ModelAsset.PlayerAnimator.StartThrow = true;
|
||||
|
||||
ChargedProgress = (float)Params.Get(0);
|
||||
Debug.Log($"PlayerThrow ChargedProgress={ChargedProgress}");
|
||||
_nextState = false;
|
||||
// Stage = Phase.Waiting;
|
||||
|
||||
// _owner.Gears.Reel?.Unlock();
|
||||
}
|
||||
|
||||
protected override uint onUpdate()
|
||||
{
|
||||
CheckStateTimeout(10);
|
||||
if (_nextState)
|
||||
{
|
||||
return (uint)PlayerState.Fishing;
|
||||
}
|
||||
|
||||
return base.onUpdate();
|
||||
}
|
||||
|
||||
// IEnumerator ThrowCoroutine(float distance)
|
||||
// {
|
||||
// float startLength = 0.5f;
|
||||
// Debug.Log($"REST LENGTH : {rope.restLength}");
|
||||
// do
|
||||
// {
|
||||
// float a = Vector3.Distance(rodTipTarget.position, attachedBody.transform.position);
|
||||
// attachedBody.RBody.AddForce(playerForward.Value, ForceMode.VelocityChange);
|
||||
// startLength = Mathf.Max(a, startLength);
|
||||
// UnwindLine(attachedBody.RBody.linearVelocity.magnitude * Time.deltaTime);
|
||||
// yield return null;
|
||||
// }
|
||||
// while ((bool)isBailOpen);
|
||||
// }
|
||||
|
||||
#region 动画回调
|
||||
|
||||
/// <summary>
|
||||
/// 抛竿动画事件
|
||||
/// </summary>
|
||||
public void OnRodThrowStart()
|
||||
{
|
||||
Debug.LogError("OnRodThrowStart");
|
||||
_owner.ModelAsset.PlayerAnimator.PrepareThrow = false;
|
||||
_owner.ModelAsset.PlayerAnimator.StartThrow = false;
|
||||
}
|
||||
|
||||
public void OnRodThrownEnd()
|
||||
{
|
||||
Debug.LogError("OnRodThrownEnd");
|
||||
_nextState = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a0b4bc6f668446cab7baf752da60477
|
||||
timeCreated: 1768138870
|
||||
Reference in New Issue
Block a user