目录调整,旧钓鱼逻辑全部注释
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e465891621384ba890e69d4f2ee3ec27
|
||||
timeCreated: 1748265766
|
||||
@@ -1,104 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
// using WaveHarmonic.Crest;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class Boat : MonoBehaviour
|
||||
{
|
||||
private Collider boatCollider;
|
||||
|
||||
[Tooltip("移动力应施加于质心的垂直偏移量。")] [SerializeField]
|
||||
float _ForceHeightOffset;
|
||||
|
||||
[Tooltip("推力")] [SerializeField] float _ThrustPower = 10f;
|
||||
|
||||
[Tooltip("加速推力")] [SerializeField] float _ThrustMaxPower = 10f;
|
||||
|
||||
[Tooltip("转向速度")] [SerializeField] float _SteerPower = 1f;
|
||||
|
||||
[Tooltip("转弯时要转动船只。")] [Range(0, 1)] [SerializeField]
|
||||
float _TurningHeel = 0.35f;
|
||||
|
||||
[Tooltip("对浮力变化应用曲线处理。")] [SerializeField]
|
||||
AnimationCurve _BuoyancyCurveFactor = new(new Keyframe[]
|
||||
{
|
||||
new(0, 0, 0.01267637f, 0.01267637f),
|
||||
new(0.6626424f, 0.1791001f, 0.8680198f, 0.8680198f), new(1, 1, 3.38758f, 3.38758f)
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// 船坐下位置
|
||||
/// </summary>
|
||||
public Transform Place;
|
||||
|
||||
/// <summary>
|
||||
/// 船站立位置
|
||||
/// </summary>
|
||||
public Transform standPlace;
|
||||
|
||||
// /// <summary>
|
||||
// /// 浮力组件
|
||||
// /// </summary>
|
||||
// private FloatingObject _floatingObject;
|
||||
|
||||
private float _BuoyancyFactor = 1f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
boatCollider = GetComponent<Collider>();
|
||||
// if (_floatingObject == null) _floatingObject = GetComponent<FloatingObject>();
|
||||
}
|
||||
|
||||
|
||||
public void Use(FPlayer player)
|
||||
{
|
||||
boatCollider.enabled = false;
|
||||
}
|
||||
|
||||
public void UnUse()
|
||||
{
|
||||
boatCollider.enabled = true;
|
||||
}
|
||||
|
||||
public void BoatInput(Vector2 moveInput, bool isRun = false)
|
||||
{
|
||||
// if (!_floatingObject.InWater) return;
|
||||
//
|
||||
// var input = Vector3.zero;
|
||||
// input.x = moveInput.x; // 水平转向(x轴)
|
||||
// input.z = moveInput.y; // 前后移动(y轴映射到z轴)
|
||||
//
|
||||
// var rb = _floatingObject.RigidBody;
|
||||
//
|
||||
// var power = isRun ? _ThrustMaxPower : _ThrustPower;
|
||||
//
|
||||
// // Thrust
|
||||
// var forcePosition = rb.worldCenterOfMass + _ForceHeightOffset * Vector3.up;
|
||||
// rb.AddForceAtPosition(power * input.z * transform.forward, forcePosition, ForceMode.Acceleration);
|
||||
//
|
||||
// // Steer
|
||||
// var rotation = transform.up + _TurningHeel * transform.forward;
|
||||
// rb.AddTorque(_SteerPower * input.x * rotation, ForceMode.Acceleration);
|
||||
//
|
||||
// if (input.y > 0f)
|
||||
// {
|
||||
// if (_BuoyancyFactor < 1f)
|
||||
// {
|
||||
// _BuoyancyFactor += Time.deltaTime * 0.1f;
|
||||
// _BuoyancyFactor = Mathf.Clamp(_BuoyancyFactor, 0f, 1f);
|
||||
// _floatingObject.BuoyancyForceStrength = _BuoyancyCurveFactor.Evaluate(_BuoyancyFactor);
|
||||
// }
|
||||
// }
|
||||
// else if (input.y < 0f)
|
||||
// {
|
||||
// if (_BuoyancyFactor > 0f)
|
||||
// {
|
||||
// _BuoyancyFactor -= Time.deltaTime * 0.1f;
|
||||
// _BuoyancyFactor = Mathf.Clamp(_BuoyancyFactor, 0f, 1f);
|
||||
// _floatingObject.BuoyancyForceStrength = _BuoyancyCurveFactor.Evaluate(_BuoyancyFactor);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 206cf1531b7445518ce30ec8ecb0ad2a
|
||||
timeCreated: 1748265785
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bacf82b53c5f4764b384a94c6cf91bdd
|
||||
timeCreated: 1744029436
|
||||
@@ -1,323 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[Serializable]
|
||||
public class FPlayerData
|
||||
{
|
||||
public int PlayerID;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家当前装备的钓组
|
||||
/// </summary>
|
||||
public FPlayerGearData currentGear;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家位置
|
||||
/// </summary>
|
||||
public Vector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家角度
|
||||
/// </summary>
|
||||
public Quaternion rotation;
|
||||
|
||||
public float currentReelingSpeed;
|
||||
public bool isHandOnHandle;
|
||||
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
public float lineLength;
|
||||
|
||||
/// <summary>
|
||||
/// 收线速度
|
||||
/// </summary>
|
||||
public float reelSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// 打开手电筒
|
||||
/// </summary>
|
||||
public bool openLight;
|
||||
|
||||
/// <summary>
|
||||
/// 打开望远镜
|
||||
/// </summary>
|
||||
public bool openTelescope;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
public uint state;
|
||||
|
||||
|
||||
public float lineCutTimer = 0;
|
||||
|
||||
public SelectorRodSetting selectorRodSetting = SelectorRodSetting.Speed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 玩家钓组数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FPlayerGearData
|
||||
{
|
||||
public GearType Type = GearType.Spinning;
|
||||
|
||||
public FRodData rod;
|
||||
public FReelData reel;
|
||||
public FBobberData bobber;
|
||||
public FHookData hook;
|
||||
public FBaitData bait;
|
||||
public FLureData lure;
|
||||
public FWeightData weight;
|
||||
public FLineData line;
|
||||
public FLeaderData leader;
|
||||
public FFeederData feeder;
|
||||
|
||||
/// <summary>
|
||||
/// 获得唯一id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetUnitId()
|
||||
{
|
||||
int result = 0;
|
||||
if (rod != null)
|
||||
{
|
||||
result += rod.configId;
|
||||
}
|
||||
|
||||
if (reel != null)
|
||||
{
|
||||
result += reel.configId;
|
||||
}
|
||||
|
||||
if (bobber != null)
|
||||
{
|
||||
result += bobber.configId;
|
||||
}
|
||||
|
||||
if (hook != null)
|
||||
{
|
||||
result += hook.configId;
|
||||
}
|
||||
|
||||
if (bait != null)
|
||||
{
|
||||
result += bait.configId;
|
||||
}
|
||||
|
||||
if (lure != null)
|
||||
{
|
||||
result += lure.configId;
|
||||
}
|
||||
|
||||
if (weight != null)
|
||||
{
|
||||
result += weight.configId;
|
||||
}
|
||||
|
||||
if (line != null)
|
||||
{
|
||||
result += line.configId;
|
||||
}
|
||||
|
||||
if (leader != null)
|
||||
{
|
||||
result += leader.configId;
|
||||
}
|
||||
|
||||
if (feeder != null)
|
||||
{
|
||||
result += feeder.configId;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void SetBobberLastSetGroundValue(float value)
|
||||
{
|
||||
bobber.lastSetGroundValue = value;
|
||||
}
|
||||
|
||||
public void SetReelSettings(int setType, float val, bool saveToPrefs = false)
|
||||
{
|
||||
if (setType == 0)
|
||||
{
|
||||
reel.currentSpeed = val;
|
||||
}
|
||||
|
||||
if (setType == 1)
|
||||
{
|
||||
reel.currentDrag = val;
|
||||
}
|
||||
|
||||
if (saveToPrefs)
|
||||
{
|
||||
// Instance._playerData.SaveEquipment(ItemType.Reel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public abstract class FGearData
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一id
|
||||
/// </summary>
|
||||
public int id;
|
||||
|
||||
/// <summary>
|
||||
/// 配置id
|
||||
/// </summary>
|
||||
public int configId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鱼竿数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FRodData : FGearData
|
||||
{
|
||||
private GameRods _config;
|
||||
|
||||
public GameRods Config
|
||||
{
|
||||
get { return _config ??= GameRods.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线轴数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FReelData : FGearData
|
||||
{
|
||||
private GameReels _config;
|
||||
|
||||
public GameReels Config
|
||||
{
|
||||
get { return _config ??= GameReels.Get(configId); }
|
||||
}
|
||||
|
||||
public float currentSpeed = 0.5f;
|
||||
|
||||
public float currentDrag = 0.7f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 浮漂数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FBobberData : FGearData
|
||||
{
|
||||
private GameFloats _config;
|
||||
|
||||
public GameFloats Config
|
||||
{
|
||||
get { return _config ??= GameFloats.Get(configId); }
|
||||
}
|
||||
|
||||
public float lastSetGroundValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鱼钩数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FHookData : FGearData
|
||||
{
|
||||
private GameHooks _config;
|
||||
|
||||
public GameHooks Config
|
||||
{
|
||||
get { return _config ??= GameHooks.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鱼饵数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FBaitData : FGearData
|
||||
{
|
||||
private GameBaits _config;
|
||||
|
||||
public GameBaits Config
|
||||
{
|
||||
get { return _config ??= GameBaits.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鱼饵数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FLureData : FGearData
|
||||
{
|
||||
private GameLures _config;
|
||||
|
||||
public GameLures Config
|
||||
{
|
||||
get { return _config ??= GameLures.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 沉子数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FWeightData : FGearData
|
||||
{
|
||||
private GameWeights _config;
|
||||
|
||||
public GameWeights Config
|
||||
{
|
||||
get { return _config ??= GameWeights.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FLineData : FGearData
|
||||
{
|
||||
private GameLines _config;
|
||||
|
||||
public GameLines Config
|
||||
{
|
||||
get { return _config ??= GameLines.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引线数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FLeaderData : FGearData
|
||||
{
|
||||
private GameLeaders _config;
|
||||
|
||||
public GameLeaders Config
|
||||
{
|
||||
get { return _config ??= GameLeaders.Get(configId); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 菲德数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FFeederData : FGearData
|
||||
{
|
||||
private GameFeeders _config;
|
||||
|
||||
public GameFeeders Config
|
||||
{
|
||||
get { return _config ??= GameFeeders.Get(configId); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e64ae505cdc344f5acedf6e55ba67a89
|
||||
timeCreated: 1744029443
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace NBF
|
||||
{
|
||||
public enum GearType
|
||||
{
|
||||
SpinningFloat = 0,
|
||||
Spinning = 1,
|
||||
Feeder = 2,
|
||||
Pole = 4
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e9c20d631da449c943671224a8f56f1
|
||||
timeCreated: 1744637252
|
||||
@@ -1,82 +0,0 @@
|
||||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
public class FFishRagDoll : MonoBehaviour
|
||||
{
|
||||
private Transform TailRag;
|
||||
|
||||
[HideInInspector]
|
||||
public CCDIK _ccidk;
|
||||
|
||||
private FFish fish;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
fish = GetComponent<FFish>();
|
||||
_ccidk = GetComponent<CCDIK>();
|
||||
TailRag = _ccidk.solver.target;
|
||||
if (TailRag == null)
|
||||
{
|
||||
Debug.LogError("Ryba nie ma podczepionego TailRag: " + transform.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupTailRag();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupTailRag()
|
||||
{
|
||||
TailRag.GetComponent<SpringJoint>().maxDistance = transform.localScale.z * 0.2f;
|
||||
TailRag.GetComponent<SpringJoint>().connectedBody = GetComponent<Rigidbody>();
|
||||
TailRag.GetComponent<Rigidbody>().linearDamping = 0.2f;
|
||||
_ccidk.enabled = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (TailRag == null)
|
||||
{
|
||||
if (_ccidk == null || _ccidk.solver.target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
TailRag = _ccidk.solver.target;
|
||||
SetupTailRag();
|
||||
}
|
||||
if (fish.isGetFish && TailRag.parent == transform)
|
||||
{
|
||||
TailRag.transform.SetParent(transform.parent);
|
||||
}
|
||||
if (transform.position.y > 0f)
|
||||
{
|
||||
_ccidk.enabled = true;
|
||||
if (fish.isFishView)
|
||||
{
|
||||
_ccidk.solver.IKPositionWeight = 0.05f * transform.localScale.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ccidk.solver.IKPositionWeight = Mathf.Clamp(transform.position.y, 0f, 1f);
|
||||
}
|
||||
TailRag.gameObject.SetActive(value: true);
|
||||
}
|
||||
else if (transform.position.y < 0f && TailRag.gameObject.activeSelf)
|
||||
{
|
||||
_ccidk.enabled = false;
|
||||
if (TailRag.parent != transform)
|
||||
{
|
||||
TailRag.transform.SetParent(transform);
|
||||
}
|
||||
TailRag.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (!(TailRag == null))
|
||||
{
|
||||
Destroy(TailRag.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c3a57096c6a4f2c8ffa9ba4269ee8b2
|
||||
timeCreated: 1742387706
|
||||
@@ -1,43 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FReelEvents : MonoBehaviour
|
||||
{
|
||||
private FReel reel;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
reel = base.transform.parent.GetComponent<FReel>();
|
||||
}
|
||||
|
||||
public void JoinHandKablak()
|
||||
{
|
||||
// if (reel.reelAsset.animator.GetFloat("Reeling") > 0f)
|
||||
// {
|
||||
// reel.kablagOpenState = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// reel.Owner.InteractiveMainHand(reel.reelAsset.koblagHandle);
|
||||
// }
|
||||
}
|
||||
|
||||
public void UnjoinHandKablak()
|
||||
{
|
||||
// if (!reel.isHandOnHandle)
|
||||
// {
|
||||
// reel.Owner.InteractiveMainHand(null);
|
||||
// if (reel.reelAsset.animator.GetBool("Unlock"))
|
||||
// {
|
||||
// reel.kablagOpenState = true;
|
||||
// }
|
||||
//
|
||||
// if (reel.reelAsset.animator.GetBool("Lock"))
|
||||
// {
|
||||
// reel.kablagOpenState = false;
|
||||
// }
|
||||
//
|
||||
// reel.reelAsset.animator.SetBool("Unlock", false);
|
||||
// reel.reelAsset.animator.SetBool("Lock", false);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63de63adeff447b7acc5a6b4bdd24107
|
||||
timeCreated: 1742722875
|
||||
@@ -1,289 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FWaterDisplacement : MonoBehaviour
|
||||
{
|
||||
public enum MoveCharacteristic
|
||||
{
|
||||
Custom = 0,
|
||||
MoveUp_StopDown = 1,
|
||||
MoveDown_100cm = 2,
|
||||
MoveDown_150cm = 3,
|
||||
TopWater = 4,
|
||||
MoveDown = 5,
|
||||
MoveUp_StopDown_Twisters = 6
|
||||
}
|
||||
|
||||
public MoveCharacteristic moveCharacteristic;
|
||||
|
||||
public float objectDisplacement = 1f;
|
||||
|
||||
public float waterDrag = 3f;
|
||||
|
||||
public float waterMass = 3f;
|
||||
|
||||
public float outwaterMass = 6f;
|
||||
|
||||
public bool isInWater;
|
||||
public bool isInTerrain;
|
||||
|
||||
public bool resetVelocityEnterToWater = true;
|
||||
|
||||
private float normalDrag;
|
||||
|
||||
public bool isFreeze;
|
||||
|
||||
public bool useSplashes = true;
|
||||
|
||||
public bool useSplashesOnlyInThrow;
|
||||
|
||||
public bool useWaterCurrent;
|
||||
|
||||
[HideInInspector] public Rigidbody rigidbody;
|
||||
|
||||
[HideInInspector] public Collider collider;
|
||||
|
||||
[HideInInspector] public float waterHeightPosition;
|
||||
|
||||
[HideInInspector] public float depth;
|
||||
|
||||
private FFishSystem fFishSystem;
|
||||
|
||||
public List<FFish> fishListCreated;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
fFishSystem = FindObjectOfType<FFishSystem>();
|
||||
rigidbody = GetComponent<Rigidbody>();
|
||||
collider = GetComponent<Collider>();
|
||||
normalDrag = rigidbody.linearDamping;
|
||||
fishListCreated = new List<FFish>();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (isInWater)
|
||||
{
|
||||
depth = Mathf.Abs(transform.position.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
depth = 0f;
|
||||
}
|
||||
|
||||
AffectCharacteristic();
|
||||
AffectCharacteristicNew();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
}
|
||||
|
||||
private void AffectCharacteristic()
|
||||
{
|
||||
if (moveCharacteristic == MoveCharacteristic.Custom && !isFreeze && isInWater && transform.position.y < 0f &&
|
||||
objectDisplacement > 0f)
|
||||
{
|
||||
transform.position = Vector3.MoveTowards(transform.position,
|
||||
new Vector3(transform.position.x, waterHeightPosition, transform.position.z),
|
||||
Time.deltaTime * objectDisplacement);
|
||||
}
|
||||
}
|
||||
|
||||
private void AffectCharacteristicNew()
|
||||
{
|
||||
if (isFreeze || !isInWater || transform.position.y >= -0.01f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float num = Vector3.Dot(rigidbody.linearVelocity, transform.forward);
|
||||
Quaternion b = Quaternion.Euler(0f, rigidbody.transform.localEulerAngles.y, 0f);
|
||||
rigidbody.rotation = Quaternion.Slerp(rigidbody.rotation, b, Time.deltaTime * 2f);
|
||||
switch (moveCharacteristic)
|
||||
{
|
||||
case MoveCharacteristic.MoveDown:
|
||||
if (num > 0.2f)
|
||||
{
|
||||
rigidbody.AddForce(-Vector3.up * Time.deltaTime * Mathf.Clamp01(num) * 2f,
|
||||
ForceMode.VelocityChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
rigidbody.AddForce(Vector3.up * Time.deltaTime * 1f, ForceMode.VelocityChange);
|
||||
}
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
break;
|
||||
case MoveCharacteristic.MoveUp_StopDown:
|
||||
if (num > 0.2f)
|
||||
{
|
||||
rigidbody.AddForce(Vector3.up * Time.deltaTime * Mathf.Clamp01(num), ForceMode.VelocityChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
rigidbody.AddForce(-Vector3.up * Time.deltaTime * 3f, ForceMode.VelocityChange);
|
||||
}
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
break;
|
||||
case MoveCharacteristic.MoveUp_StopDown_Twisters:
|
||||
if (num > 0.2f)
|
||||
{
|
||||
rigidbody.AddForce(Vector3.up * Time.deltaTime * Mathf.Clamp01(num), ForceMode.VelocityChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
rigidbody.AddForce(-Vector3.up * Time.deltaTime * 2.5f, ForceMode.VelocityChange);
|
||||
}
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
break;
|
||||
case MoveCharacteristic.TopWater:
|
||||
if (num > 0.2f && transform.position.y >= -0.03f)
|
||||
{
|
||||
rigidbody.AddForce(-Vector3.up * Time.deltaTime * 1f, ForceMode.VelocityChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
rigidbody.AddForce(Vector3.up * Time.deltaTime * 1f, ForceMode.VelocityChange);
|
||||
}
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
break;
|
||||
case MoveCharacteristic.MoveDown_150cm:
|
||||
if (num > 0.2f && transform.position.y > -1.5f)
|
||||
{
|
||||
rigidbody.AddForce(-Vector3.up * Time.deltaTime * Mathf.Clamp01(num) * 2f,
|
||||
ForceMode.VelocityChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
rigidbody.AddForce(Vector3.up * Time.deltaTime * 1f, ForceMode.VelocityChange);
|
||||
}
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
break;
|
||||
case MoveCharacteristic.MoveDown_100cm:
|
||||
if (num > 0.2f && transform.position.y > -1f)
|
||||
{
|
||||
rigidbody.AddForce(-Vector3.up * Time.deltaTime * Mathf.Clamp01(num) * 2f,
|
||||
ForceMode.VelocityChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
rigidbody.AddForce(Vector3.up * Time.deltaTime * 1f, ForceMode.VelocityChange);
|
||||
}
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
break;
|
||||
case MoveCharacteristic.Custom:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Water"))
|
||||
{
|
||||
isInWater = true;
|
||||
rigidbody.mass = waterMass;
|
||||
waterHeightPosition = other.transform.position.y;
|
||||
if (rigidbody.useGravity)
|
||||
{
|
||||
EnableDisableGravity(value: false);
|
||||
}
|
||||
|
||||
if (rigidbody.linearDamping != waterDrag)
|
||||
{
|
||||
SetDragRigidbody(waterDrag);
|
||||
}
|
||||
|
||||
if ((bool)fFishSystem)
|
||||
{
|
||||
fFishSystem.AddInwaterObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Water"))
|
||||
{
|
||||
rigidbody.freezeRotation = false;
|
||||
isInWater = false;
|
||||
rigidbody.mass = outwaterMass;
|
||||
EnableDisableGravity(value: true);
|
||||
SetDragRigidbody(normalDrag);
|
||||
if ((bool)fFishSystem)
|
||||
{
|
||||
fFishSystem.DeleteInwaterObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableDisableGravity(bool value)
|
||||
{
|
||||
if (resetVelocityEnterToWater)
|
||||
{
|
||||
rigidbody.linearVelocity = Vector3.zero;
|
||||
}
|
||||
|
||||
Rigidbody[] componentsInChildren = gameObject.GetComponentsInChildren<Rigidbody>();
|
||||
for (int i = 0; i < componentsInChildren.Length; i++)
|
||||
{
|
||||
componentsInChildren[i].useGravity = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDragRigidbody(float value)
|
||||
{
|
||||
Rigidbody[] componentsInChildren = gameObject.GetComponentsInChildren<Rigidbody>();
|
||||
for (int i = 0; i < componentsInChildren.Length; i++)
|
||||
{
|
||||
componentsInChildren[i].linearDamping = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceByWaterCurrent(Vector3 direction, float powerForce)
|
||||
{
|
||||
if (useWaterCurrent && isInWater)
|
||||
{
|
||||
rigidbody.AddForce(direction * powerForce, ForceMode.Acceleration);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildSplash(Vector3 contactPosition)
|
||||
{
|
||||
// if (useSplashes && !(rigidbody.linearVelocity.magnitude < 3f) &&
|
||||
// (!FScriptsHandler.Instance.m_PlayerMain.currentRod || !useSplashesOnlyInThrow ||
|
||||
// FScriptsHandler.Instance.m_PlayerMain.currentRod.currentReel.kablagOpenState) &&
|
||||
// !(rigidbody.linearVelocity.y > 0f))
|
||||
// {
|
||||
// Vector3 vector = Vector3.one * (0.02f * Mathf.Abs(rigidbody.linearVelocity.y)) * transform.localScale.x;
|
||||
// int num = 0;
|
||||
// GameObject obj = Instantiate(FScriptsHandler.Instance.waterFishSplash[num]);
|
||||
// obj.transform.position = new Vector3(contactPosition.x, 0.05f, contactPosition.z);
|
||||
// obj.GetComponent<AudioSource>().volume = 0.5f * vector.x;
|
||||
// vector = Vector3.ClampMagnitude(vector, 1f);
|
||||
// obj.transform.localScale = vector;
|
||||
// }
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider col)
|
||||
{
|
||||
if (col.transform.CompareTag("Water"))
|
||||
{
|
||||
BuildSplash(new Vector3(transform.position.x, SceneSettings.Instance.WaterObject.transform.position.y,
|
||||
transform.position.z));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if ((bool)fFishSystem)
|
||||
{
|
||||
fFishSystem.DeleteInwaterObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5109f1ab72f9463b892a49f6f309a485
|
||||
timeCreated: 1742313602
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6641d04cdbda4cf9b8b40d8e79288ff9
|
||||
timeCreated: 1742313505
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afcccd0318924ebf9adc736ea2251c81
|
||||
timeCreated: 1742313546
|
||||
@@ -1,625 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FFishSystem : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class FeedingZoneGroup
|
||||
{
|
||||
public enum FishMoveType
|
||||
{
|
||||
None = 0,
|
||||
Random = 1,
|
||||
Loop = 2,
|
||||
OneWay = 3
|
||||
}
|
||||
|
||||
public List<FishFeedingZone> fishFeedingZones;
|
||||
|
||||
public FishMoveType fishMoveType;
|
||||
|
||||
public bool isRandom;
|
||||
|
||||
public bool isLoop;
|
||||
|
||||
public bool isNoRepeat;
|
||||
|
||||
public Color connectLineGizmos = Color.red;
|
||||
}
|
||||
|
||||
public bool isNewSpawnerSystem = true;
|
||||
|
||||
public List<FWaterDisplacement> inwaterObjects;
|
||||
|
||||
public List<FWaterDisplacement> baitsObjects;
|
||||
|
||||
public List<FFish> inwaterFishObjects;
|
||||
|
||||
public List<FFish> inwaterFishObjectsSpawner;
|
||||
|
||||
public List<FeedingZoneGroup> feedingZoneGroup;
|
||||
|
||||
public bool viewDebugFish = true;
|
||||
|
||||
public int maxVievFishAmount = 15;
|
||||
|
||||
public int currentFishViewAmount;
|
||||
|
||||
[SerializeField] private int fishToSpawnAmount;
|
||||
|
||||
|
||||
[SerializeField] public bool isReadySetup;
|
||||
|
||||
private int maximumFishPoints = 20;
|
||||
|
||||
private float timerToReady;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
isReadySetup = false;
|
||||
if (!isNewSpawnerSystem)
|
||||
{
|
||||
SetupFeedingZones();
|
||||
}
|
||||
else
|
||||
{
|
||||
InvokeRepeating("ReSpawnerSystem", 1f, 1f);
|
||||
}
|
||||
|
||||
inwaterFishObjectsSpawner = new List<FFish>();
|
||||
InvokeRepeating("RefreshCurrentFishView", 30f, 30f);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isNewSpawnerSystem)
|
||||
{
|
||||
if (!isReadySetup && fishToSpawnAmount == inwaterFishObjects.Count)
|
||||
{
|
||||
if (!isReadySetup)
|
||||
{
|
||||
Debug.Log("Zakończono spawnowania ryb: " + inwaterFishObjects.Count);
|
||||
}
|
||||
|
||||
isReadySetup = true;
|
||||
InvokeRepeating("RefreshFishOptimize", 2f, 2f);
|
||||
}
|
||||
}
|
||||
else if (!isReadySetup)
|
||||
{
|
||||
isReadySetup = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (isReadySetup)
|
||||
{
|
||||
if (!isNewSpawnerSystem)
|
||||
{
|
||||
FishDisabledMovement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReSpawnerSystem()
|
||||
{
|
||||
// if (eagleEyes.isFishView)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
baitsObjects.Clear();
|
||||
FWaterDisplacement[] array = FindObjectsOfType<FWaterDisplacement>();
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (array[i].CompareTag("BaitLure"))
|
||||
{
|
||||
baitsObjects.Add(array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (baitsObjects.Count > 0)
|
||||
{
|
||||
ReassignFishOrDestroyHookObject();
|
||||
fishToSpawnAmount = Mathf.RoundToInt(maximumFishPoints / baitsObjects.Count);
|
||||
DeleteFishOffRange();
|
||||
for (int j = 0; j < baitsObjects.Count; j++)
|
||||
{
|
||||
GenerateOnFish(baitsObjects[j].transform.position, baitsObjects[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteFishOffRange()
|
||||
{
|
||||
// for (int i = 0;
|
||||
// i < inwaterFishObjectsSpawner.Count && (!(Vector3.Distance(inwaterFishObjectsSpawner[i].transform.position,
|
||||
// FScriptsHandler.Instance.m_PlayerMain.currentCameraView
|
||||
// .transform.position) < 15f));
|
||||
// i++)
|
||||
// {
|
||||
// for (int j = 0; j < baitsObjects.Count; j++)
|
||||
// {
|
||||
// if (baitsObjects[j].fishListCreated.Contains(inwaterFishObjectsSpawner[i]) &&
|
||||
// Vector3.Distance(inwaterFishObjectsSpawner[i].transform.position,
|
||||
// baitsObjects[j].transform.position) > 30f &&
|
||||
// inwaterFishObjectsSpawner[i].transform.position.y < 0f &&
|
||||
// inwaterFishObjectsSpawner[i].joiner == null)
|
||||
// {
|
||||
// baitsObjects[j].fishListCreated.Remove(inwaterFishObjectsSpawner[i]);
|
||||
// Destroy(inwaterFishObjectsSpawner[i].gameObject);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void DeleteOneFishFromHookObject(FWaterDisplacement hookObject)
|
||||
{
|
||||
// for (int i = 0; i < hookObject.fishListCreated.Count; i++)
|
||||
// {
|
||||
// if (Vector3.Distance(hookObject.fishListCreated[i].transform.position, hookObject.transform.position) >
|
||||
// 10f && hookObject.fishListCreated[i].joiner == null &&
|
||||
// hookObject.fishListCreated[i].currentSearchBaitLure == null && !hookObject.fishListCreated[i].isGetFish)
|
||||
// {
|
||||
// if (!(Vector3.Distance(hookObject.fishListCreated[i].transform.position,
|
||||
// FScriptsHandler.Instance.m_PlayerMain.currentCameraView.transform.position) < 15f))
|
||||
// {
|
||||
// Destroy(hookObject.fishListCreated[i].gameObject);
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public void RemoveFishFromCurrentHook(FFish fish)
|
||||
{
|
||||
for (int i = 0; i < baitsObjects.Count; i++)
|
||||
{
|
||||
if (baitsObjects[i].fishListCreated.Contains(fish))
|
||||
{
|
||||
baitsObjects[i].fishListCreated.Remove(fish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReassignFishOrDestroyHookObject()
|
||||
{
|
||||
for (int i = 0; i < inwaterFishObjectsSpawner.Count; i++)
|
||||
{
|
||||
bool flag = false;
|
||||
for (int j = 0; j < baitsObjects.Count; j++)
|
||||
{
|
||||
if (baitsObjects[j].fishListCreated.Contains(inwaterFishObjectsSpawner[i]))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
baitsObjects[UnityEngine.Random.Range(0, baitsObjects.Count - 1)].fishListCreated
|
||||
.Add(inwaterFishObjectsSpawner[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateOnFish(Vector3 currPosition, FWaterDisplacement hookObject = null)
|
||||
{
|
||||
if (feedingZoneGroup.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bool)hookObject)
|
||||
{
|
||||
if (fishToSpawnAmount < hookObject.fishListCreated.Count)
|
||||
{
|
||||
DeleteOneFishFromHookObject(hookObject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fishToSpawnAmount == hookObject.fishListCreated.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool flag = false;
|
||||
Vector3 vector = currPosition + UnityEngine.Random.onUnitSphere * UnityEngine.Random.Range(20f, 25f);
|
||||
if (Vector3.Distance(vector, currPosition) < 15f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float num = ProbeDeepToTerenFromWater(vector);
|
||||
if (num < 0.3f || num == 0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vector.y = UnityEngine.Random.Range(0f - num, 0f - num * 0.5f);
|
||||
for (int i = 0; i < feedingZoneGroup.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < feedingZoneGroup[i].fishFeedingZones.Count; j++)
|
||||
{
|
||||
if (Vector3.Distance(currPosition, feedingZoneGroup[i].fishFeedingZones[j].transform.position) <
|
||||
feedingZoneGroup[i].fishFeedingZones[j].rangeZone && ProbeDeepToTerenBottom(vector))
|
||||
{
|
||||
StartCoroutine(feedingZoneGroup[i].fishFeedingZones[j].GenerateOneFish(vector, hookObject));
|
||||
flag = true;
|
||||
Debug.Log("Generate fish in zone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag && ProbeDeepToTerenBottom(vector))
|
||||
{
|
||||
StartCoroutine(feedingZoneGroup[0].fishFeedingZones[0].GenerateOneFish(vector, hookObject));
|
||||
Debug.Log("Generate fish first zone");
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshFishOptimize()
|
||||
{
|
||||
// if (!eagleEyes.isFishView)
|
||||
// {
|
||||
// StartCoroutine(FishOptimize());
|
||||
// }
|
||||
}
|
||||
|
||||
private void SetupFeedingZones()
|
||||
{
|
||||
for (int i = 0; i < feedingZoneGroup.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < feedingZoneGroup[i].fishFeedingZones.Count; j++)
|
||||
{
|
||||
for (int k = 0; k < feedingZoneGroup[i].fishFeedingZones[j].fishPopulation.Length; k++)
|
||||
{
|
||||
fishToSpawnAmount += feedingZoneGroup[i].fishFeedingZones[j].fishPopulation[k].AmountPopulationZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < feedingZoneGroup.Count; l++)
|
||||
{
|
||||
for (int m = 0; m < feedingZoneGroup[l].fishFeedingZones.Count; m++)
|
||||
{
|
||||
feedingZoneGroup[l].fishFeedingZones[m].fFishSystem = this;
|
||||
feedingZoneGroup[l].fishFeedingZones[m].Inedex = m;
|
||||
feedingZoneGroup[l].fishFeedingZones[m].InedexOfGroup = l;
|
||||
StartCoroutine(feedingZoneGroup[l].fishFeedingZones[m].GenerateFishPopulationOnStart());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FishDisabledMovement()
|
||||
{
|
||||
for (int i = 0; i < feedingZoneGroup.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < feedingZoneGroup[i].fishFeedingZones.Count; j++)
|
||||
{
|
||||
for (int k = 0; k < feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone.Count; k++)
|
||||
{
|
||||
if (feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k] != null && !feedingZoneGroup[i]
|
||||
.fishFeedingZones[j].fishesOnZone[k].gameObject.activeSelf)
|
||||
{
|
||||
Vector3 targetPoint = feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].TargetPoint;
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].transform.position =
|
||||
Vector3.MoveTowards(
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].transform.position, targetPoint,
|
||||
Time.deltaTime * 0.8f);
|
||||
if (feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].transform.position == targetPoint)
|
||||
{
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].currentFeedingZone =
|
||||
GetNewTargetFeedingZone(feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k]);
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].TargetPoint =
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].currentFeedingZone.transform
|
||||
.position + new Vector3(
|
||||
UnityEngine.Random.Range(
|
||||
0f - feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].currentFeedingZone
|
||||
.rangeZone,
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].currentFeedingZone
|
||||
.rangeZone), UnityEngine.Random.Range(-1f, -0.2f),
|
||||
UnityEngine.Random.Range(
|
||||
0f - feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].currentFeedingZone
|
||||
.rangeZone,
|
||||
feedingZoneGroup[i].fishFeedingZones[j].fishesOnZone[k].currentFeedingZone
|
||||
.rangeZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FishFeedingZone GetNewTargetFeedingZone(FFish currentFish)
|
||||
{
|
||||
int inedexOfGroup = currentFish.currentFeedingZone.InedexOfGroup;
|
||||
int inedex = currentFish.currentFeedingZone.Inedex;
|
||||
int count = feedingZoneGroup[inedexOfGroup].fishFeedingZones.Count;
|
||||
FishFeedingZone result = null;
|
||||
int num = 0;
|
||||
switch (feedingZoneGroup[inedexOfGroup].fishMoveType)
|
||||
{
|
||||
case FeedingZoneGroup.FishMoveType.None:
|
||||
if (currentFish.feedingZoneMoveState == 0)
|
||||
{
|
||||
num = inedex + 1;
|
||||
if (num >= count)
|
||||
{
|
||||
currentFish.feedingZoneMoveState = 1;
|
||||
num = inedex - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentFish.feedingZoneMoveState == 1)
|
||||
{
|
||||
num = inedex - 1;
|
||||
if (num < 0)
|
||||
{
|
||||
currentFish.feedingZoneMoveState = 0;
|
||||
num = inedex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
result = feedingZoneGroup[inedexOfGroup].fishFeedingZones[num];
|
||||
break;
|
||||
case FeedingZoneGroup.FishMoveType.Loop:
|
||||
num = inedex + 1;
|
||||
if (num >= count)
|
||||
{
|
||||
currentFish.feedingZoneMoveState = 0;
|
||||
num = 0;
|
||||
}
|
||||
|
||||
result = feedingZoneGroup[inedexOfGroup].fishFeedingZones[num];
|
||||
break;
|
||||
case FeedingZoneGroup.FishMoveType.Random:
|
||||
num = UnityEngine.Random.Range(0, count);
|
||||
result = feedingZoneGroup[inedexOfGroup].fishFeedingZones[num];
|
||||
break;
|
||||
case FeedingZoneGroup.FishMoveType.OneWay:
|
||||
num = inedex + 1;
|
||||
if (num >= count)
|
||||
{
|
||||
currentFish.transform.position =
|
||||
feedingZoneGroup[inedexOfGroup].fishFeedingZones[0].transform.position + new Vector3(
|
||||
UnityEngine.Random.Range(0f - feedingZoneGroup[inedexOfGroup].fishFeedingZones[0].rangeZone,
|
||||
feedingZoneGroup[inedexOfGroup].fishFeedingZones[0].rangeZone),
|
||||
UnityEngine.Random.Range(-1f, -0.2f),
|
||||
UnityEngine.Random.Range(0f - feedingZoneGroup[inedexOfGroup].fishFeedingZones[0].rangeZone,
|
||||
feedingZoneGroup[inedexOfGroup].fishFeedingZones[0].rangeZone));
|
||||
num = 1;
|
||||
}
|
||||
|
||||
result = feedingZoneGroup[inedexOfGroup].fishFeedingZones[num];
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
for (int i = 0; i < feedingZoneGroup.Count; i++)
|
||||
{
|
||||
switch (feedingZoneGroup[i].fishMoveType)
|
||||
{
|
||||
case FeedingZoneGroup.FishMoveType.None:
|
||||
{
|
||||
for (int k = 0; k < feedingZoneGroup[i].fishFeedingZones.Count - 1; k++)
|
||||
{
|
||||
Gizmos.color = feedingZoneGroup[i].connectLineGizmos;
|
||||
Gizmos.DrawLine(feedingZoneGroup[i].fishFeedingZones[k].transform.position,
|
||||
feedingZoneGroup[i].fishFeedingZones[k + 1].transform.position);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case FeedingZoneGroup.FishMoveType.Loop:
|
||||
{
|
||||
for (int l = 0; l < feedingZoneGroup[i].fishFeedingZones.Count - 1; l++)
|
||||
{
|
||||
Gizmos.color = feedingZoneGroup[i].connectLineGizmos;
|
||||
Gizmos.DrawLine(feedingZoneGroup[i].fishFeedingZones[l].transform.position,
|
||||
feedingZoneGroup[i].fishFeedingZones[l + 1].transform.position);
|
||||
}
|
||||
|
||||
Gizmos.DrawLine(
|
||||
feedingZoneGroup[i].fishFeedingZones[feedingZoneGroup[i].fishFeedingZones.Count - 1].transform
|
||||
.position, feedingZoneGroup[i].fishFeedingZones[0].transform.position);
|
||||
break;
|
||||
}
|
||||
case FeedingZoneGroup.FishMoveType.Random:
|
||||
{
|
||||
for (int m = 0; m < feedingZoneGroup[i].fishFeedingZones.Count; m++)
|
||||
{
|
||||
for (int n = 0; n < feedingZoneGroup[i].fishFeedingZones.Count; n++)
|
||||
{
|
||||
Gizmos.color = feedingZoneGroup[i].connectLineGizmos;
|
||||
Gizmos.DrawLine(feedingZoneGroup[i].fishFeedingZones[m].transform.position,
|
||||
feedingZoneGroup[i].fishFeedingZones[n].transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case FeedingZoneGroup.FishMoveType.OneWay:
|
||||
{
|
||||
for (int j = 0; j < feedingZoneGroup[i].fishFeedingZones.Count - 1; j++)
|
||||
{
|
||||
Gizmos.color = feedingZoneGroup[i].connectLineGizmos;
|
||||
Gizmos.DrawLine(feedingZoneGroup[i].fishFeedingZones[j].transform.position,
|
||||
feedingZoneGroup[i].fishFeedingZones[j + 1].transform.position);
|
||||
}
|
||||
|
||||
Gizmos.color = Color.black;
|
||||
Gizmos.DrawSphere(
|
||||
feedingZoneGroup[i].fishFeedingZones[feedingZoneGroup[i].fishFeedingZones.Count - 1].transform
|
||||
.position, 0.3f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!viewDebugFish)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int num = 0; num < feedingZoneGroup[i].fishFeedingZones.Count; num++)
|
||||
{
|
||||
for (int num2 = 0; num2 < feedingZoneGroup[i].fishFeedingZones[num].fishesOnZone.Count; num2++)
|
||||
{
|
||||
if (feedingZoneGroup[i].fishFeedingZones[num].fishesOnZone[num2] != null)
|
||||
{
|
||||
Gizmos.color = feedingZoneGroup[i].connectLineGizmos;
|
||||
Gizmos.DrawSphere(
|
||||
feedingZoneGroup[i].fishFeedingZones[num].fishesOnZone[num2].transform.position, 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshCurrentFishView()
|
||||
{
|
||||
currentFishViewAmount = 0;
|
||||
for (int i = 0; i < inwaterFishObjects.Count; i++)
|
||||
{
|
||||
if (inwaterFishObjects[i].gameObject.activeSelf)
|
||||
{
|
||||
currentFishViewAmount++;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("RefreshCurrentFishView: " + currentFishViewAmount);
|
||||
}
|
||||
|
||||
private IEnumerator FishOptimize()
|
||||
{
|
||||
// for (int i = 0; i < inwaterFishObjects.Count; i++)
|
||||
// {
|
||||
// if (!(inwaterFishObjects[i] != null) || (bool)inwaterFishObjects[i].currentSearchBaitLure ||
|
||||
// (bool)inwaterFishObjects[i].currentBaitLure)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// float num = Vector3.Distance(FScriptsHandler.Instance.m_PlayerMain.currentCameraView.transform.position,
|
||||
// inwaterFishObjects[i].transform.position);
|
||||
// float num2 = 0f;
|
||||
// bool flag = false;
|
||||
// for (int j = 0; j < inwaterObjects.Count; j++)
|
||||
// {
|
||||
// if (inwaterObjects[j].tag == "BaitLure")
|
||||
// {
|
||||
// num2 = Vector3.Distance(inwaterObjects[j].transform.position,
|
||||
// inwaterFishObjects[i].transform.position);
|
||||
// if (inwaterObjects[j].isInWater)
|
||||
// {
|
||||
// flag = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Vector3.Angle(
|
||||
// inwaterFishObjects[i].transform.position -
|
||||
// FScriptsHandler.Instance.m_PlayerMain.currentCameraView.transform.position,
|
||||
// FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.forward);
|
||||
// if (flag || num < 15f)
|
||||
// {
|
||||
// if (flag && num2 < 15f && num2 > 10f)
|
||||
// {
|
||||
// if (!inwaterFishObjects[i].gameObject.activeSelf && currentFishViewAmount < maxVievFishAmount &&
|
||||
// inwaterFishObjects[i].transform.position.y < -0.5f &&
|
||||
// ProbeDeepToTerenBottom(inwaterFishObjects[i].transform.position))
|
||||
// {
|
||||
// inwaterFishObjects[i].EnableFish();
|
||||
// inwaterFishObjects[i].TimerToDisable = 5f;
|
||||
// currentFishViewAmount++;
|
||||
// yield return null;
|
||||
// }
|
||||
// }
|
||||
// // else if (num < 15f && num > 10f && (bool)FScriptsHandler.Instance.playerManager.freeCamera && !inwaterFishObjects[i].gameObject.activeSelf && currentFishViewAmount < maxVievFishAmount && inwaterFishObjects[i].transform.position.y < -0.5f && ProbeDeepToTerenBottom(inwaterFishObjects[i].transform.position))
|
||||
// else if (num < 15f && num > 10f &&
|
||||
// !inwaterFishObjects[i].gameObject.activeSelf && currentFishViewAmount < maxVievFishAmount &&
|
||||
// inwaterFishObjects[i].transform.position.y < -0.5f &&
|
||||
// ProbeDeepToTerenBottom(inwaterFishObjects[i].transform.position))
|
||||
// {
|
||||
// inwaterFishObjects[i].EnableFish();
|
||||
// inwaterFishObjects[i].TimerToDisable = 5f;
|
||||
// currentFishViewAmount++;
|
||||
// yield return null;
|
||||
// }
|
||||
// }
|
||||
// else if (inwaterFishObjects[i].gameObject.activeSelf && inwaterFishObjects[i].TimerToDisable == 0f &&
|
||||
// currentFishViewAmount > 0)
|
||||
// {
|
||||
// inwaterFishObjects[i].gameObject.SetActive(value: false);
|
||||
// currentFishViewAmount--;
|
||||
// }
|
||||
// }
|
||||
yield break;
|
||||
}
|
||||
|
||||
private bool ProbeDeepToTerenBottom(Vector3 probeObject)
|
||||
{
|
||||
int layerMask = LayerMask.GetMask("Terrain") | LayerMask.GetMask("UnderwaterObject");
|
||||
if (Physics.Raycast(probeObject, -Vector3.up, out var _, float.PositiveInfinity, layerMask))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private float ProbeDeepToTerenFromWater(Vector3 probeObject)
|
||||
{
|
||||
probeObject.y = 0f;
|
||||
int layerMask = LayerMask.GetMask("Terrain") | LayerMask.GetMask("UnderwaterObject");
|
||||
if (Physics.Raycast(probeObject, -Vector3.up, out var hitInfo, float.PositiveInfinity, layerMask))
|
||||
{
|
||||
return hitInfo.distance;
|
||||
}
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public void AddInwaterObject(FWaterDisplacement wIobj)
|
||||
{
|
||||
if (!inwaterObjects.Contains(wIobj))
|
||||
{
|
||||
inwaterObjects.Add(wIobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteInwaterObject(FWaterDisplacement wIobj)
|
||||
{
|
||||
if (inwaterObjects.Contains(wIobj))
|
||||
{
|
||||
inwaterObjects.Remove(wIobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddInwaterFishObject(FFish wIobj)
|
||||
{
|
||||
if (!inwaterFishObjects.Contains(wIobj))
|
||||
{
|
||||
inwaterFishObjects.Add(wIobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteInwaterFishObject(FFish wIobj)
|
||||
{
|
||||
if (inwaterFishObjects.Contains(wIobj))
|
||||
{
|
||||
inwaterFishObjects.Remove(wIobj);
|
||||
}
|
||||
|
||||
RemoveFishFromCurrentHook(wIobj);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78d24bf91a0247faa2e24ec050100161
|
||||
timeCreated: 1742313889
|
||||
@@ -1,160 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using NBF;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishFeedingZone : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class FishPopulation
|
||||
{
|
||||
public FishSpecies FishSpecies;
|
||||
|
||||
public int AmountPopulationZone = 1;
|
||||
|
||||
public Vector2 weightRange;
|
||||
}
|
||||
|
||||
public bool fishTakeTesting;
|
||||
|
||||
public int Inedex;
|
||||
|
||||
public int InedexOfGroup;
|
||||
|
||||
public float rangeZone = 5f;
|
||||
|
||||
public FishPopulation[] fishPopulation;
|
||||
|
||||
public List<FFish> fishesOnZone;
|
||||
|
||||
public FFishSystem fFishSystem;
|
||||
public Vector3 selfV3;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
fFishSystem = FindObjectOfType<FFishSystem>();
|
||||
fishesOnZone = new List<FFish>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!fFishSystem.isNewSpawnerSystem)
|
||||
{
|
||||
checkAndUpdateFishPopulation();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator GenerateOneFish(Vector3 startPos, FWaterDisplacement hookObject)
|
||||
{
|
||||
yield return null;
|
||||
if (fishPopulation.Length != 0)
|
||||
{
|
||||
int num = UnityEngine.Random.Range(0, fishPopulation.Length);
|
||||
float num2 = RandWeight(new Vector2(fishPopulation[num].weightRange.x, fishPopulation[num].weightRange.y));
|
||||
try
|
||||
{
|
||||
var path = GameFish.Get(t => t.speciesName == fishPopulation[num].FishSpecies).GetFishModel(num2);
|
||||
FFish component = Instantiate(path, SceneSettings.Instance.transform).GetComponent<FFish>();
|
||||
if (component == null)
|
||||
{
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
component.fFishSystem = fFishSystem;
|
||||
component.fishWeight = num2;
|
||||
component.fishSpecies = fishPopulation[num].FishSpecies;
|
||||
component.transform.localScale = GameFish.Get(t => t.speciesName == fishPopulation[num].FishSpecies)
|
||||
.GetFishScale(num2);
|
||||
component.transform.position = startPos;
|
||||
component.currentFeedingZone = this;
|
||||
fishesOnZone.Add(component);
|
||||
component.EnableFish();
|
||||
fFishSystem.inwaterFishObjectsSpawner.Add(component);
|
||||
if ((bool)hookObject)
|
||||
{
|
||||
hookObject.fishListCreated.Add(component);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator GenerateFishPopulationOnStart()
|
||||
{
|
||||
yield return null;
|
||||
for (int i = 0; i < fishPopulation.Length; i++)
|
||||
{
|
||||
for (int j = 0; j < fishPopulation[i].AmountPopulationZone; j++)
|
||||
{
|
||||
Vector3 position = transform.position + UnityEngine.Random.insideUnitSphere * rangeZone;
|
||||
position.y = transform.position.y - 0.2f;
|
||||
float num = RandWeight(new Vector2(fishPopulation[i].weightRange.x, fishPopulation[i].weightRange.y));
|
||||
FFish component = Instantiate(
|
||||
GameFish.Get(t => t.speciesName == fishPopulation[i].FishSpecies).GetFishModel(num),
|
||||
SceneSettings.Instance.transform).GetComponent<FFish>();
|
||||
component.fFishSystem = fFishSystem;
|
||||
component.fishWeight = num;
|
||||
component.fishSpecies = fishPopulation[i].FishSpecies;
|
||||
component.transform.localScale = GameFish.Get(t => t.speciesName == fishPopulation[i].FishSpecies)
|
||||
.GetFishScale(num);
|
||||
component.transform.position = position;
|
||||
component.currentFeedingZone = this;
|
||||
fishesOnZone.Add(component);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndUpdateFishPopulation()
|
||||
{
|
||||
for (int i = 0; i < fishesOnZone.Count; i++)
|
||||
{
|
||||
if (fishesOnZone[i] == null)
|
||||
{
|
||||
int num = UnityEngine.Random.Range(0, fishPopulation.Length - 1);
|
||||
if (fishPopulation[num].AmountPopulationZone > fishesOnZone.Count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Vector3 position = transform.position + UnityEngine.Random.insideUnitSphere * 1f;
|
||||
position.y = transform.position.y - 0.2f;
|
||||
float num2 =
|
||||
RandWeight(new Vector2(fishPopulation[num].weightRange.x, fishPopulation[num].weightRange.y));
|
||||
FFish component = Instantiate(
|
||||
GameFish.Get(t => t.speciesName == fishPopulation[num].FishSpecies).GetFishModel(num2),
|
||||
SceneSettings.Instance.transform).GetComponent<FFish>();
|
||||
component.fFishSystem = fFishSystem;
|
||||
component.fishWeight = num2;
|
||||
component.fishSpecies = fishPopulation[num].FishSpecies;
|
||||
component.transform.localScale = GameFish.Get(t => t.speciesName == fishPopulation[num].FishSpecies)
|
||||
.GetFishScale(num2);
|
||||
component.transform.position = position;
|
||||
component.currentFeedingZone = this;
|
||||
fishesOnZone[i] = component;
|
||||
Debug.Log("Replace fish " + component.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float RandWeight(Vector2 range)
|
||||
{
|
||||
float result = range.x;
|
||||
for (int i = 0; (float)i < 10f; i++)
|
||||
{
|
||||
result = UnityEngine.Random.Range(range.x, range.y);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
Gizmos.DrawWireSphere(transform.position, rangeZone);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cb732c064e54c6aa1fbbf8fa94fa7dd
|
||||
timeCreated: 1742313898
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InteractiveObject : MonoBehaviour
|
||||
{
|
||||
[Header("交互类型")] public UIDef.InteractiveType Type;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa29ad8321da4a29a6fb475e9e97f87e
|
||||
timeCreated: 1747577976
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2d7a4d07d944c37b715cd95b63b9868
|
||||
timeCreated: 1742567918
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a18bd4a09c14040b9ea1de796d645f1
|
||||
timeCreated: 1743783137
|
||||
@@ -1,12 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 鱼饵
|
||||
/// </summary>
|
||||
public class BaitAsset : PreviewableAsset
|
||||
{
|
||||
public Transform hook;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 524c26f472e74fa1ad167db68e562324
|
||||
timeCreated: 1743824319
|
||||
@@ -1,80 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 浮漂资产
|
||||
/// </summary>
|
||||
public class BobberAsset : PreviewableAsset
|
||||
{
|
||||
public Transform body;
|
||||
public Transform stick;
|
||||
|
||||
/// <summary>
|
||||
/// 顶部连接点
|
||||
/// </summary>
|
||||
public Transform topConnector;
|
||||
|
||||
/// <summary>
|
||||
/// 底部连接点
|
||||
/// </summary>
|
||||
public Transform bottomConnector;
|
||||
|
||||
/// <summary>
|
||||
/// 水线
|
||||
/// </summary>
|
||||
public Transform waterline;
|
||||
|
||||
|
||||
// "previewRotationEnabled": 0,
|
||||
// "previewRotation": {
|
||||
// "x": 0.0,
|
||||
// "y": 0.0,
|
||||
// "z": 0.0
|
||||
// },
|
||||
//
|
||||
// "idleAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 2768973905596830902
|
||||
// },
|
||||
// "swimAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 7205922588037503814
|
||||
// },
|
||||
// "accelerateAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 5473833867069321029
|
||||
// },
|
||||
// "turnLeftAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// },
|
||||
// "turnRightAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// },
|
||||
// "shake1Animation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 748440419864685152
|
||||
// },
|
||||
// "shake2Animation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 748440419864685152
|
||||
// },
|
||||
// "shake3Animation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 748440419864685152
|
||||
// },
|
||||
// "StuffedAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// },
|
||||
// "useRendererBounds": 0,
|
||||
// "overrideLengthAxis": 0,
|
||||
// "lengthAxis": 0,
|
||||
// "applyLengthFactor": 0,
|
||||
// "lengthFactor": 0.0,
|
||||
// "useStuffedAnim": 0,
|
||||
// "stuffedFrameTime": 0.0
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e885da772834bb289c2368be2f6eb5b
|
||||
timeCreated: 1743824616
|
||||
@@ -1,14 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FishAsset : PreviewableAsset
|
||||
{
|
||||
public Transform root;
|
||||
|
||||
/// <summary>
|
||||
/// 弯曲节点
|
||||
/// </summary>
|
||||
public Transform[] spines;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c12ba26d0bd74238ab26aee49ef6fd5d
|
||||
timeCreated: 1743824172
|
||||
@@ -1,18 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FishGroupAsset : MonoBehaviour
|
||||
{
|
||||
// "previewRotationEnabled": 0,
|
||||
// "previewRotation": {
|
||||
// "x": 0.0,
|
||||
// "y": 0.0,
|
||||
// "z": 0.0
|
||||
// },
|
||||
// "previewFitVertical": 1,
|
||||
// "smallFishName": "ostrea_ed_o",
|
||||
// "mediumFishName": "ostrea_ed_o",
|
||||
// "largeFishName": "ostrea_ed_o"
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e9e67584f094dcbba9e61f37a55a5b4
|
||||
timeCreated: 1743824179
|
||||
@@ -1,12 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class HookAsset : PreviewableAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 鱼饵挂点
|
||||
/// </summary>
|
||||
public Transform baitConnector;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6eea50c041f42d5bd95d9e56c3a9c6f
|
||||
timeCreated: 1743824134
|
||||
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class LineAsset : PreviewableAsset
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8059c6be171e47edb0390fa091285100
|
||||
timeCreated: 1743824214
|
||||
@@ -1,20 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class LureAsset : PreviewableAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 鱼钩挂点
|
||||
/// </summary>
|
||||
public Transform[] hookPoints;
|
||||
|
||||
[Tooltip("maksymalny kąt odchylenia przynetu przy sciaganiu, rotacja w osi Y")]
|
||||
public float rotateVeloMaxAngle = 10f;
|
||||
|
||||
[Tooltip("predkosc odchylenia przynetu przy sciaganiu, rotacja w osi Y")]
|
||||
public float rotateVeloMaxSpeed = 3f;
|
||||
|
||||
public Vector3 rotationInFishJaw = Vector3.zero;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 897c0165284148879a9d158ea8010a15
|
||||
timeCreated: 1743824269
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 可以3D预览的资产
|
||||
/// </summary>
|
||||
public class PreviewableAsset : MonoBehaviour
|
||||
{
|
||||
[Tooltip("默认位置")] public Vector3 position;
|
||||
[Tooltip("默认旋转")] public Vector3 rotation;
|
||||
[Tooltip("默认形变")] public Vector3 scale;
|
||||
[Tooltip("是否可以放大缩小")] public bool canZoom;
|
||||
[Tooltip("放大缩小配置")] public Vector3 zoom;
|
||||
[Tooltip("是否可以平移")] public bool canPan;
|
||||
[Tooltip("平移配置")] public Rect pan;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a000ba87cd97499eb23feecf39521ecb
|
||||
timeCreated: 1750736840
|
||||
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PropAsset : PreviewableAsset
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea4d172189e248949431bb24b98369cb
|
||||
timeCreated: 1743824159
|
||||
@@ -1,113 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 线轴资产配置
|
||||
/// </summary>
|
||||
public class ReelAsset : PreviewableAsset
|
||||
{
|
||||
// "previewRotationEnabled": 1,
|
||||
// "previewRotation": {
|
||||
// "x": 20.0,
|
||||
// "y": -130.0,
|
||||
// "z": 190.0
|
||||
// },
|
||||
// "reelType": 3,
|
||||
// "reelSize": 11,
|
||||
// "minLineMeshScale": 0.93,
|
||||
// "maxLineMeshScale": 2.0,
|
||||
// "scaleX": 0,
|
||||
// "scaleY": 1,
|
||||
// "scaleZ": 1,
|
||||
// "rollHandleAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 5949981527590265242
|
||||
// },
|
||||
// "rollUkladchikAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 8960665928823962917
|
||||
// },
|
||||
// "rollShpulyaAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": -8671758223453786131
|
||||
// },
|
||||
// "frictionAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// },
|
||||
// "openAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": -2998254598457423134
|
||||
// },
|
||||
// "closeAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": -56605426968450186
|
||||
// },
|
||||
// "startEngineAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// },
|
||||
// "stopEngineAnimation": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// },
|
||||
// "handleAnimationLoopCycles": 6,
|
||||
// "ikLocatorFixEnabled": 0,
|
||||
// "ikLocatorFixRotation": {
|
||||
// "x": 0.0,
|
||||
// "y": 0.0,
|
||||
// "z": 0.0
|
||||
// },
|
||||
// "shiftRod": 0.0,
|
||||
// "materialWithSerial": {
|
||||
// "m_FileID": 0,
|
||||
// "m_PathID": 0
|
||||
// }
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Normal = 0,
|
||||
Casting = 1
|
||||
}
|
||||
|
||||
public Type type;
|
||||
|
||||
/// <summary>
|
||||
/// 动画组件
|
||||
/// </summary>
|
||||
public Animator animator;
|
||||
|
||||
/// <summary>
|
||||
/// 根连接处
|
||||
/// </summary>
|
||||
public Transform rootConnector;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public Transform rootCompensator;
|
||||
|
||||
/// <summary>
|
||||
/// 线连接处
|
||||
/// </summary>
|
||||
public Transform lineConnector;
|
||||
|
||||
/// <summary>
|
||||
/// 线相交处
|
||||
/// </summary>
|
||||
public Transform lineIntersect;
|
||||
|
||||
public Transform lineIntersectHelper;
|
||||
|
||||
/// <summary>
|
||||
/// ik抓握挂点
|
||||
/// </summary>
|
||||
public Transform handle;
|
||||
|
||||
/// <summary>
|
||||
/// 手柄真实结束点
|
||||
/// </summary>
|
||||
public Transform handleEnd;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8898b66b55404fd3be13b7dcdcfda463
|
||||
timeCreated: 1743785540
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 鱼竿资产配置
|
||||
/// </summary>
|
||||
public class RodAsset : PreviewableAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 根节点
|
||||
/// </summary>
|
||||
public Transform root;
|
||||
|
||||
public Transform gripEnd;
|
||||
|
||||
/// <summary>
|
||||
/// 左手连接点
|
||||
/// </summary>
|
||||
public Transform LeftHandConnector;
|
||||
|
||||
/// <summary>
|
||||
/// 右手连接点
|
||||
/// </summary>
|
||||
public Transform RightHandConnector;
|
||||
|
||||
/// <summary>
|
||||
/// 线轴连接点
|
||||
/// </summary>
|
||||
public Transform ReelConnector;
|
||||
|
||||
/// <summary>
|
||||
/// 弯曲节点
|
||||
/// </summary>
|
||||
public Transform[] joints;
|
||||
|
||||
/// <summary>
|
||||
/// 圈挂点
|
||||
/// </summary>
|
||||
public Transform[] rings;
|
||||
|
||||
/// <summary>
|
||||
/// rings 画线
|
||||
/// </summary>
|
||||
public LineRenderer lineRenderer;
|
||||
|
||||
/// <summary>
|
||||
/// 鱼线连接点
|
||||
/// </summary>
|
||||
public Transform lineConnector;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (!lineConnector && joints.Length > 0)
|
||||
{
|
||||
lineConnector = joints[^1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45b047324a3349b9aea42f50cbd1ba71
|
||||
timeCreated: 1743783252
|
||||
@@ -1,29 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 鱼竿导环资产配置
|
||||
/// </summary>
|
||||
public class RodRingAsset : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 导环节点
|
||||
/// </summary>
|
||||
public RodRingNode[] rings;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class RodRingNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 导环点位
|
||||
/// </summary>
|
||||
public Transform ring;
|
||||
|
||||
/// <summary>
|
||||
/// 线挂点
|
||||
/// </summary>
|
||||
public Transform point;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdfd33eb69534a1e87cd523df4bfb430
|
||||
timeCreated: 1743781816
|
||||
@@ -1,8 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class SpinnerLureAsset : PreviewableAsset
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed88dcaac7774ce79b04d90a3fa50533
|
||||
timeCreated: 1745487261
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a1247222af84a66be775a4fe0af9a57
|
||||
timeCreated: 1744041263
|
||||
@@ -1,199 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 钓鱼数据源基类
|
||||
/// </summary>
|
||||
public class FishingDatasource
|
||||
{
|
||||
public readonly Dictionary<int, FPlayerData> Players = new Dictionary<int, FPlayerData>();
|
||||
|
||||
public void Init()
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
var p = GetTestPlayer(i);
|
||||
AddPlayer(p);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddPlayer(FPlayerData player)
|
||||
{
|
||||
Players[player.PlayerID] = player;
|
||||
}
|
||||
|
||||
public FPlayerData GetPlayer(int playerID)
|
||||
{
|
||||
return Players.GetValueOrDefault(playerID);
|
||||
}
|
||||
|
||||
public FPlayerData GetSelfPlayer()
|
||||
{
|
||||
return GetPlayer(GameModel.RoleID);
|
||||
}
|
||||
|
||||
|
||||
#region 测试数据
|
||||
|
||||
public void SetSelfTestGear(int slot)
|
||||
{
|
||||
var player = GetSelfPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.currentGear = new FPlayerGearData();
|
||||
var gear = player.currentGear;
|
||||
|
||||
if (slot == 1)
|
||||
{
|
||||
player.lineLength = 3.6f;
|
||||
gear.Type = GearType.Pole;
|
||||
gear.rod = new FRodData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 100001,
|
||||
};
|
||||
gear.line = new FLineData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 400001
|
||||
};
|
||||
gear.bobber = new FBobberData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 300001
|
||||
};
|
||||
gear.hook = new FHookData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 700001
|
||||
};
|
||||
gear.bait = new FBaitData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 500002
|
||||
};
|
||||
gear.weight = new FWeightData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 800001
|
||||
};
|
||||
gear.reel = null;
|
||||
}
|
||||
else if (slot == 2)
|
||||
{
|
||||
player.lineLength = 0.4f;
|
||||
gear.Type = GearType.SpinningFloat;
|
||||
gear.rod = new FRodData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 100002
|
||||
};
|
||||
gear.reel = new FReelData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 200001
|
||||
};
|
||||
gear.line = new FLineData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 400001
|
||||
};
|
||||
gear.bait = new FBaitData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 500002
|
||||
};
|
||||
gear.bobber = new FBobberData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 300001
|
||||
};
|
||||
gear.hook = new FHookData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 700001
|
||||
};
|
||||
gear.weight = new FWeightData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 800001
|
||||
};
|
||||
}
|
||||
else if (slot == 3)
|
||||
{
|
||||
player.lineLength = 0.4f;
|
||||
gear.Type = GearType.Spinning;
|
||||
gear.bobber = null;
|
||||
gear.rod = new FRodData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 100003,
|
||||
};
|
||||
gear.reel = new FReelData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 200001
|
||||
};
|
||||
gear.line = new FLineData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 400001
|
||||
};
|
||||
gear.leader = new FLeaderData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 0
|
||||
};
|
||||
gear.lure = new FLureData()
|
||||
{
|
||||
id = Random.Range(1, 100000),
|
||||
configId = 600001
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FPlayerData GetTestPlayer(int index)
|
||||
{
|
||||
FPlayerData player = new FPlayerData
|
||||
{
|
||||
PlayerID = 100 + index
|
||||
};
|
||||
|
||||
var add = 0;//Random.Range(0, 5f) + index * 0.5f;
|
||||
|
||||
player.position = new Vector3(325.04f + add, 11, 606.28f);
|
||||
player.rotation = quaternion.identity;
|
||||
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
player.currentGear = new FPlayerGearData();
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
}
|
||||
else if (index == 2)
|
||||
{
|
||||
player.currentGear = new FPlayerGearData();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
return player;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b5a6200eb494c0ea9cb0bbe8345046c
|
||||
timeCreated: 1744041274
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03e80f6925b44b3dbfd52a46c766b08b
|
||||
timeCreated: 1744116926
|
||||
@@ -1,121 +0,0 @@
|
||||
using System;
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FishingPlay
|
||||
{
|
||||
public FishingDatasource Data { get; private set; }
|
||||
|
||||
public FishingPlay(FishingDatasource datasource)
|
||||
{
|
||||
Data = datasource;
|
||||
}
|
||||
|
||||
public FPlayer SelfPlayer;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
// FishingData = fishingData;
|
||||
LoadLevel();
|
||||
}
|
||||
|
||||
#region Loading UnLoading
|
||||
|
||||
private SequenceTaskCollection _battleLoadingTasks;
|
||||
|
||||
private SequenceTaskCollection _battleUnLoadingTasks;
|
||||
|
||||
protected void ClearLoadingTasks()
|
||||
{
|
||||
if (_battleLoadingTasks == null) return;
|
||||
_battleLoadingTasks.Stop();
|
||||
_battleLoadingTasks.Clear();
|
||||
_battleLoadingTasks = null;
|
||||
}
|
||||
|
||||
protected void ClearUnLoadingTasks()
|
||||
{
|
||||
if (_battleUnLoadingTasks == null) return;
|
||||
_battleUnLoadingTasks.Stop();
|
||||
_battleUnLoadingTasks.Clear();
|
||||
_battleUnLoadingTasks = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Load and Unload
|
||||
|
||||
protected void LoadLevel()
|
||||
{
|
||||
_battleLoadingTasks = new SequenceTaskCollection();
|
||||
_battleLoadingTasks.AddTask(LoadBattleTask());
|
||||
_battleLoadingTasks.AddTask(LoadObjects());
|
||||
_battleLoadingTasks.OnCompleted(_ => { OnLoadBattleDone(); });
|
||||
Loading.Show(_battleLoadingTasks);
|
||||
_battleLoadingTasks.Run(DefRunner.Scheduler);
|
||||
}
|
||||
|
||||
public void UnLoadLevel(Action callback)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载场景需要资源
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private ParallelTaskCollection LoadBattleTask()
|
||||
{
|
||||
ParallelTaskCollection subTask1 = new();
|
||||
subTask1.AddTask(new LoadSceneTask("Map4"));
|
||||
|
||||
return subTask1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载实例化场景对象
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private ParallelTaskCollection LoadObjects()
|
||||
{
|
||||
ParallelTaskCollection subTask1 = new();
|
||||
subTask1.AddTask(new InitPlayersTask(this));
|
||||
subTask1.AddTask(new RunFunTask(AddCameraStack));
|
||||
subTask1.AddTask(new RunFunTask(FindSceneObjects));
|
||||
return subTask1;
|
||||
}
|
||||
|
||||
private void FindSceneObjects()
|
||||
{
|
||||
// WaterObject = GameObject.FindWithTag("Water").transform;
|
||||
}
|
||||
|
||||
private void AddCameraStack()
|
||||
{
|
||||
// MainPlayer.m_Camera.AddStack(StageCamera.main);
|
||||
}
|
||||
|
||||
private void RemoveCameraStack()
|
||||
{
|
||||
// MainPlayer.m_Camera.RemoveStack(StageCamera.main);
|
||||
}
|
||||
|
||||
private void OnLoadBattleDone()
|
||||
{
|
||||
Debug.LogError("加载关卡结束===");
|
||||
FishingPanel.Show();
|
||||
|
||||
|
||||
// BaseCamera.AddStack(StageCamera.main);
|
||||
Loading.Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce4368f9da864c3fb9ff7ebe7322fec6
|
||||
timeCreated: 1742567951
|
||||
@@ -1,78 +0,0 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class Fishing
|
||||
{
|
||||
Fishing()
|
||||
{
|
||||
App.OnUpdate += Update;
|
||||
}
|
||||
|
||||
private static Fishing _inst;
|
||||
|
||||
public static Fishing Inst => _inst ??= new Fishing();
|
||||
|
||||
public int Map { get; private set; }
|
||||
|
||||
|
||||
public FishingPlay Player { get; private set; }
|
||||
|
||||
public FishingDatasource Datasource { get; private set; }
|
||||
|
||||
public void Go(int map)
|
||||
{
|
||||
Map = map;
|
||||
EnterMap();
|
||||
}
|
||||
|
||||
#region Load
|
||||
|
||||
private void EnterMap()
|
||||
{
|
||||
EnterDone();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
Datasource?.Update();
|
||||
Player?.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入地图成功
|
||||
/// </summary>
|
||||
private void EnterDone()
|
||||
{
|
||||
DataInit();
|
||||
PlayerInit();
|
||||
}
|
||||
|
||||
private void DataInit()
|
||||
{
|
||||
Datasource = new FishingDatasource();
|
||||
Datasource.Init();
|
||||
}
|
||||
|
||||
private void PlayerInit()
|
||||
{
|
||||
if (Player != null)
|
||||
{
|
||||
Player.UnLoadLevel(NewBattlePlayInit);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewBattlePlayInit();
|
||||
}
|
||||
}
|
||||
|
||||
private void NewBattlePlayInit()
|
||||
{
|
||||
Player = new FishingPlay(Datasource);
|
||||
Player.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 158a88fb17104b1fa7818e84197d4eee
|
||||
timeCreated: 1742567921
|
||||
@@ -1,58 +0,0 @@
|
||||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerArm : MonoBehaviour
|
||||
{
|
||||
public bool IsLeft;
|
||||
public LimbIK IK;
|
||||
public Transform RodContainer;
|
||||
public Transform LeftRigMagnet;
|
||||
public FingerRig FingerRig;
|
||||
public PlayerShoulder Shoulder;//PlayerShoulder
|
||||
|
||||
[HideInInspector] public float interactionTargetWeight;
|
||||
|
||||
|
||||
public void SetReelHandle(ReelAsset asset)
|
||||
{
|
||||
IK.solver.target = asset.handle;
|
||||
IK.enabled = true;
|
||||
|
||||
// var fingers = FingerRig.fingers;
|
||||
// foreach (var finger in fingers)
|
||||
// {
|
||||
// finger.target = asset.handleEnd;
|
||||
// }
|
||||
|
||||
// // 启用整体控制
|
||||
// FingerRig.weight = 1f;
|
||||
//
|
||||
// // 绑定大拇指和食指的目标
|
||||
// FingerRig.fingers[0].target = asset.handleEnd; // Thumb
|
||||
// FingerRig.fingers[1].target = asset.handleEnd; // Index
|
||||
//
|
||||
// FingerRig.fingers[0].weight = 1f;
|
||||
// FingerRig.fingers[1].weight = 1f;
|
||||
|
||||
// 其余手指握拳(不绑定 target)
|
||||
for (int i = 2; i < 5; i++)
|
||||
{
|
||||
FingerRig.fingers[i].target = null;
|
||||
FingerRig.fingers[i].weight = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTowardsInteraction()
|
||||
{
|
||||
if (!IK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IK.solver.SetIKPositionWeight(Mathf.MoveTowards(IK.solver.IKPositionWeight,
|
||||
interactionTargetWeight, Time.deltaTime * 2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99467c6c370b440d8bdb517bbbcf22cf
|
||||
timeCreated: 1743435628
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class PlayerShoulder : MonoBehaviour
|
||||
{
|
||||
private Vector3 startEulerAngles;
|
||||
private const int MaxAngle = 30;
|
||||
private const int MinAngle = -30;
|
||||
|
||||
|
||||
public float TestZ;
|
||||
private void Awake()
|
||||
{
|
||||
startEulerAngles = transform.localEulerAngles;
|
||||
}
|
||||
|
||||
public void SetCameraEulerAngleX(float value)
|
||||
{
|
||||
value = (value > 180f) ? value - 360f : value;
|
||||
Debug.Log($"value={value}");
|
||||
var addValue = value * -1;
|
||||
if (addValue > MaxAngle)
|
||||
{
|
||||
addValue = MaxAngle;
|
||||
}
|
||||
else if (addValue < MinAngle)
|
||||
{
|
||||
addValue = MinAngle;
|
||||
}
|
||||
|
||||
transform.localEulerAngles =
|
||||
new Vector3(addValue + startEulerAngles.x, startEulerAngles.y, TestZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d621debd7244988afb98b7c06605f63
|
||||
timeCreated: 1747228668
|
||||
@@ -1,9 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class SceneNode : MonoBehaviour
|
||||
{
|
||||
public int index = 0;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 646e0006924a42ba9fbadd56984a61d1
|
||||
timeCreated: 1744120018
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 763c0b906611497b9c6451178fcf3ddf
|
||||
timeCreated: 1742644058
|
||||
@@ -1,12 +0,0 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class EnterMapRoomTask : NTask
|
||||
{
|
||||
protected override void OnStart()
|
||||
{
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aed100679224409eb9fe972ab68dfaa4
|
||||
timeCreated: 1744041480
|
||||
@@ -1,63 +0,0 @@
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InitPlayersTask : NTask
|
||||
{
|
||||
private ParallelTaskCollection _parallelTaskCollection = new ParallelTaskCollection();
|
||||
private FishingPlay _fishingPlay;
|
||||
|
||||
public InitPlayersTask(FishingPlay fishingPlay)
|
||||
{
|
||||
_fishingPlay = fishingPlay;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
_parallelTaskCollection.ParallelNum = 2;
|
||||
|
||||
var players = _fishingPlay.Data.Players.Values;
|
||||
|
||||
foreach (var player in players)
|
||||
{
|
||||
_parallelTaskCollection.AddTask(new InitPlayerTask(_fishingPlay, player));
|
||||
}
|
||||
|
||||
_parallelTaskCollection.OnCompleted(LoadDone);
|
||||
_parallelTaskCollection.Run(DefRunner.Scheduler);
|
||||
|
||||
// var player = Object.FindFirstObjectByType<FPlayer>();
|
||||
// _fishingPlay.MainPlayer = player;
|
||||
// Finish();
|
||||
}
|
||||
|
||||
private void LoadDone(ITask task)
|
||||
{
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
|
||||
public class InitPlayerTask : NTask
|
||||
{
|
||||
private FishingPlay _fishingPlay;
|
||||
|
||||
private FPlayerData _playerData;
|
||||
|
||||
public InitPlayerTask(FishingPlay fishingPlay, FPlayerData playerData)
|
||||
{
|
||||
_fishingPlay = fishingPlay;
|
||||
_playerData = playerData;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
var model = Resources.Load<GameObject>("Prefabs/Player/male");
|
||||
var playerObject = Object.Instantiate(model, SceneSettings.Instance.Node);
|
||||
var player = playerObject.GetComponent<FPlayer>();
|
||||
player.InitData(_playerData);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e21c997927494f67a63ea624a92aee36
|
||||
timeCreated: 1742644061
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d76792b34ac4ab3a90df08baa109590
|
||||
timeCreated: 1742387763
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18d7c6328d5d4b6ea508b7b6d05d8a31
|
||||
timeCreated: 1746449694
|
||||
@@ -1,17 +0,0 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 浮漂
|
||||
/// </summary>
|
||||
public class BobThrowAnim : NTask
|
||||
{
|
||||
private FPlayer _player;
|
||||
|
||||
public BobThrowAnim(FPlayer player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e061352cd04e482090828b12acb7920f
|
||||
timeCreated: 1746449734
|
||||
@@ -1,312 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[System.Serializable]
|
||||
public struct FishingLureCastInput
|
||||
{
|
||||
[Range(0, 1)] public float power;
|
||||
[Range(0, 50)] public float windStrength; // 单位 m/s
|
||||
public Vector3 windDirection;
|
||||
[Range(5, 30)] public float lureWeight; // 单位 g
|
||||
[Range(0.1f, 1f)] public float lineDiameter; // 单位:毫米,0.1mm ~ 1mm
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 路亚抛竿轨迹动画
|
||||
/// </summary>
|
||||
public class LureThrowAnim : NTask
|
||||
{
|
||||
private FPlayer _player;
|
||||
|
||||
[Header("基础参数")] public int maxSimulationSteps = 1000;
|
||||
public float simulationDuration = 10f;
|
||||
public float timeStep = 0.02f;
|
||||
|
||||
[Header("抛投力度")] public float minThrowPower = 15f;
|
||||
public float maxThrowPower = 45f;
|
||||
|
||||
[Header("空气阻力参数")] [Tooltip("阻力系数,非流线钓饵建议 0.8~1.2")]
|
||||
public float dragCoefficient = 0.2f;
|
||||
|
||||
[Tooltip("迎风面积,0.005m² ≈ 5cm²")] public float lureArea = 0.001f;
|
||||
|
||||
|
||||
private FWaterDisplacement _lureHookWaterDisplacement;
|
||||
|
||||
private List<Vector3> _trajectory;
|
||||
|
||||
public float totalDuration = 1.5f; // 总飞行时间
|
||||
public float arriveThreshold = 0.01f;
|
||||
|
||||
private float elapsedTime = 0f;
|
||||
private bool isMoving = false;
|
||||
private Vector3 startOffset = Vector3.zero;
|
||||
|
||||
private Transform _transform;
|
||||
|
||||
public float CurrentDistanceTraveled { get; private set; } = 0f;
|
||||
|
||||
private float _throwStartLineLenght = 0f;
|
||||
|
||||
|
||||
public LureThrowAnim(FPlayer player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
_throwStartLineLenght = _player.Data.lineLength;
|
||||
_lureHookWaterDisplacement = _player.Gears.Rod.LureHookWaterDisplacement;
|
||||
float angle = 25f;
|
||||
float radians = angle * Mathf.Deg2Rad;
|
||||
Vector3 forwardUp = _player.transform.forward * Mathf.Cos(radians) +
|
||||
_player.transform.up * Mathf.Sin(radians);
|
||||
// // 施加力
|
||||
// lureHookWaterDisplacement.rigidbody.AddForce(forwardUpDirection * 500, ForceMode.Impulse);
|
||||
_transform = _lureHookWaterDisplacement.transform;
|
||||
_lureHookWaterDisplacement.rigidbody.isKinematic = true;
|
||||
_lureHookWaterDisplacement.rigidbody.useGravity = false;
|
||||
FishingLureCastInput baseInput = new FishingLureCastInput
|
||||
{
|
||||
power = 1f,
|
||||
lureWeight = 2.2f,
|
||||
windStrength = 0f, // 风力大小
|
||||
lineDiameter = 0.14f
|
||||
};
|
||||
|
||||
Vector3 startPos = _player.transform.position + Vector3.up * 2.5f;
|
||||
// Vector3 startPos = _player.Gears.Rod.rodAsset.lineConnector.position;
|
||||
Vector3 throwDir = forwardUp.normalized;
|
||||
var trajectory = CalculateTrajectory(baseInput, startPos, throwDir);
|
||||
_trajectory = trajectory;
|
||||
_trajectory = SimplifyTrajectoryRDP(trajectory, 0.1f);
|
||||
// SceneSettings.Instance.LineRenderer.startWidth = 0.1f;
|
||||
// SceneSettings.Instance.LineRenderer.endWidth = 0.1f;
|
||||
// SceneSettings.Instance.LineRenderer.positionCount = _trajectory.Count;
|
||||
// SceneSettings.Instance.LineRenderer.useWorldSpace = true;
|
||||
// SceneSettings.Instance.LineRenderer.SetPositions(_trajectory.ToArray());
|
||||
|
||||
elapsedTime = 0f;
|
||||
isMoving = true;
|
||||
CurrentDistanceTraveled = 0f;
|
||||
|
||||
// 如果不在起点,先移动过去
|
||||
if ((_transform.position - _trajectory[0]).magnitude > arriveThreshold)
|
||||
{
|
||||
startOffset = _trajectory[0] - _transform.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
startOffset = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
protected override NTaskStatus OnProcess()
|
||||
{
|
||||
OnMove();
|
||||
return base.OnProcess();
|
||||
}
|
||||
|
||||
|
||||
private void MoveDone()
|
||||
{
|
||||
var rb = _lureHookWaterDisplacement.rigidbody;
|
||||
|
||||
// 强制同步位置和朝向
|
||||
rb.position = rb.transform.position;
|
||||
rb.rotation = rb.transform.rotation;
|
||||
rb.isKinematic = false;
|
||||
// 停止物理残留影响
|
||||
rb.linearVelocity = Vector3.zero;
|
||||
rb.angularVelocity = Vector3.zero;
|
||||
rb.useGravity = true;
|
||||
Finish();
|
||||
}
|
||||
|
||||
private void OnMove()
|
||||
{
|
||||
if (!isMoving || _trajectory == null || _trajectory.Count < 2) return;
|
||||
// Debug.LogError("OnMove");
|
||||
// 初始补位阶段(瞬移或平滑补过去)
|
||||
if (startOffset.magnitude > arriveThreshold)
|
||||
{
|
||||
float moveSpeed = startOffset.magnitude / 0.1f;
|
||||
Vector3 move = startOffset.normalized * moveSpeed * Time.deltaTime;
|
||||
if (move.magnitude >= startOffset.magnitude)
|
||||
{
|
||||
_transform.position = _trajectory[0];
|
||||
startOffset = Vector3.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
_transform.position += move;
|
||||
startOffset -= move;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
elapsedTime += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsedTime / totalDuration);
|
||||
|
||||
// 插值路径
|
||||
int segmentCount = _trajectory.Count - 1;
|
||||
float totalSegmentLength = segmentCount;
|
||||
float pathT = t * totalSegmentLength;
|
||||
int index = Mathf.FloorToInt(pathT);
|
||||
|
||||
if (index >= _trajectory.Count - 1)
|
||||
{
|
||||
_transform.position = _trajectory[^1];
|
||||
isMoving = false;
|
||||
CurrentDistanceTraveled = CalculateTotalDistance(_trajectory);
|
||||
MoveDone();
|
||||
return;
|
||||
}
|
||||
|
||||
float localT = pathT - index;
|
||||
Vector3 p0 = _trajectory[index];
|
||||
Vector3 p1 = _trajectory[index + 1];
|
||||
_transform.position = Vector3.Lerp(p0, p1, localT);
|
||||
|
||||
var distance = Vector3.Distance(_lureHookWaterDisplacement.transform.position,
|
||||
_player.Gears.Rod.rodAsset.lineConnector.position);
|
||||
if (distance > _throwStartLineLenght)
|
||||
{
|
||||
_throwStartLineLenght = distance;
|
||||
_player.Data.lineLength = _throwStartLineLenght + 0.5f;
|
||||
}
|
||||
// _throwStartLineLenght
|
||||
}
|
||||
|
||||
float CalculateTotalDistance(List<Vector3> points)
|
||||
{
|
||||
float dist = 0f;
|
||||
for (int i = 1; i < points.Count; i++)
|
||||
dist += Vector3.Distance(points[i - 1], points[i]);
|
||||
return dist;
|
||||
}
|
||||
|
||||
public List<Vector3> CalculateTrajectory(FishingLureCastInput input, Vector3 startPosition,
|
||||
Vector3 castDirection)
|
||||
{
|
||||
List<Vector3> trajectory = new List<Vector3>();
|
||||
|
||||
Vector3 position = startPosition;
|
||||
Vector3 direction = castDirection.normalized;
|
||||
float throwPower = Mathf.Lerp(minThrowPower, maxThrowPower, input.power);
|
||||
Vector3 velocity = direction * throwPower;
|
||||
|
||||
float lureMass = input.lureWeight / 1000f; // 转 kg
|
||||
Vector3 windDir = input.windDirection.normalized;
|
||||
float windStrength = input.windStrength;
|
||||
|
||||
float currentTime = 0f;
|
||||
int steps = 0;
|
||||
totalDuration = 0;
|
||||
while (currentTime < simulationDuration && steps < maxSimulationSteps)
|
||||
{
|
||||
if (position.y <= 0f) break;
|
||||
|
||||
// 模拟风力逐渐生效
|
||||
float windInfluenceFactor = Mathf.Clamp01(currentTime / 1.5f); // 1.5秒内增长
|
||||
Vector3 windVelocity = windDir * windStrength * windInfluenceFactor;
|
||||
|
||||
// 真实空气阻力模型
|
||||
Vector3 relVelocity = velocity - windVelocity;
|
||||
|
||||
// 空气阻力
|
||||
float dragMag = 0.5f * PhysicsHelper.AirDensity *
|
||||
relVelocity.sqrMagnitude *
|
||||
dragCoefficient * lureArea;
|
||||
|
||||
// --- 钓线空气阻力模拟 ---
|
||||
// 假设飞行中展开的线长度近似为当前位置的XZ平面长度
|
||||
float lineLength = Vector3.Distance(new Vector3(position.x, 0, position.z),
|
||||
new Vector3(startPosition.x, 0, startPosition.z));
|
||||
float lineRadius = input.lineDiameter / 2000f; // mm转m再除以2得到半径
|
||||
|
||||
// 钓线的迎风面积估算:长度 * 直径
|
||||
float lineArea = lineLength * (lineRadius * 2f); // 近似为圆柱体侧面积的一部分
|
||||
|
||||
// 简化模型:线的附加空气阻力方向与当前速度方向相反
|
||||
float lineDragMag = 0.5f * PhysicsHelper.AirDensity * velocity.sqrMagnitude * dragCoefficient *
|
||||
lineArea;
|
||||
Vector3 lineDragForce = -velocity.normalized * lineDragMag;
|
||||
|
||||
|
||||
Vector3 dragForce = -relVelocity.normalized * dragMag;
|
||||
|
||||
// 合力 = 重力 + 空气阻力
|
||||
// Vector3 acceleration = (Physics.gravity + dragForce / lureMass);
|
||||
Vector3 totalForce = dragForce + lineDragForce;
|
||||
// 合力 = 重力 + 空气阻力 + 线阻力
|
||||
Vector3 acceleration = (Physics.gravity + totalForce / lureMass);
|
||||
|
||||
|
||||
velocity += acceleration * timeStep;
|
||||
position += velocity * timeStep;
|
||||
|
||||
trajectory.Add(position);
|
||||
currentTime += timeStep;
|
||||
steps++;
|
||||
}
|
||||
|
||||
totalDuration = currentTime;
|
||||
return trajectory;
|
||||
}
|
||||
|
||||
|
||||
public static List<Vector3> SimplifyTrajectoryRDP(List<Vector3> points, float tolerance)
|
||||
{
|
||||
if (points == null || points.Count < 3)
|
||||
return new List<Vector3>(points);
|
||||
|
||||
List<Vector3> result = new List<Vector3>();
|
||||
SimplifySection(points, 0, points.Count - 1, tolerance, result);
|
||||
result.Add(points[points.Count - 1]);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void SimplifySection(List<Vector3> points, int start, int end, float tolerance,
|
||||
List<Vector3> result)
|
||||
{
|
||||
if (end <= start + 1)
|
||||
return;
|
||||
|
||||
float maxDistance = -1f;
|
||||
int index = -1;
|
||||
Vector3 startPoint = points[start];
|
||||
Vector3 endPoint = points[end];
|
||||
|
||||
for (int i = start + 1; i < end; i++)
|
||||
{
|
||||
float distance = PerpendicularDistance(points[i], startPoint, endPoint);
|
||||
if (distance > maxDistance)
|
||||
{
|
||||
maxDistance = distance;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxDistance > tolerance)
|
||||
{
|
||||
SimplifySection(points, start, index, tolerance, result);
|
||||
result.Add(points[index]);
|
||||
SimplifySection(points, index, end, tolerance, result);
|
||||
}
|
||||
}
|
||||
|
||||
private static float PerpendicularDistance(Vector3 point, Vector3 lineStart, Vector3 lineEnd)
|
||||
{
|
||||
if (lineStart == lineEnd) return Vector3.Distance(point, lineStart);
|
||||
Vector3 projected = Vector3.Project(point - lineStart, lineEnd - lineStart);
|
||||
Vector3 closest = lineStart + projected;
|
||||
return Vector3.Distance(point, closest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1397324abdd458495e11ac971167bbc
|
||||
timeCreated: 1746449919
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f1c5daea61a4a4094251c75e92dc438
|
||||
timeCreated: 1745922726
|
||||
@@ -1,353 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public enum ThrowModeEnum : int
|
||||
{
|
||||
Spin = 0,
|
||||
Float = 1,
|
||||
}
|
||||
|
||||
public enum HandItemType
|
||||
{
|
||||
Default = 0,
|
||||
HandRod = 1,
|
||||
SpinRod = 2,
|
||||
}
|
||||
|
||||
public class PlayerAnimator : MonoBehaviour
|
||||
{
|
||||
#region 参数定义
|
||||
|
||||
private static readonly int StartThrowHash = Animator.StringToHash("startThrow");
|
||||
private static readonly int LureThrownHash = Animator.StringToHash("lureThrown");
|
||||
private static readonly int PrepareThrowHash = Animator.StringToHash("prepareThrow");
|
||||
private static readonly int LeftHandHash = Animator.StringToHash("leftHand");
|
||||
private static readonly int MoveSpeedHash = Animator.StringToHash("moveSpeed");
|
||||
private static readonly int BoatVelocityHash = Animator.StringToHash("boatVelocity");
|
||||
private static readonly int BoatDirHash = Animator.StringToHash("boatDir");
|
||||
private static readonly int BoatHash = Animator.StringToHash("boat");
|
||||
private static readonly int CastingHash = Animator.StringToHash("casting");
|
||||
private static readonly int TelestickHash = Animator.StringToHash("telestick");
|
||||
private static readonly int TelestickPullHash = Animator.StringToHash("telestick_pull");
|
||||
private static readonly int UseRodPodHash = Animator.StringToHash("use_rod_pod");
|
||||
private static readonly int ItemSourceHash = Animator.StringToHash("item_source");
|
||||
private static readonly int ItemDestHash = Animator.StringToHash("item_dest");
|
||||
private static readonly int RodReadyHash = Animator.StringToHash("rod_ready");
|
||||
private static readonly int HitchRecoverDirHash = Animator.StringToHash("hitchRecoverDir");
|
||||
private static readonly int HitchRecoverHash = Animator.StringToHash("hitchRecover");
|
||||
private static readonly int SitOrStandHash = Animator.StringToHash("sitOrStand");
|
||||
private static readonly int ShtekerHash = Animator.StringToHash("shteker");
|
||||
private static readonly int ItemInHandsHash = Animator.StringToHash("item_in_hands");
|
||||
private static readonly int ChangeItemHash = Animator.StringToHash("change_item");
|
||||
private static readonly int ItemTypeHash = Animator.StringToHash("item_type");
|
||||
private static readonly int ItemActionHash = Animator.StringToHash("item_action");
|
||||
private static readonly int ItemActionPowerHash = Animator.StringToHash("item_action_power");
|
||||
private static readonly int PodsakActionHash = Animator.StringToHash("podsak_action");
|
||||
private static readonly int FishingFinalHash = Animator.StringToHash("fishing_final");
|
||||
private static readonly int SpinOrTeleHash = Animator.StringToHash("spin_or_tele");
|
||||
private static readonly int TwitchHash = Animator.StringToHash("twitch");
|
||||
private static readonly int TwitchDirHash = Animator.StringToHash("twitch_dir");
|
||||
private static readonly int ThrowSpeedMultHash = Animator.StringToHash("throw_speed_mult");
|
||||
private static readonly int ConvTestHash = Animator.StringToHash("conv_test");
|
||||
private static readonly int BoatPoseHash = Animator.StringToHash("boat_pose");
|
||||
private static readonly int QuadDirectionHash = Animator.StringToHash("quad_direction");
|
||||
private static readonly int StretchMaxHash = Animator.StringToHash("stretch_max");
|
||||
private static readonly int ExamineItemHash = Animator.StringToHash("examine_item");
|
||||
private static readonly int TillerDirectionHash = Animator.StringToHash("tiller_direction");
|
||||
private static readonly int TestTriggerHash = Animator.StringToHash("test_trigger");
|
||||
private static readonly int ThrowModeHash = Animator.StringToHash("throw_mode");
|
||||
private static readonly int PullUpRodHash = Animator.StringToHash("pull_up_rod");
|
||||
|
||||
public bool StartThrow
|
||||
{
|
||||
get => animator.GetBool(StartThrowHash);
|
||||
set => animator.SetBool(StartThrowHash, value);
|
||||
}
|
||||
|
||||
public bool LureThrown
|
||||
{
|
||||
get => animator.GetBool(LureThrownHash);
|
||||
set => animator.SetBool(LureThrownHash, value);
|
||||
}
|
||||
|
||||
public bool PrepareThrow
|
||||
{
|
||||
get => animator.GetBool(PrepareThrowHash);
|
||||
set => animator.SetBool(PrepareThrowHash, value);
|
||||
}
|
||||
|
||||
public bool LeftHand
|
||||
{
|
||||
get => animator.GetBool(LeftHandHash);
|
||||
set => animator.SetBool(LeftHandHash, value);
|
||||
}
|
||||
|
||||
public float MoveSpeed
|
||||
{
|
||||
get => animator.GetFloat(MoveSpeedHash);
|
||||
set => animator.SetFloat(MoveSpeedHash, value);
|
||||
}
|
||||
|
||||
public float BoatVelocity
|
||||
{
|
||||
get => animator.GetFloat(BoatVelocityHash);
|
||||
set => animator.SetFloat(BoatVelocityHash, value);
|
||||
}
|
||||
|
||||
public float BoatDir
|
||||
{
|
||||
get => animator.GetFloat(BoatDirHash);
|
||||
set => animator.SetFloat(BoatDirHash, value);
|
||||
}
|
||||
|
||||
public bool Boat
|
||||
{
|
||||
get => animator.GetBool(BoatHash);
|
||||
set => animator.SetBool(BoatHash, value);
|
||||
}
|
||||
|
||||
public bool Casting
|
||||
{
|
||||
get => animator.GetBool(CastingHash);
|
||||
set => animator.SetBool(CastingHash, value);
|
||||
}
|
||||
|
||||
public bool Telestick
|
||||
{
|
||||
get => animator.GetBool(TelestickHash);
|
||||
set => animator.SetBool(TelestickHash, value);
|
||||
}
|
||||
|
||||
public bool TelestickPull
|
||||
{
|
||||
get => animator.GetBool(TelestickPullHash);
|
||||
set => animator.SetBool(TelestickPullHash, value);
|
||||
}
|
||||
|
||||
public bool UseRodPod
|
||||
{
|
||||
get => animator.GetBool(UseRodPodHash);
|
||||
set => animator.SetBool(UseRodPodHash, value);
|
||||
}
|
||||
|
||||
public int ItemSource
|
||||
{
|
||||
get => animator.GetInteger(ItemSourceHash);
|
||||
set => animator.SetInteger(ItemSourceHash, value);
|
||||
}
|
||||
|
||||
public int ItemDest
|
||||
{
|
||||
get => animator.GetInteger(ItemDestHash);
|
||||
set => animator.SetInteger(ItemDestHash, value);
|
||||
}
|
||||
|
||||
public bool RodReady
|
||||
{
|
||||
get => animator.GetBool(RodReadyHash);
|
||||
set => animator.SetBool(RodReadyHash, value);
|
||||
}
|
||||
|
||||
public float HitchRecoverDir
|
||||
{
|
||||
get => animator.GetFloat(HitchRecoverDirHash);
|
||||
set => animator.SetFloat(HitchRecoverDirHash, value);
|
||||
}
|
||||
|
||||
public void SetHitchRecoverTrigger()
|
||||
{
|
||||
animator.SetTrigger(HitchRecoverHash);
|
||||
}
|
||||
|
||||
public void ResetHitchRecoverTrigger()
|
||||
{
|
||||
animator.ResetTrigger(HitchRecoverHash);
|
||||
}
|
||||
|
||||
public float SitOrStand
|
||||
{
|
||||
get => animator.GetFloat(SitOrStandHash);
|
||||
set => animator.SetFloat(SitOrStandHash, value);
|
||||
}
|
||||
|
||||
public bool Shteker
|
||||
{
|
||||
get => animator.GetBool(ShtekerHash);
|
||||
set => animator.SetBool(ShtekerHash, value);
|
||||
}
|
||||
|
||||
public bool ItemInHands
|
||||
{
|
||||
get => animator.GetBool(ItemInHandsHash);
|
||||
set => animator.SetBool(ItemInHandsHash, value);
|
||||
}
|
||||
|
||||
public bool ChangeItem
|
||||
{
|
||||
get => animator.GetBool(ChangeItemHash);
|
||||
set => animator.SetBool(ChangeItemHash, value);
|
||||
}
|
||||
|
||||
public HandItemType ItemType
|
||||
{
|
||||
get => (HandItemType)animator.GetInteger(ItemTypeHash);
|
||||
set => animator.SetInteger(ItemTypeHash, (int)value);
|
||||
}
|
||||
|
||||
public void SetItemActionTrigger()
|
||||
{
|
||||
animator.SetTrigger(ItemActionHash);
|
||||
}
|
||||
|
||||
public void ResetItemActionTrigger()
|
||||
{
|
||||
animator.ResetTrigger(ItemActionHash);
|
||||
}
|
||||
|
||||
public float ItemActionPower
|
||||
{
|
||||
get => animator.GetFloat(ItemActionPowerHash);
|
||||
set => animator.SetFloat(ItemActionPowerHash, value);
|
||||
}
|
||||
|
||||
public bool PodsakAction
|
||||
{
|
||||
get => animator.GetBool(PodsakActionHash);
|
||||
set => animator.SetBool(PodsakActionHash, value);
|
||||
}
|
||||
|
||||
public bool PullUpRod
|
||||
{
|
||||
get => animator.GetBool(PullUpRodHash);
|
||||
set => animator.SetBool(PullUpRodHash, value);
|
||||
}
|
||||
|
||||
public float FishingFinal
|
||||
{
|
||||
get => animator.GetFloat(FishingFinalHash);
|
||||
set => animator.SetFloat(FishingFinalHash, value);
|
||||
}
|
||||
|
||||
public float SpinOrTele
|
||||
{
|
||||
get => animator.GetFloat(SpinOrTeleHash);
|
||||
set => animator.SetFloat(SpinOrTeleHash, value);
|
||||
}
|
||||
|
||||
public void SetTwitchTrigger()
|
||||
{
|
||||
animator.SetTrigger(TwitchHash);
|
||||
}
|
||||
|
||||
public void ResetTwitchTrigger()
|
||||
{
|
||||
animator.ResetTrigger(TwitchHash);
|
||||
}
|
||||
|
||||
public float TwitchDir
|
||||
{
|
||||
get => animator.GetFloat(TwitchDirHash);
|
||||
set => animator.SetFloat(TwitchDirHash, value);
|
||||
}
|
||||
|
||||
public float ThrowSpeedMult
|
||||
{
|
||||
get => animator.GetFloat(ThrowSpeedMultHash);
|
||||
set => animator.SetFloat(ThrowSpeedMultHash, value);
|
||||
}
|
||||
|
||||
public void SetConvTestTrigger()
|
||||
{
|
||||
animator.SetTrigger(ConvTestHash);
|
||||
}
|
||||
|
||||
public void ResetConvTestTrigger()
|
||||
{
|
||||
animator.ResetTrigger(ConvTestHash);
|
||||
}
|
||||
|
||||
public int BoatPose
|
||||
{
|
||||
get => animator.GetInteger(BoatPoseHash);
|
||||
set => animator.SetInteger(BoatPoseHash, value);
|
||||
}
|
||||
|
||||
public float QuadDirection
|
||||
{
|
||||
get => animator.GetFloat(QuadDirectionHash);
|
||||
set => animator.SetFloat(QuadDirectionHash, value);
|
||||
}
|
||||
|
||||
public bool StretchMax
|
||||
{
|
||||
get => animator.GetBool(StretchMaxHash);
|
||||
set => animator.SetBool(StretchMaxHash, value);
|
||||
}
|
||||
|
||||
public void SetExamineItemTrigger()
|
||||
{
|
||||
animator.SetTrigger(ExamineItemHash);
|
||||
}
|
||||
|
||||
public void ResetExamineItemTrigger()
|
||||
{
|
||||
animator.ResetTrigger(ExamineItemHash);
|
||||
}
|
||||
|
||||
public float TillerDirection
|
||||
{
|
||||
get => animator.GetFloat(TillerDirectionHash);
|
||||
set => animator.SetFloat(TillerDirectionHash, value);
|
||||
}
|
||||
|
||||
public void SetTestTrigger()
|
||||
{
|
||||
animator.SetTrigger(TestTriggerHash);
|
||||
}
|
||||
|
||||
public void ResetTestTrigger()
|
||||
{
|
||||
animator.ResetTrigger(TestTriggerHash);
|
||||
}
|
||||
|
||||
public ThrowModeEnum ThrowMode
|
||||
{
|
||||
get
|
||||
{
|
||||
var val = animator.GetInteger(ThrowModeHash);
|
||||
return (ThrowModeEnum)val;
|
||||
}
|
||||
set => animator.SetInteger(ThrowModeHash, (int)value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public FPlayer Player;
|
||||
|
||||
public Animator animator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
|
||||
#region 动画事件回调
|
||||
|
||||
/// <summary>
|
||||
/// 抛竿开始
|
||||
/// </summary>
|
||||
public void RodForceThrowStart()
|
||||
{
|
||||
if (Player.Fsm.CurrentState is PlayerThrow playerThrow)
|
||||
{
|
||||
playerThrow.RodForceThrowStart();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd3b33ae0a9148e09ab618b222f8def5
|
||||
timeCreated: 1743435615
|
||||
@@ -1,55 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class ReelAnimator : MonoBehaviour
|
||||
{
|
||||
public FReel Reel;
|
||||
|
||||
private Animator _animator;
|
||||
|
||||
#region 参数定义
|
||||
|
||||
private static readonly int ReelingHash = Animator.StringToHash("Reeling");
|
||||
private static readonly int LineOutHash = Animator.StringToHash("LineOut");
|
||||
private static readonly int UnlockHash = Animator.StringToHash("Unlock");
|
||||
private static readonly int LineOutUnlockHash = Animator.StringToHash("LineOutUnlock");
|
||||
|
||||
public float Reeling
|
||||
{
|
||||
get => _animator.GetFloat(ReelingHash);
|
||||
set => _animator.SetFloat(ReelingHash, value);
|
||||
}
|
||||
|
||||
public float Reeling2
|
||||
{
|
||||
get => _animator.GetFloat(ReelingHash);
|
||||
set => _animator.SetFloat(ReelingHash, value);
|
||||
}
|
||||
|
||||
public float LineOut
|
||||
{
|
||||
get => _animator.GetFloat(LineOutHash);
|
||||
set => _animator.SetFloat(LineOutHash, value);
|
||||
}
|
||||
|
||||
public bool Unlock
|
||||
{
|
||||
get => _animator.GetBool(UnlockHash);
|
||||
set => _animator.SetBool(UnlockHash, value);
|
||||
}
|
||||
|
||||
public bool LineOutUnlock
|
||||
{
|
||||
get => _animator.GetBool(LineOutUnlockHash);
|
||||
set => _animator.SetBool(LineOutUnlockHash, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc6fc8d0372240f19de917e50d56edfb
|
||||
timeCreated: 1745922779
|
||||
@@ -1,119 +0,0 @@
|
||||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
public partial class FPlayer
|
||||
{
|
||||
/// <summary>
|
||||
/// 把鱼线放手上
|
||||
/// </summary>
|
||||
/// <param name="lHandPoint"></param>
|
||||
/// <param name="speed"></param>
|
||||
public bool PutLineToLeftHandHelper(Transform lHandPoint, float speed = 1f)
|
||||
{
|
||||
var pin = Gears.Rod.lineHandler.pinchController;
|
||||
if (!pin.isPinched)
|
||||
{
|
||||
pin.StartPinch(lHandPoint, speed);
|
||||
}
|
||||
|
||||
if (pin.isPinched && Vector3.Distance(pin.transform.position, lHandPoint.position) < 0.1f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public float GetPlayerHandPower()
|
||||
{
|
||||
if (!Gears.Rod)
|
||||
{
|
||||
return 1f;
|
||||
}
|
||||
|
||||
if (!Gears.Rod.lineHandler)
|
||||
{
|
||||
return 1f;
|
||||
}
|
||||
|
||||
float num2 = 0f;
|
||||
|
||||
float value = 0.85f + num2;
|
||||
value = Mathf.Clamp(value, 0.5f, 1.2f);
|
||||
var num = (Gears.Rod.currentFish
|
||||
? (1f - Mathf.Clamp01(Gears.Rod.currentLineTension * value))
|
||||
: (1f - Mathf.Clamp01(Gears.Rod.linelenghtDiferent * 0.2f)));
|
||||
return Mathf.Clamp(num, 0.2f, 1.2f);
|
||||
}
|
||||
|
||||
private void MoveTowardsInteraction()
|
||||
{
|
||||
if (!interactionCCDIK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
interactionCCDIK.solver.SetIKPositionWeight(Mathf.MoveTowards(interactionCCDIK.solver.IKPositionWeight,
|
||||
interactionTargetWeight, Time.deltaTime * 2f));
|
||||
if (Mathf.Approximately(interactionCCDIK.solver.IKPositionWeight, interactionTargetWeight))
|
||||
{
|
||||
if (interactionTargetWeight == 0f)
|
||||
{
|
||||
interactionCCDIK.solver.target = null;
|
||||
// SetHandArmature(lHandPlayer, armatureLHandPosterIdle);
|
||||
}
|
||||
|
||||
interactionCCDIK = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控制手和线轴交互
|
||||
/// </summary>
|
||||
/// <param name="interactiveObject"></param>
|
||||
public void InteractiveMainHand(Transform interactiveObject)
|
||||
{
|
||||
if (!MainArm.TryGetComponent<CCDIK>(out var component))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (interactiveObject == null)
|
||||
{
|
||||
interactionTargetWeight = 0f;
|
||||
interactionCCDIK = component;
|
||||
if (Gears.Reel)
|
||||
{
|
||||
Data.isHandOnHandle = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (interactiveObject.tag)
|
||||
{
|
||||
case "Reel":
|
||||
component.solver.target = Gears.Reel.reelAsset.handle;
|
||||
interactionTargetWeight = 1f;
|
||||
interactionCCDIK = component;
|
||||
if ((bool)Gears.Rod && (bool)Gears.Reel)
|
||||
{
|
||||
Data.isHandOnHandle = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case "ReelUnlock":
|
||||
// SetHandArmature(lHandPlayer, Gears.Reel.armatureLHandUnlockPoster);
|
||||
// component.solver.target = Gears.Reel.reelAsset.koblagHandle;
|
||||
interactionTargetWeight = 1f;
|
||||
interactionCCDIK = component;
|
||||
if ((bool)Gears.Rod && (bool)Gears.Reel)
|
||||
{
|
||||
Data.isHandOnHandle = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2ded975fdd44246a7009d06371195b2
|
||||
timeCreated: 1743521899
|
||||
@@ -1,214 +0,0 @@
|
||||
using DG.Tweening;
|
||||
using NBC;
|
||||
using NBF;
|
||||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
public partial class FPlayer : MonoBehaviour
|
||||
{
|
||||
public FPlayerData Data;
|
||||
|
||||
/// <summary>
|
||||
/// 相机挂点
|
||||
/// </summary>
|
||||
public Transform CameraRoot;
|
||||
|
||||
private CCDIK interactionCCDIK;
|
||||
|
||||
private float interactionTargetWeight;
|
||||
|
||||
public Fsm<FPlayer> Fsm { get; private set; }
|
||||
|
||||
private PlayerArm[] Arms;
|
||||
public PlayerArm MainArm { get; private set; }
|
||||
|
||||
public PlayerArm MinorArm { get; private set; }
|
||||
|
||||
public PlayerAnimator PlayerAnimatorCtrl;
|
||||
|
||||
public FPlayerUseGear Gears;
|
||||
|
||||
public LureTrajectorySimulator LureTrajectorySimulator;
|
||||
|
||||
public Transform Light;
|
||||
|
||||
public Transform BackSpine;
|
||||
|
||||
public Rigidbody Rigidbody;
|
||||
|
||||
|
||||
public PlayerCharacter Character;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Character = GetComponent<PlayerCharacter>();
|
||||
PlayerAnimatorCtrl = gameObject.GetComponent<PlayerAnimator>();
|
||||
if (PlayerAnimatorCtrl == null)
|
||||
{
|
||||
PlayerAnimatorCtrl = gameObject.AddComponent<PlayerAnimator>();
|
||||
}
|
||||
|
||||
Gears = gameObject.GetComponent<FPlayerUseGear>();
|
||||
if (Gears == null)
|
||||
{
|
||||
Gears = gameObject.AddComponent<FPlayerUseGear>();
|
||||
}
|
||||
|
||||
LureTrajectorySimulator = gameObject.AddComponent<LureTrajectorySimulator>();
|
||||
|
||||
PlayerAnimatorCtrl.Player = this;
|
||||
Arms = GetComponentsInChildren<PlayerArm>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ChangeArm();
|
||||
|
||||
InteractiveMainHand(null);
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
public void InitData(FPlayerData data)
|
||||
{
|
||||
Data = data;
|
||||
|
||||
|
||||
if (data.PlayerID == GameModel.RoleID)
|
||||
{
|
||||
Fishing.Inst.Player.SelfPlayer = this;
|
||||
BaseCamera.Main.transform.SetParent(CameraRoot);
|
||||
BaseCamera.Main.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
#region 初始化相关
|
||||
|
||||
private void Init()
|
||||
{
|
||||
InitFsm();
|
||||
}
|
||||
|
||||
private void InitFsm()
|
||||
{
|
||||
Fsm = new Fsm<FPlayer>("Player", this, true);
|
||||
Fsm.RegisterState<PlayerIdle>();
|
||||
Fsm.RegisterState<PlayerThrow>();
|
||||
Fsm.RegisterState<PlayerFishing>();
|
||||
Fsm.RegisterState<PlayerFight>();
|
||||
Fsm.RegisterState<PlayerShowFish>();
|
||||
Fsm.RegisterState<PlayerWaitThrow>();
|
||||
Fsm.Start<PlayerIdle>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void ChangeArm()
|
||||
{
|
||||
var isLeftHand = PlayerAnimatorCtrl.LeftHand;
|
||||
foreach (var arm in Arms)
|
||||
{
|
||||
if (isLeftHand)
|
||||
{
|
||||
if (arm.IsLeft)
|
||||
{
|
||||
MainArm = arm;
|
||||
}
|
||||
else
|
||||
{
|
||||
MinorArm = arm;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!arm.IsLeft)
|
||||
{
|
||||
MainArm = arm;
|
||||
}
|
||||
else
|
||||
{
|
||||
MinorArm = arm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Fsm?.Update();
|
||||
|
||||
// CheckAndConnectRod();
|
||||
MoveTowardsInteraction();
|
||||
|
||||
if (CanChangeGear())
|
||||
{
|
||||
Gears?.Update();
|
||||
}
|
||||
|
||||
SyncLight();
|
||||
}
|
||||
|
||||
private void SyncLight()
|
||||
{
|
||||
if (Light)
|
||||
{
|
||||
if (Light.gameObject.activeSelf != Data.openLight)
|
||||
{
|
||||
Light.gameObject.SetActive(Data.openLight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Tween _fovTween; // 存储当前的Tween动画,方便中断
|
||||
private float _zoomDuration = 0.2f; // 缩放动画时间
|
||||
|
||||
public Boat NowBoat { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 切换望远镜效果(打开/关闭)
|
||||
/// </summary>
|
||||
/// <param name="isZoomIn">true=打开望远镜,false=关闭望远镜</param>
|
||||
public void ToggleTelescope()
|
||||
{
|
||||
// 如果已经有动画在运行,先停止
|
||||
_fovTween?.Kill();
|
||||
|
||||
// 根据传入的参数决定目标FOV
|
||||
float targetFOV = Data.openTelescope ? GameDef.ZoomedFOV : GameDef.NormalFOV;
|
||||
|
||||
// 使用DoTween平滑过渡FOV
|
||||
_fovTween = DOTween.To(
|
||||
() => BaseCamera.Main.fieldOfView, // 获取当前FOV
|
||||
x => BaseCamera.Main.fieldOfView = x, // 设置新FOV
|
||||
targetFOV, // 目标FOV
|
||||
_zoomDuration // 动画时间
|
||||
).SetEase(Ease.InOutQuad); // 使用缓动函数让动画更平滑
|
||||
}
|
||||
|
||||
public bool CanChangeGear()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void EnterBoat(Boat boat)
|
||||
{
|
||||
NowBoat = boat;
|
||||
boat.Use(this);
|
||||
PlayerAnimatorCtrl.Boat = true;
|
||||
transform.parent = boat.Place;
|
||||
transform.localPosition = Vector3.zero;
|
||||
transform.localRotation = Quaternion.identity;
|
||||
Rigidbody.isKinematic = true;
|
||||
Character.CharacterController.enabled = false;
|
||||
}
|
||||
|
||||
public void ExitBoat()
|
||||
{
|
||||
NowBoat.UnUse();
|
||||
NowBoat = null;
|
||||
Rigidbody.isKinematic = true;
|
||||
Character.CharacterController.enabled = true;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 492fca36d1134a788a47e5bf6f2fdc1e
|
||||
timeCreated: 1742313418
|
||||
@@ -1,81 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public abstract class FPlayerGear : MonoBehaviour
|
||||
{
|
||||
private bool _isInit;
|
||||
public FPlayer Owner { get; protected set; }
|
||||
|
||||
public FGearData GearData { get; protected set; }
|
||||
|
||||
|
||||
public FRod Rod { get; protected set; }
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// OnStart();
|
||||
}
|
||||
|
||||
public void Initialize(FPlayer player, FGearData gearData = null)
|
||||
{
|
||||
Owner = player;
|
||||
Rod = Owner.Gears.Rod;
|
||||
GearData = gearData;
|
||||
OnStart();
|
||||
_isInit = true;
|
||||
}
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!_isInit) return;
|
||||
if (!Owner || Owner.Data == null) return;
|
||||
if (!Owner.Gears) return;
|
||||
OnUpdate();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!_isInit) return;
|
||||
OnFixedUpdate();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (!_isInit) return;
|
||||
OnLateUpdate();
|
||||
}
|
||||
|
||||
protected virtual void OnStart()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnFixedUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnLateUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
#region 工具方法
|
||||
|
||||
protected void CheckDistance(Transform target, float distance = 0.01f)
|
||||
{
|
||||
var dis = Vector3.Distance(transform.position, target.position);
|
||||
if (dis > distance)
|
||||
{
|
||||
// transform.position = target.position;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a083c4569ab147b4b2ce8ec20ad64cba
|
||||
timeCreated: 1744029092
|
||||
@@ -1,345 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FPlayerUseGear : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 可用的
|
||||
/// </summary>
|
||||
public bool Usable { get; private set; }
|
||||
|
||||
public int UseGearId { get; private set; }
|
||||
public FPlayer Player { get; set; }
|
||||
|
||||
public FRod Rod;
|
||||
public FReel Reel;
|
||||
public FHook Hook;
|
||||
public FFloat Bobber;
|
||||
public FBait Bait;
|
||||
public FLure Lure;
|
||||
public FWeight Weight;
|
||||
public FLine Line;
|
||||
|
||||
|
||||
public Transform GearParent { get; private set; }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Player = GetComponentInParent<FPlayer>();
|
||||
var obj = new GameObject(Player.Data.PlayerID.ToString());
|
||||
GearParent = obj.transform;
|
||||
GearParent.SetParent(SceneSettings.Instance.GearNode);
|
||||
GearParent.localPosition = Vector3.zero;
|
||||
GearParent.position = Player.transform.position;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (CheckGear())
|
||||
{
|
||||
StartCoroutine(CreateOrHideGear());
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckGear()
|
||||
{
|
||||
var nowGearId = 0;
|
||||
if (Player != null && Player.Data != null && Player.Data.currentGear != null)
|
||||
{
|
||||
nowGearId = Player.Data.currentGear.GetUnitId();
|
||||
}
|
||||
|
||||
if (UseGearId != nowGearId)
|
||||
{
|
||||
UseGearId = nowGearId;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public IEnumerator CreateOrHideGear()
|
||||
{
|
||||
if (Player.PlayerAnimatorCtrl.ItemInHands)
|
||||
{
|
||||
Player.PlayerAnimatorCtrl.ItemInHands = false;
|
||||
}
|
||||
|
||||
if (Rod != null)
|
||||
{
|
||||
yield return HideGear();
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
if (Player.Data == null || Player.Data.currentGear == null) yield break;
|
||||
|
||||
var parent = GearParent;
|
||||
parent.position = Player.transform.position;
|
||||
|
||||
var data = Player.Data.currentGear;
|
||||
var rodConfig = data.rod.Config;
|
||||
var cloneObj = rodConfig.Instantiate(parent, Vector3.zero, Player.MainArm.RodContainer.rotation);
|
||||
if (cloneObj == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
Rod = cloneObj.GetComponent<FRod>();
|
||||
if (Rod == null)
|
||||
{
|
||||
Rod = cloneObj.AddComponent<FRod>();
|
||||
}
|
||||
|
||||
|
||||
if (Rod)
|
||||
{
|
||||
Rod.transform.localPosition = Vector3.zero;
|
||||
Rod.transform.rotation = Player.MainArm.RodContainer.rotation;
|
||||
|
||||
if (rodConfig.ring > 0)
|
||||
{
|
||||
var ringConfig = GameRings.Get(rodConfig.ring);
|
||||
var ringObject = ringConfig.Instantiate(Rod.transform);
|
||||
ringObject.SetActive(false);
|
||||
Rod.SetRing(ringObject.GetComponent<RodRingAsset>());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (data.line != null)
|
||||
{
|
||||
var linePrefab = data.line.Config.Instantiate(parent);
|
||||
Line = linePrefab.GetComponent<FLine>();
|
||||
}
|
||||
|
||||
if (data.reel != null)
|
||||
{
|
||||
var reelPrefab = data.reel.Config.Create(parent);
|
||||
Reel = reelPrefab.GetComponent<FReel>();
|
||||
}
|
||||
|
||||
if (data.bobber != null)
|
||||
{
|
||||
var bobberPrefab = data.bobber.Config.Create(parent);
|
||||
Bobber = bobberPrefab.GetComponent<FFloat>();
|
||||
}
|
||||
|
||||
if (data.hook != null)
|
||||
{
|
||||
var hookPrefab = data.hook.Config.Create(parent);
|
||||
Hook = hookPrefab.GetComponent<FHook>();
|
||||
}
|
||||
|
||||
if (data.bait != null)
|
||||
{
|
||||
var baitPrefab = data.bait.Config.Create(parent);
|
||||
|
||||
if (baitPrefab.TryGetComponent<FBait>(out var bait))
|
||||
{
|
||||
Bait = bait;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.lure != null)
|
||||
{
|
||||
var baitPrefab = data.lure.Config.Create(parent);
|
||||
if (baitPrefab.TryGetComponent<FLure>(out var lure))
|
||||
{
|
||||
Lure = lure;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (data.weight != null)
|
||||
{
|
||||
var weightPrefab = data.weight.Config.Instantiate(parent);
|
||||
Weight = weightPrefab.GetComponent<FWeight>();
|
||||
}
|
||||
|
||||
Debug.LogError("CreateOrHideGear");
|
||||
yield return 1;
|
||||
Rod.Initialize(Player, data.rod);
|
||||
Rod.CreateFishingHandler();
|
||||
|
||||
if (Line)
|
||||
{
|
||||
Line.Initialize(Player, data.line);
|
||||
|
||||
|
||||
if ((bool)Rod.lineHandler.obiRopeSegment_1)
|
||||
{
|
||||
Rod.lineHandler.obiRopeSegment_1.GetComponent<MeshRenderer>().material =
|
||||
Line.lineMat;
|
||||
}
|
||||
|
||||
if ((bool)Rod.lineHandler.obiRopeSegment_2)
|
||||
{
|
||||
Rod.lineHandler.obiRopeSegment_2.GetComponent<MeshRenderer>().material =
|
||||
Line.lineMat;
|
||||
}
|
||||
|
||||
if ((bool)Rod.lineHandler.obiRopeSegment_3)
|
||||
{
|
||||
Rod.lineHandler.obiRopeSegment_3.GetComponent<MeshRenderer>().material =
|
||||
Line.lineMat;
|
||||
}
|
||||
}
|
||||
|
||||
if (Reel)
|
||||
{
|
||||
// Reel.maxReelStrength = data.reel.Config.strength;
|
||||
// Reel.reelingSpeed = 0.5f; //slotsEquip.reel.currentSpeed;
|
||||
Reel.reelingDrag = 0.699f; //slotsEquip.reel.currentDrag;
|
||||
Reel.transform.SetParent(Rod.rodAsset.ReelConnector);
|
||||
Reel.transform.localPosition = Vector3.zero;
|
||||
Reel.transform.localEulerAngles = Vector3.zero;
|
||||
// Reel.reelAsset.szpulaObject.GetComponent<MeshRenderer>().material = Line.szpulaMat;
|
||||
Reel.Initialize(Player, data.reel);
|
||||
}
|
||||
|
||||
if (Bobber)
|
||||
{
|
||||
Bobber.floatDisplacement = data.bobber.Config.displacement;
|
||||
// if ((double)slotsEquip.ffloat.lastSetGroundValue > 0.2)
|
||||
// {
|
||||
// Bobber.newDeepth = slotsEquip.ffloat.lastSetGroundValue;
|
||||
// }
|
||||
|
||||
Bobber.newDeepth = 0.5f;
|
||||
|
||||
Bobber.Initialize(Player, data.bobber);
|
||||
Bobber.transform.position = Rod.lineHandler.LineConnector_1.transform.position;
|
||||
Bobber.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
|
||||
Rod.lineHandler.LineConnector_1.GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
|
||||
if (Hook)
|
||||
{
|
||||
Hook.Initialize(Player, data.hook);
|
||||
|
||||
Hook.transform.position = Rod.lineHandler.LineConnector_2.transform.position;
|
||||
Hook.transform.rotation = Rod.lineHandler.LineConnector_2.transform.rotation; // 确保旋转也同步
|
||||
var target = Rod.lineHandler.LineConnector_2.GetComponent<Rigidbody>();
|
||||
var joint = Hook.gameObject.GetComponent<ConfigurableJoint>();
|
||||
// // 关键设置:关闭自动锚点计算,手动设置锚点
|
||||
// joint.autoConfigureConnectedAnchor = false;
|
||||
// joint.anchor = Vector3.zero; // 以 Hook 自身中心为锚点
|
||||
// joint.connectedAnchor = Vector3.zero; // 以目标物体的中心为锚点
|
||||
joint.connectedBody = target;
|
||||
// // 强制物理引擎立即更新变换(避免1帧延迟)
|
||||
// Physics.SyncTransforms();
|
||||
// joint.autoConfigureConnectedAnchor = false;
|
||||
// joint.anchor = Vector3.zero;
|
||||
// joint.connectedAnchor = Vector3.zero;
|
||||
Rod.LureHookWaterDisplacement = Hook.GetComponent<FWaterDisplacement>();
|
||||
}
|
||||
|
||||
if (Bait)
|
||||
{
|
||||
Bait.Initialize(Player, data.bait);
|
||||
Bait.transform.position = Hook.hookAsset.baitConnector.position;
|
||||
Bait.transform.SetParent(Hook.hookAsset.baitConnector);
|
||||
}
|
||||
|
||||
if (Lure)
|
||||
{
|
||||
Lure.Initialize(Player, data.bait);
|
||||
Lure.transform.position = Rod.lineHandler.LineConnector_1.transform.position;
|
||||
Lure.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
|
||||
Rod.lineHandler.LineConnector_1.GetComponent<Rigidbody>();
|
||||
Rod.LureHookWaterDisplacement = Lure.GetComponent<FWaterDisplacement>();
|
||||
}
|
||||
|
||||
if (Weight)
|
||||
{
|
||||
Weight.weight = data.weight.Config.weight;
|
||||
Weight.Initialize(Player, data.weight);
|
||||
}
|
||||
// Player.PlayerAnimatorCtrl.ItemInHands = true;
|
||||
|
||||
Player.PlayerAnimatorCtrl.ItemInHands = true;
|
||||
Player.PlayerAnimatorCtrl.ThrowMode = ThrowModeEnum.Spin;
|
||||
Player.PlayerAnimatorCtrl.ItemType = HandItemType.SpinRod;
|
||||
if (data.Type == GearType.Pole)
|
||||
{
|
||||
Player.PlayerAnimatorCtrl.ItemType = HandItemType.HandRod;
|
||||
Player.PlayerAnimatorCtrl.ThrowMode = ThrowModeEnum.Float;
|
||||
}
|
||||
|
||||
yield return 1; //等待1帧
|
||||
Rod.transform.SetParent(Player.MainArm.RodContainer);
|
||||
Rod.transform.localPosition = Vector3.zero;
|
||||
Rod.transform.rotation = Player.MainArm.RodContainer.rotation;
|
||||
// yield return 1; //等待1帧
|
||||
// Rod.lineHandler.SetStartPosition();
|
||||
// yield return 5; //等待1帧
|
||||
// Rod.lineHandler.SetStartPosition2();
|
||||
Usable = true;
|
||||
}
|
||||
|
||||
public IEnumerator HideGear()
|
||||
{
|
||||
Usable = false;
|
||||
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
DestroyGear();
|
||||
}
|
||||
|
||||
private void DestroyGear()
|
||||
{
|
||||
if (Rod != null)
|
||||
{
|
||||
if (Rod.lineHandler != null)
|
||||
{
|
||||
Destroy(Rod.lineHandler.gameObject);
|
||||
}
|
||||
|
||||
Destroy(Rod.gameObject);
|
||||
}
|
||||
|
||||
if (Reel != null)
|
||||
{
|
||||
Destroy(Reel.gameObject);
|
||||
}
|
||||
|
||||
if (Hook != null)
|
||||
{
|
||||
Destroy(Hook.gameObject);
|
||||
}
|
||||
|
||||
if (Bobber != null)
|
||||
{
|
||||
Destroy(Bobber.gameObject);
|
||||
}
|
||||
|
||||
if (Bait != null)
|
||||
{
|
||||
Destroy(Bait.gameObject);
|
||||
}
|
||||
|
||||
if (Lure != null)
|
||||
{
|
||||
Destroy(Lure.gameObject);
|
||||
}
|
||||
|
||||
if (Weight != null)
|
||||
{
|
||||
Destroy(Weight.gameObject);
|
||||
}
|
||||
|
||||
if (Line != null)
|
||||
{
|
||||
Destroy(Line.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8206f172fd9466ab462d87a0734a62c
|
||||
timeCreated: 1744208607
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class FixedLine : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
private Rigidbody _rigidbody;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_rigidbody = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
FixLine();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
FixLine();
|
||||
}
|
||||
|
||||
private void FixLine()
|
||||
{
|
||||
if (!target) return;
|
||||
_rigidbody.MovePosition(target.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 112f7ad42d8149c1944bb51067ef1966
|
||||
timeCreated: 1747411443
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff517d5448b2471486bb8a6e524447d8
|
||||
timeCreated: 1743936635
|
||||
@@ -1,31 +0,0 @@
|
||||
using NBF;
|
||||
using UnityEngine;
|
||||
|
||||
public class FBait : FPlayerGear
|
||||
{
|
||||
// private float takeRange = 5f;
|
||||
public BaitAsset baitAsset;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
baitAsset = GetComponent<BaitAsset>();
|
||||
}
|
||||
|
||||
// public bool CheckBaitEfficacy(float distanceToFish)
|
||||
// {
|
||||
// float num = 0f;
|
||||
//
|
||||
// float num2 = 100f;
|
||||
// takeRange = 1f + num2 * 0.5f;
|
||||
// int num3 = Random.Range(0, 1);
|
||||
// Debug.Log("Bait efficacy range: " + (takeRange + takeRange * num) + " Bait current efficacy < rand: " + num2 +
|
||||
// "/" + num3);
|
||||
// if ((float)num3 > num2)
|
||||
// {
|
||||
// Debug.Log("Bait efficacy is too low");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b3aaf527fc746ea93d9233dc8ec7ca0
|
||||
timeCreated: 1742313561
|
||||
@@ -1,57 +0,0 @@
|
||||
using NBF;
|
||||
using UnityEngine;
|
||||
|
||||
public class FFeeder : FPlayerGear
|
||||
{
|
||||
[HideInInspector]
|
||||
public Rigidbody rigidbody;
|
||||
|
||||
[HideInInspector]
|
||||
public FWaterDisplacement waterDisplacement;
|
||||
|
||||
public ParticleSystem smuuggeParticle;
|
||||
|
||||
[HideInInspector]
|
||||
public FRod currentRod;
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
rigidbody = GetComponent<Rigidbody>();
|
||||
waterDisplacement = GetComponent<FWaterDisplacement>();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
ShowWaterFX();
|
||||
if ((bool)currentRod)
|
||||
{
|
||||
if ((bool)currentRod.currentFish)
|
||||
{
|
||||
waterDisplacement.isFreeze = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
waterDisplacement.isFreeze = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowWaterFX()
|
||||
{
|
||||
if (smuuggeParticle == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (waterDisplacement.waterHeightPosition - 0.1f <= transform.position.y && waterDisplacement.waterHeightPosition + 0.1f > transform.position.y)
|
||||
{
|
||||
if (!smuuggeParticle.isEmitting)
|
||||
{
|
||||
smuuggeParticle.Play();
|
||||
}
|
||||
}
|
||||
else if (smuuggeParticle.isPlaying)
|
||||
{
|
||||
smuuggeParticle.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b9877b136184e20a98cd45d0e067a2b
|
||||
timeCreated: 1742313572
|
||||
@@ -1,248 +0,0 @@
|
||||
// using UltimateWater;
|
||||
|
||||
using NBF;
|
||||
using UnityEngine;
|
||||
|
||||
public class FFloat : FPlayerGear
|
||||
{
|
||||
[HideInInspector] public Rigidbody rigidbody;
|
||||
|
||||
[HideInInspector] public FWaterDisplacement waterDisplacement;
|
||||
|
||||
public float currentFloatDeepth = 0.2f;
|
||||
|
||||
public float newDeepth { get; set; } = 0.21f;
|
||||
|
||||
public float floatDisplacement;
|
||||
|
||||
// private BoxCollider collider;
|
||||
|
||||
private float startWaterInteractiveMultiple = 5f;
|
||||
|
||||
private Transform currentWaterDrop;
|
||||
|
||||
// [SerializeField] public Transform scallingObject;
|
||||
|
||||
private bool destroyDropFx;
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
rigidbody = GetComponent<Rigidbody>();
|
||||
waterDisplacement = GetComponent<FWaterDisplacement>();
|
||||
waterDisplacement.objectDisplacement = floatDisplacement;
|
||||
// collider = GetComponent<BoxCollider>();
|
||||
if (Owner.Gears.Rod)
|
||||
{
|
||||
Owner.Gears.Rod.lineHandler.SetSegmentTwoLenght(currentFloatDeepth);
|
||||
}
|
||||
|
||||
// if ((bool)waterInteractive)
|
||||
// {
|
||||
// waterInteractive.enabled = false;
|
||||
// startWaterInteractiveMultiple = waterInteractive.Multiplier;
|
||||
// }
|
||||
|
||||
Invoke("EnableWaterInteractive", 3f);
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if ((bool)Owner.Gears.Rod)
|
||||
{
|
||||
if ((bool)Owner.Gears.Rod.currentFish)
|
||||
{
|
||||
waterDisplacement.isFreeze = true;
|
||||
waterDisplacement.useSplashes = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
waterDisplacement.isFreeze = false;
|
||||
waterDisplacement.useSplashes = true;
|
||||
}
|
||||
|
||||
ShowWaterFX();
|
||||
SetDeepth();
|
||||
// Scalling();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnFixedUpdate()
|
||||
{
|
||||
DisplcementController();
|
||||
}
|
||||
|
||||
// private void Scalling()
|
||||
// {
|
||||
// if ((bool)Owner.Gears.Rod.lineHandler &&
|
||||
// (bool)Owner.Gears.Rod.lineHandler.EndLineRigidbody_0)
|
||||
// {
|
||||
// // float floatSize = GameManager.Instance._playerData
|
||||
// // .Player[GameManager.Instance._playerData.currentPlayerProfileIndex].floatSize;
|
||||
//
|
||||
// float floatSize = 1; //Owner.Data.currentGear.bobber.Config.weight;
|
||||
// float num = Vector3.Distance(
|
||||
// Owner.Gears.Rod.lineHandler.EndLineRigidbody_0.transform.position,
|
||||
// scallingObject.transform.position);
|
||||
// // if ((bool)waterInteractive)
|
||||
// // {
|
||||
// // waterInteractive.Multiplier = startWaterInteractiveMultiple / (scallingObject.localScale.x * 2f);
|
||||
// // }
|
||||
//
|
||||
// // if (FScriptsHandler.Instance.m_PlayerMain.currentCameraView !=
|
||||
// // FScriptsHandler.Instance.m_PlayerMain.m_Camera)
|
||||
// // {
|
||||
// // scallingObject.localScale = Vector3.one;
|
||||
// // }
|
||||
// // else
|
||||
// if (waterDisplacement.isInWater && !Owner.Gears.Rod.currentFish)
|
||||
// {
|
||||
// float value = 1f + num * 0.4f / floatSize * floatSize;
|
||||
// value = Mathf.Clamp(value, 0f, floatSize);
|
||||
// scallingObject.localScale =
|
||||
// Vector3.MoveTowards(scallingObject.localScale, Vector3.one * value, Time.deltaTime * 5f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// scallingObject.localScale =
|
||||
// Vector3.MoveTowards(scallingObject.localScale, Vector3.one, Time.deltaTime * 10f);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
private void EnableWaterInteractive()
|
||||
{
|
||||
// if ((bool)waterInteractive)
|
||||
// {
|
||||
// waterInteractive.enabled = true;
|
||||
// }
|
||||
}
|
||||
|
||||
private void DisplcementController()
|
||||
{
|
||||
if (!Owner.Gears.Rod || !Owner.Gears.Weight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (waterDisplacement.isInWater)
|
||||
{
|
||||
float value = floatDisplacement - Owner.Gears.Weight.weight + 1f;
|
||||
value = Mathf.Clamp(value, -1f, 2f);
|
||||
waterDisplacement.objectDisplacement = value;
|
||||
// if ((value > 1.5f && rigidbody.linearVelocity.magnitude < 1f) || ProbeDeep(transform) < currentFloatDeepth)
|
||||
// {
|
||||
// collider.center = new Vector3(0f, collider.center.y, 0.07f);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// collider.center = new Vector3(0f, collider.center.y, 0f);
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
// collider.center = new Vector3(0f, collider.center.y, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private float ProbeDeep(Transform probeObject)
|
||||
{
|
||||
int mask = LayerMask.GetMask("Terrain");
|
||||
float result = 0f;
|
||||
if (Physics.Raycast(probeObject.transform.position, -Vector3.up, out var hitInfo, float.PositiveInfinity, mask))
|
||||
{
|
||||
result = hitInfo.distance;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SetDeepth()
|
||||
{
|
||||
if ((bool)Owner.Gears.Rod && (bool)Owner.Gears.Hook &&
|
||||
!(Owner.Data.lineLength > 2f) && !Owner.Gears.Rod.currentFish)
|
||||
{
|
||||
if (newDeepth != currentFloatDeepth)
|
||||
{
|
||||
Owner.Gears.Rod.lineHandler.SetSegmentTwoLenght(newDeepth);
|
||||
currentFloatDeepth = newDeepth;
|
||||
}
|
||||
|
||||
// if (InputManager.isDeepthFloatUp)
|
||||
// {
|
||||
// newDeepth += 0.1f;
|
||||
// newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
// Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// // GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
// }
|
||||
//
|
||||
// if (InputManager.isDeepthFloatDown)
|
||||
// {
|
||||
// newDeepth -= 0.1f;
|
||||
// newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
//
|
||||
// Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// // GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
// }
|
||||
|
||||
if (Owner.Data.selectorRodSetting == SelectorRodSetting.Leeder &&
|
||||
Input.mouseScrollDelta.y != 0f && Time.timeScale != 0f)
|
||||
{
|
||||
newDeepth += Input.mouseScrollDelta.y * 0.02f;
|
||||
newDeepth = Mathf.Clamp(newDeepth, 0.15f, 2.5f);
|
||||
Owner.Data.currentGear.SetBobberLastSetGroundValue(newDeepth);
|
||||
// GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("SET_FLOAT_DEEPTH_TO") + newDeepth.ToString("F2") + " m", FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DestroyDelayFxDrop()
|
||||
{
|
||||
if ((bool)currentWaterDrop)
|
||||
{
|
||||
Destroy(currentWaterDrop.gameObject);
|
||||
destroyDropFx = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowWaterFX()
|
||||
{
|
||||
// float num = 0f - transform.position.y;
|
||||
// if (num < 0.1f && num > -0.1f)
|
||||
// {
|
||||
// if (!currentWaterDrop)
|
||||
// {
|
||||
// currentWaterDrop = Instantiate(FScriptsHandler.Instance.waterFishSplash[2],
|
||||
// transform.position, Quaternion.identity, transform.parent).transform;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// currentWaterDrop.position = new Vector3(transform.position.x, 0f, transform.position.z);
|
||||
// }
|
||||
// }
|
||||
// else if ((bool)currentWaterDrop)
|
||||
// {
|
||||
// if (!destroyDropFx)
|
||||
// {
|
||||
// Invoke("DestroyDelayFxDrop", 4f);
|
||||
// }
|
||||
//
|
||||
// destroyDropFx = true;
|
||||
// }
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if ((bool)currentWaterDrop)
|
||||
{
|
||||
Destroy(currentWaterDrop.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
#region Test
|
||||
|
||||
public void Test(int type)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe65a4c7c8124d9eaaee85e579b4d341
|
||||
timeCreated: 1742313491
|
||||
@@ -1,114 +0,0 @@
|
||||
using NBF;
|
||||
using UnityEngine;
|
||||
|
||||
public class FHook : FPlayerGear
|
||||
{
|
||||
[HideInInspector] public Rigidbody rigidbody;
|
||||
|
||||
[HideInInspector] public FWaterDisplacement waterDisplacement;
|
||||
|
||||
// [HideInInspector] public FRod currentRod;
|
||||
|
||||
[Tooltip("Punkt połaczenia z rybą")] public Rigidbody fishJoiner;
|
||||
|
||||
public Vector3 rotationInFishJaw = Vector3.zero;
|
||||
|
||||
public bool isLookingDisable;
|
||||
|
||||
private float hookTimer;
|
||||
|
||||
public int hookNotAcceptFishCounter;
|
||||
|
||||
|
||||
public HookAsset hookAsset;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
hookAsset = GetComponent<HookAsset>();
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
rigidbody = GetComponent<Rigidbody>();
|
||||
waterDisplacement = GetComponent<FWaterDisplacement>();
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (!Owner.Gears.Rod)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bool)Owner.Gears.Rod.currentFish)
|
||||
{
|
||||
waterDisplacement.isFreeze = true;
|
||||
waterDisplacement.useSplashes = false;
|
||||
AddHookNotAcceptedCount(reset: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
waterDisplacement.isFreeze = false;
|
||||
waterDisplacement.useSplashes = true;
|
||||
if (waterDisplacement.isInWater)
|
||||
{
|
||||
Quaternion b = Quaternion.Euler(0f, rigidbody.transform.localEulerAngles.y,
|
||||
rigidbody.linearVelocity.x - 1f);
|
||||
rigidbody.rotation = Quaternion.Slerp(rigidbody.rotation, b, Time.deltaTime * 1f);
|
||||
if ((bool)Owner.Gears.Rod.takeFish)
|
||||
{
|
||||
AddHookNotAcceptedCount(reset: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHookNotAcceptedCount(reset: false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHookNotAcceptedCount(reset: true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Owner.Gears.Rod.takeFish && !Owner.Gears.Rod.currentFish && isLookingDisable)
|
||||
{
|
||||
isLookingDisable = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddHookNotAcceptedCount(bool reset)
|
||||
{
|
||||
// if (GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex]
|
||||
// .gameMode == GameManager.PlayerData.CPlayer.GameMode.Realistic ||
|
||||
// FScriptsHandler.Instance.m_PlayerMain.currentRod != currentRod)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (reset)
|
||||
{
|
||||
hookTimer = 0f;
|
||||
hookNotAcceptFishCounter = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
hookTimer += Time.deltaTime;
|
||||
if (hookTimer >= 300f && hookNotAcceptFishCounter > 5)
|
||||
{
|
||||
hookTimer = 0f;
|
||||
hookNotAcceptFishCounter = 0;
|
||||
// GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("HOOK_NOT_ACCEPT_FISH_INFO"), FScriptsHandler.Instance.m_Canvas.transform);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
// if (!waterDisplacement.isInWater && (bool)Owner.Gears.Rod &&
|
||||
// (bool)Owner.Gears.Rod.lineHandler && !Owner.Gears.Rod.currentFish &&
|
||||
// Owner.Data.lineLength > 5f &&
|
||||
// Vector3.Distance(transform.position, Owner.Gears.Rod.transform.position) > 5f)
|
||||
// {
|
||||
// GameManager.Instance.ShowMessagePopup(LanguageManager.Instance.GetText("HOOK_ON_THE_GROUND"), FScriptsHandler.Instance.m_Canvas.transform, deleteLast: true);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8caddc7ca53a49f488f61f5ab8475cdb
|
||||
timeCreated: 1742313498
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user