2802 lines
107 KiB
C#
2802 lines
107 KiB
C#
using asap.core;
|
||
using cfg;
|
||
using Game;
|
||
using GameCore;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using UnityEngine;
|
||
using UniRx;
|
||
using DG.Tweening;
|
||
using tysdk;
|
||
using UnityEngine.AddressableAssets;
|
||
using Random = UnityEngine.Random;
|
||
using game;
|
||
|
||
public class OnFishChangeEvent
|
||
{
|
||
}
|
||
|
||
public class OnEatEndEvent
|
||
{
|
||
|
||
}
|
||
|
||
public class FishHPEvent
|
||
{
|
||
public FishSkill fishSkill;
|
||
public float HPPercent = -1;
|
||
public float MaxDelay = -1;
|
||
}
|
||
|
||
public class FishingUpdateSys : MonoBehaviour
|
||
{
|
||
int Fish_02ShowFingerIndex = 5;
|
||
int FishEscapeShowFingerIndex = 3;
|
||
|
||
public float GuideLineMinBar = 0.5f;
|
||
public float BottleDelay = 1;
|
||
|
||
Tables _tables;
|
||
PlayerFishData playerFishData;
|
||
FishingData fishingData;
|
||
CollectingData collectingData;
|
||
bool isHold = false;
|
||
float AllDamageTime = 0;
|
||
bool isEat = false;
|
||
|
||
private List<FishHPEvent> _fishHPEventList;
|
||
FishSkill currentEvent;
|
||
FishSkill nextEvent;
|
||
Coroutine _hpcoroutine;
|
||
private float _barBack; //进度条后退速度
|
||
|
||
private float _barSpeed; //进度条前进速度
|
||
|
||
private float _fishSpeed; //鱼的移动速度
|
||
float _aniSpeed = 1;
|
||
float FishAnimSpeed;//基于力量和速度属性的参数
|
||
private float _nearDistance; //移动最近距离参数
|
||
private float _farDistance;//移动最远距离参数
|
||
// 鱼的当前血量
|
||
private float _fishCurrentHealth;
|
||
//上一个血量事件
|
||
private float _lastHealth;
|
||
private float _lastHealthTime;
|
||
// 鱼的最大血量
|
||
private float _fishMaxHealth;
|
||
// 连击倍率
|
||
private float _comboMultiplayer;
|
||
// 连击倍率
|
||
private float _curComboMultiplayer;
|
||
// 力量值
|
||
private float _linePower;
|
||
int _linePowerType;
|
||
float noComboTime = 0;
|
||
//刺鱼状态保持时间
|
||
float _fullFishStayTime = 0.5f;
|
||
public float ComboZone;
|
||
float ComboBarIncAmp;
|
||
float ComboBarDecAmp;
|
||
float curComboBarDecAmp;
|
||
int _isCombo = 0;
|
||
bool lockCombo = false;
|
||
IDisposable _comboDisposable;
|
||
bool isShowCombo = false;//是否显示连击数和能够连击
|
||
bool isCanCombo = false;//是否能够显示连击数和能够连击
|
||
float comboSpeedAdd = 1;
|
||
float _limitStayTime;
|
||
|
||
bool escapeFish = false;
|
||
bool escapeFishStart = false;
|
||
bool jumpFish = false;
|
||
|
||
|
||
#region 鱼竿或鱼数据
|
||
float MinDrawingHP;
|
||
float ExtraDrawingHP;
|
||
float MaxDrawingHP;
|
||
float ComboDrawingHP;
|
||
float ComboInc;
|
||
//颤抖动画position的缩放比例
|
||
float BarShakeMinAmp;
|
||
float BarShakeMaxAmp;
|
||
float BarShakeBounceRand;
|
||
//float MaxLinelength;
|
||
//进度条的影响
|
||
float speedRandA;
|
||
float speedRandB;
|
||
float speedRandValue;
|
||
/// 鱼的力量对进度条前进速度的影响
|
||
float maxStruggling;
|
||
//鱼的力量对颤抖前进数值的影响
|
||
float barIncreaseShake = 1;
|
||
float frowardPressTime;
|
||
float backPressTime;
|
||
float barDecreasShake = 1;
|
||
float frowardLooseTime;
|
||
float backLooseTime;
|
||
bool frowarding = true;
|
||
float minDamp;
|
||
float maxDamp;
|
||
float barDecrease;
|
||
float barIncrease;
|
||
//技能蓄力延迟
|
||
float FishSkillChargingDelay;
|
||
//逃跑蓄力延迟
|
||
float FishEscapeChargingDelay;
|
||
// 鱼竿远游抵抗
|
||
float FishDistanceResist;
|
||
//鱼竿速度抵抗
|
||
float FishSpeedResist;
|
||
//鱼竿阻力抵抗
|
||
float FishPowerResist;
|
||
//鱼竿逃跑速度抵抗
|
||
float FishEscapeSpeedResist;
|
||
//鱼竿稳定性抵抗
|
||
float FishComboScaleResist;
|
||
//刺鱼手感
|
||
string NewPiercingZone1;
|
||
string NewPiercingZone2;
|
||
public int WaitingZone
|
||
{
|
||
get
|
||
{
|
||
if (string.IsNullOrEmpty(NewPiercingZone1))
|
||
{
|
||
return fishingData.fishRodData.WaitingZone;
|
||
}
|
||
else
|
||
{
|
||
string waitingZone = NewPiercingZone1;
|
||
return int.Parse(waitingZone);
|
||
}
|
||
}
|
||
}
|
||
public List<int> WaitingSequence
|
||
{
|
||
get
|
||
{
|
||
if (string.IsNullOrEmpty(NewPiercingZone2))
|
||
{
|
||
return fishingData.fishRodData.WaitingSequence;
|
||
}
|
||
else
|
||
{
|
||
string waitingSequence = NewPiercingZone2;
|
||
return waitingSequence.Split(';').Select(int.Parse).ToList();
|
||
}
|
||
}
|
||
}
|
||
//鱼的力量对4个区域大小的影响
|
||
public List<float> StrengthToScale { get; private set; }
|
||
#endregion
|
||
|
||
float fishingFailProgressLeft = 0;
|
||
float fishingFailProgressRight = 0;
|
||
public float FishingFailProgressLeft => fishingFailProgressLeft > _tables.TbGlobalConfig.FishingFailProgress ? fishingFailProgressLeft : _tables.TbGlobalConfig.FishingFailProgress;
|
||
public float FishingFailProgressRight => fishingFailProgressRight > _tables.TbGlobalConfig.FishingFailProgress ? fishingFailProgressRight : _tables.TbGlobalConfig.FishingFailProgress;
|
||
|
||
//private float HoldVibrationInterval = 0;
|
||
//秒伤
|
||
float DamageIntervalTime = 0;
|
||
float damageProtectionTime = 0;
|
||
int curDamageIndex = 0;
|
||
//新的特性
|
||
Dictionary<RodPerkType, (int, int)> perkLevel = new Dictionary<RodPerkType, (int, int)>();
|
||
float AllToCrit = 0;//全程暴击
|
||
float curAddAtkSpeed = 0;//触发增攻速
|
||
|
||
float atkSpeedPro = 0;//全程触发增攻速
|
||
float atkSpeedCD = 1;//全程触发增攻速
|
||
float curAtkSpeedCD = 0;//全程触发增攻速
|
||
float stkSpeed = 0;//全程触发增攻速
|
||
|
||
float ComboToAtkSpeed = 0;//全力收线触发暴击(命名错误)
|
||
|
||
float comboToExDmg = 0;//全力收线触发增伤
|
||
float curComboToExDmg = 0;//全力收线触发增伤
|
||
int comboToExDmgCount = 0;//全力收线触发增伤
|
||
int curComboToExDmgCount = 0;//全力收线触发增伤
|
||
|
||
float ComboToCombo = 0;//全力收线触发连击进度
|
||
float ComboToComboMin = 0;//全力收线触发连击进度
|
||
float ComboToComboMax = 0;//全力收线触发连击进度
|
||
|
||
float fishSkillToAtkSpeed = 0;//技能逃跑触发增攻速
|
||
float curFishSkillToAtkSpeedDur = 0;//技能逃跑触发增攻速
|
||
float fishSkillToAtkSpeedDuration = 0;//技能触发增攻速
|
||
float fishEscapeToAtkSpeedDuration = 0;//逃跑触发增攻速
|
||
float FishEscapeToDmg = 0;//逃跑触发伤害
|
||
float EatfishToDmg = 0;//吃鱼触发伤害
|
||
float piercingToComboA = 0;//刺鱼触发全力收线进度
|
||
float piercingToComboB = 0;//刺鱼触发全力收线进度
|
||
float PiercingCrit = 0;//刺鱼触发暴击
|
||
float PiercingCritDmg = 0;//刺鱼触发暴击
|
||
float PiercingAddDamageTime = 0;//刺鱼触发增伤
|
||
float PiercingAddDamage = 0;//刺鱼触发增伤
|
||
float tensionToCritA = 0;//张力触发暴击
|
||
float tensionToCritB = 0;//张力触发暴击
|
||
public float NeverOvertensionToCrit = 0;//永不张力过大
|
||
float NOCrit = 0;//永不张力过大,暴击
|
||
float Titan1;
|
||
float Titan2;
|
||
//颤抖抵抗
|
||
float FishShakeResist;
|
||
//连击区大小提高
|
||
float ComboZoneScale;
|
||
|
||
//鱼受到的阻力变化加值
|
||
float strugglingPowerInc;
|
||
|
||
float speedInc = 0;
|
||
float viliganceInc = 0;
|
||
|
||
float strugglingReverse = 1;
|
||
//移动速度百分比增加
|
||
float dashSpeedPercentInc = 1; //技能表现额外移动速度
|
||
|
||
float EscapeSpeedMag = 1;
|
||
|
||
IFishingState curFishingState;
|
||
FishingStateName curFishingStateName;
|
||
|
||
//收线音效
|
||
Sound soundLine;
|
||
Sound soundReeling;
|
||
Sound soundNotReeling;
|
||
Sound soundDrawingSplash;
|
||
|
||
AudioClip lineAudio;
|
||
AudioClip notReelingAudio;
|
||
AudioClip reelingAudio;
|
||
AudioClip drawingSplash;
|
||
|
||
//全力收线杆音效
|
||
// combo音效
|
||
Sound soundCombo;
|
||
AudioClip audioClipL;
|
||
AudioClip audioClipLoop;
|
||
AudioClip maxcombo_out_general;
|
||
bool isFailFxScreenWarning = false;
|
||
bool isFail = false;
|
||
bool isFail1 = false, isFail2 = false;
|
||
float FailDelayTime = 0;
|
||
FishingBehaviorB fishingBehavior;
|
||
RodSkinData rodSkinData;
|
||
protected CompositeDisposable disposables = new CompositeDisposable();
|
||
|
||
public IFishSpSkillData fishSpSkillData;
|
||
|
||
BarTarget barTarget;
|
||
|
||
|
||
private void Awake()
|
||
{
|
||
GetFishingBehaviorB getFishingBehavior = new GetFishingBehaviorB();
|
||
GContext.Publish(getFishingBehavior);
|
||
fishingBehavior = getFishingBehavior.fishingBehavior;
|
||
_tables = GContext.container.Resolve<Tables>();
|
||
playerFishData = GContext.container.Resolve<PlayerFishData>();
|
||
fishingData = GContext.container.Resolve<FishingData>();
|
||
collectingData = GContext.container.Resolve<CollectingData>();
|
||
int skindID = GContext.container.Resolve<PlayerFishData>().GetRodSkin(fishingData.RodId);
|
||
rodSkinData = _tables.TbRodSkinData.GetOrDefault(skindID);
|
||
GContext.OnEvent<OnFishChangeEvent>().Subscribe(OnFishChange).AddTo(disposables);
|
||
GContext.OnEvent<OnEatEndEvent>().Subscribe(OnEatEnd).AddTo(disposables);
|
||
if (playerFishData.GetAnglingCount() == 0)
|
||
{
|
||
_comboDisposable?.Dispose();
|
||
_comboDisposable = GContext.OnEvent<AddIndexEvent>().Subscribe(ShowComboTipsGuide);
|
||
}
|
||
}
|
||
private void OnEnable()
|
||
{
|
||
isFailCount = 0;
|
||
|
||
// 初始化连击倍率
|
||
_comboMultiplayer = 0f;
|
||
_curComboMultiplayer = 0f;
|
||
fishingData.jerking_count = 0;
|
||
fishingData.stickle_state = 0;
|
||
OnFishChange(null);
|
||
CastLine();
|
||
LoadRodSound();
|
||
}
|
||
async void LoadRodSound()
|
||
{
|
||
lineAudio = await Addressables.LoadAssetAsync<AudioClip>(rodSkinData.LineAudio).Task;
|
||
reelingAudio = await Addressables.LoadAssetAsync<AudioClip>(rodSkinData.ReelingAudio).Task;
|
||
notReelingAudio = await Addressables.LoadAssetAsync<AudioClip>(rodSkinData.NotReelingAudio).Task;
|
||
drawingSplash = await Addressables.LoadAssetAsync<AudioClip>("audio_fishing_drawing_splash").Task;
|
||
|
||
audioClipL = await Addressables.LoadAssetAsync<AudioClip>("audio_ui_fishing_maxcombo_into_general").Task;
|
||
audioClipLoop = await Addressables.LoadAssetAsync<AudioClip>("audio_ui_fishing_maxcombo_loop_general").Task;
|
||
maxcombo_out_general = await Addressables.LoadAssetAsync<AudioClip>("audio_ui_fishing_maxcombo_out_general").Task;
|
||
}
|
||
|
||
void AudioRelease()
|
||
{
|
||
Addressables.Release(lineAudio);
|
||
Addressables.Release(reelingAudio);
|
||
Addressables.Release(notReelingAudio);
|
||
Addressables.Release(drawingSplash);
|
||
Addressables.Release(audioClipL);
|
||
Addressables.Release(audioClipLoop);
|
||
Addressables.Release(maxcombo_out_general);
|
||
}
|
||
public void OnFishChange(OnFishChangeEvent onFishChangeEvent)
|
||
{
|
||
InitData();
|
||
InitHP();
|
||
var fishSKillList = fishingData.curFishData.FishSKillList;
|
||
_fishHPEventList = new List<FishHPEvent>();
|
||
for (int i = 0; i < fishSKillList.Count; i++)
|
||
{
|
||
if (fishSKillList[i].HPPercent[0] > 0 || fishSKillList[i].MaxDelay[0] > 0)
|
||
{
|
||
FishHPEvent fishHPEvent = new FishHPEvent();
|
||
fishHPEvent.fishSkill = fishSKillList[i];
|
||
if (fishSKillList[i].HPPercent.Count > 1 && fishSKillList[i].HPPercent[0] > 0)
|
||
{
|
||
fishHPEvent.HPPercent = Random.Range(fishSKillList[i].HPPercent[0], fishSKillList[i].HPPercent[1]);
|
||
}
|
||
if (fishSKillList[i].MaxDelay.Count > 1 && fishSKillList[i].MaxDelay[0] > 0)
|
||
{
|
||
fishHPEvent.MaxDelay = Random.Range(fishSKillList[i].MaxDelay[0], fishSKillList[i].MaxDelay[1]);
|
||
}
|
||
_fishHPEventList.Add(fishHPEvent);
|
||
}
|
||
}
|
||
|
||
FishSkill fishEscape = fishingData.curFishData.FishEscape;
|
||
if (fishEscape.HPPercent[0] > 0 || fishEscape.MaxDelay[0] > 0)
|
||
{
|
||
FishHPEvent fishHPEvent = new FishHPEvent();
|
||
fishHPEvent.fishSkill = fishEscape;
|
||
if (fishEscape.HPPercent.Count > 1 && fishEscape.HPPercent[0] > 0)
|
||
{
|
||
fishHPEvent.HPPercent = Random.Range(fishEscape.HPPercent[0], fishEscape.HPPercent[1]);
|
||
}
|
||
if (fishEscape.MaxDelay.Count > 1 && fishEscape.MaxDelay[0] > 0)
|
||
{
|
||
fishHPEvent.MaxDelay = Random.Range(fishEscape.MaxDelay[0], fishEscape.MaxDelay[1]);
|
||
}
|
||
|
||
float statsChange = collectingData.StatsChange(6);
|
||
if (statsChange < 0.999f)
|
||
{
|
||
fishHPEvent.HPPercent += statsChange;
|
||
}
|
||
_fishHPEventList.Add(fishHPEvent);
|
||
}
|
||
}
|
||
|
||
public void CastLine()
|
||
{
|
||
_linePower = 0.5f;
|
||
_curComboMultiplayer = 0;
|
||
_comboMultiplayer = 0;
|
||
_isCombo = 0;
|
||
fishingData.startTimer = Time.time;
|
||
InitRodExtra();
|
||
|
||
fishingBehavior?.CastLineBehavior();
|
||
}
|
||
void InitHP()
|
||
{
|
||
// 初始化鱼的最大血量
|
||
_fishMaxHealth = fishingData.curFishData.HP * collectingData.StatsChange(3);
|
||
|
||
if (fishingData.IsRetry)
|
||
{
|
||
Debug.Log("FishingRetryHPReduction :" + fishingData.FishingRetryHPReduction);
|
||
_fishMaxHealth *= fishingData.FishingRetryHPReduction;
|
||
}
|
||
|
||
MapData data = _tables.TbMapData.GetOrDefault(GContext.container.Resolve<PlayerData>().lastMapId);
|
||
if (data != null)
|
||
{
|
||
_fishMaxHealth *= data.FishHPMag;
|
||
}
|
||
// 初始化鱼的血量
|
||
_fishCurrentHealth = _fishMaxHealth;
|
||
}
|
||
//开始钓鱼 包括重钓
|
||
private void InitData()
|
||
{
|
||
// 初始化上一个事件血量%
|
||
_lastHealth = 2;
|
||
_lastHealthTime = -1;
|
||
// 初始化鱼咬钩的概率
|
||
// _fishBiteChance = 0.6f;
|
||
// 初始化力量值
|
||
_linePower = 0.5f;
|
||
|
||
//_longPressTime = 0f;
|
||
_limitStayTime = 0f;
|
||
escapeFish = false;
|
||
escapeFishStart = false;
|
||
jumpFish = false;
|
||
struggleing = false;
|
||
EscapeSpeedMag = 1;
|
||
}
|
||
void OnSpeedIncChange()
|
||
{
|
||
var FishSpeedParam = _tables.TbFishStatsConfig.FishSpeedParam;
|
||
fishingData.FishSpeed = Mathf.Clamp(FishSpeedParam[2] + (fishingData.Speed + speedInc) * FishSpeedParam[3], FishSpeedParam[0], FishSpeedParam[1]);
|
||
var speedRandParam = _tables.TbFishStatsConfig.SpeedToBarIncreaseRand;
|
||
speedRandA = Mathf.Clamp(speedRandParam[2] + (fishingData.Speed + speedInc) * speedRandParam[3], speedRandParam[0], speedRandParam[1]);
|
||
speedRandB = Mathf.Clamp(speedRandParam[4] + (fishingData.Speed + speedInc) * speedRandParam[5], speedRandParam[0], speedRandParam[1]);
|
||
}
|
||
void OnPowerIncChange()
|
||
{
|
||
var strengthToBarIncrease = _tables.TbFishStatsConfig.StrengthToBarIncrease;
|
||
float power = fishingData.StrugglingPower + strugglingPowerInc;
|
||
float _maxStruggling = power * strengthToBarIncrease[3];
|
||
if (power > strengthToBarIncrease[2])
|
||
{
|
||
power -= strengthToBarIncrease[2];
|
||
_maxStruggling += power * (strengthToBarIncrease[4] - strengthToBarIncrease[3]);
|
||
}
|
||
maxStruggling = Mathf.Clamp(_maxStruggling, strengthToBarIncrease[0], strengthToBarIncrease[1]);
|
||
|
||
var fishSkillPerformInc = _tables.TbFishStatsConfig.FishSkillPerformIncParam;
|
||
fishingData.FishSkillIncPerform = fishSkillPerformInc[2] + (fishingData.StrugglingPower + strugglingPowerInc) * fishSkillPerformInc[3];
|
||
fishingData.FishSkillIncPerform = Mathf.Clamp(fishingData.FishSkillIncPerform, fishSkillPerformInc[0], fishSkillPerformInc[1]);
|
||
|
||
var fishSkillPerformDec = _tables.TbFishStatsConfig.FishSkillPerformDecParam;
|
||
fishingData.FishSkillDecPerform = fishSkillPerformDec[2] + (fishingData.StrugglingPower + strugglingPowerInc) * fishSkillPerformDec[3];
|
||
fishingData.FishSkillDecPerform = Mathf.Clamp(fishingData.FishSkillDecPerform, fishSkillPerformDec[0], fishSkillPerformDec[1]);
|
||
}
|
||
void StopSkill()
|
||
{
|
||
fishingBehavior?.SkillRelease();
|
||
FishingPanel_Advanced.Instance?.SkillRelease();
|
||
|
||
if (fishSpSkillData != null)
|
||
{
|
||
fishSpSkillData.EndSkill();
|
||
}
|
||
|
||
if (currentEvent != null)
|
||
{
|
||
FishingPanel_Advanced.Instance?.PlayBarAni(currentEvent.ShakeAnimation, false);
|
||
}
|
||
GContext.Publish(new UISkillShow() { isStart = false });
|
||
currentEvent = null;
|
||
nextEvent = null;
|
||
if (_hpcoroutine != null)
|
||
{
|
||
StopCoroutine(_hpcoroutine);
|
||
_hpcoroutine = null;
|
||
}
|
||
fishingData.FishSkillPerformSpeed = 1;
|
||
fishingData.FishSkillPerformBack = 1;
|
||
viliganceInc = 0;
|
||
OnViliganceIncChange();
|
||
strugglingPowerInc = 0;
|
||
//fishingData.StrugglingPower = fishingData.curFishData.StrugglingPower;
|
||
OnPowerIncChange();
|
||
speedInc = 0;
|
||
OnSpeedIncChange();
|
||
|
||
fishingData.MaxZEscape = 0;
|
||
fishingData.MaxYEscape = 0;
|
||
DOTween.Kill("StrugglingReverse");
|
||
strugglingReverse = 1;
|
||
//if (fishingFailProgressLeft > 0)
|
||
//{
|
||
// fishingFailProgressLeft = 0;
|
||
//}
|
||
dashSpeedPercentInc = 1;
|
||
fishingBehavior?.StartSplashloopScale();
|
||
if (fishingData.DashStayTime > 0)
|
||
{
|
||
fishingBehavior?.fx_fishing_splashloopreeling.SetActive(false);
|
||
}
|
||
fishingData.DashStayTime = -1;
|
||
fishingData.FishStruggle = null;
|
||
fishingData.FishJump = null;
|
||
isEat = false;
|
||
struggleing = false;
|
||
if (fishingBehavior?.FishBehaviour)
|
||
{
|
||
fishingBehavior.FishBehaviour.transform.DOKill();
|
||
fishingBehavior?.FishBehaviour.PlaySwim01();
|
||
fishingBehavior.FishBehaviour.transform.localPosition = Vector3.zero;
|
||
}
|
||
}
|
||
int isFailCount = 0;
|
||
// 按了收线按钮
|
||
public void PiercingFish(int waitingZone)
|
||
{
|
||
//waitingZone==100表示鱼没有开启刺鱼
|
||
if (!fishingData.IsDrawing)
|
||
{
|
||
curDamageIndex = 0;
|
||
isFail1 = false;
|
||
isFail2 = false;
|
||
isFail = false;
|
||
AllDamageTime = 0;
|
||
if (waitingZone <= 0)
|
||
{
|
||
//fishingBehavior?.Waiting01();
|
||
//FishingPanel_Advanced.Instance?.FishEscape();
|
||
|
||
//return;
|
||
waitingZone = 1;
|
||
}
|
||
if (waitingZone == 3)
|
||
{
|
||
GContext.Publish(new ConditionTypeEvent(ConditionType.PerfectStrikeCount, 1));
|
||
}
|
||
|
||
fishingData.stickle_state = waitingZone;
|
||
isFailCount = 0;
|
||
isShowUI = false;
|
||
//连击区重置
|
||
isShowCombo = playerFishData.GetAnglingCount() >= _tables.TbGlobalConfig.MaxComboUnlockFish - 1;
|
||
isCanCombo = playerFishData.GetAnglingCount() >= _tables.TbGlobalConfig.MaxComboUnlockFish;
|
||
var ComboCountAccelerateFactor = _tables.TbGlobalConfig.ComboCountAccelerateFactor;
|
||
if (playerFishData.GetAnglingCount() < ComboCountAccelerateFactor.Count)
|
||
{
|
||
comboSpeedAdd = ComboCountAccelerateFactor[playerFishData.GetAnglingCount()];
|
||
}
|
||
else
|
||
{
|
||
comboSpeedAdd = 1;
|
||
}
|
||
|
||
StopSkill();
|
||
frowarding = true;
|
||
barIncreaseShake = 0;
|
||
barDecreasShake = 0;
|
||
SetComboZone();
|
||
SetFishSpeed();
|
||
|
||
fishingBehavior?.LoadEffect("fx_fishing_splashwaveloop");
|
||
fishingBehavior?.StartDrawing();
|
||
|
||
GContext.Publish(new VibrationData(HapticTypes.MediumImpact));
|
||
bool isEternalDeath = false;
|
||
if (waitingZone < 100)
|
||
{
|
||
GContext.Publish(new VibrationData(10 + waitingZone));
|
||
var WaitingZone = GContext.container.Resolve<Tables>().TbRodWaitingZone.GetOrDefault(
|
||
fishingData.fishRodData.WaitingZone);
|
||
var ZoneRandom = WaitingZone.ZoneExtraDamageRandom[waitingZone];
|
||
float extraDrawingHP = MaxDrawingHP * ExtraDrawingHP
|
||
* (1 + fishingData.CardDamageMag) * (1 + fishingData.EventFishDamageMag)
|
||
* WaitingZone.ZoneExtraDamage[waitingZone]
|
||
* (1 - ZoneRandom / 2 + Random.Range(0, ZoneRandom));
|
||
|
||
if (PiercingCrit > 0 && PiercingCrit > Random.value)
|
||
{
|
||
if (PiercingCritDmg > 0)
|
||
{
|
||
extraDrawingHP *= (1 + PiercingCritDmg);
|
||
//新技能生效 刺鱼触发暴击
|
||
PublishPerkEvent(RodPerkType.BattlePerk_PiercingCritDmg);
|
||
}
|
||
else
|
||
{
|
||
extraDrawingHP *= 2;
|
||
}
|
||
}
|
||
_fishCurrentHealth -= extraDrawingHP;
|
||
isEternalDeath = false;// _fishCurrentHealth < 0.001f && fishingData.fishEatDataList.Count == 0;
|
||
//刺鱼伤害
|
||
fishingBehavior?.PiercingIndex(waitingZone, isEternalDeath);
|
||
damageProtectionTime = fishingData.fishingBehaviorConf.damageProtectionTime;
|
||
FishingPanel_Advanced.Instance?.ExtraDrawingHP(extraDrawingHP, waitingZone, _fishCurrentHealth / _fishMaxHealth,
|
||
damageProtectionTime, isEternalDeath);
|
||
PiercingToComboB();
|
||
}
|
||
else
|
||
{
|
||
fishingBehavior?.PiercingIndex(1, false);
|
||
damageProtectionTime = fishingData.fishingBehaviorConf.damageProtectionTime;
|
||
FishingPanel_Advanced.Instance?.StartDrawing(damageProtectionTime);
|
||
}
|
||
PlayNewItem();
|
||
ChangeFishingState(FishingStateName.Move);
|
||
PlayDrawingSplash();
|
||
escapeFish = false;
|
||
escapeFishStart = false;
|
||
jumpFish = false;
|
||
//if (fishingData.IsDuel)
|
||
//{
|
||
// var fishingDuelManager = GContext.container.Resolve<FishingDuelManager>();
|
||
// if (fishingDuelManager != null)
|
||
// {
|
||
// fishingDuelManager.OnFishingChangeStateEvent(FishingChangeState.StartFishing, fishingData.fishItem.ID);
|
||
// }
|
||
//}
|
||
if (isEternalDeath)
|
||
{
|
||
EternalDeath();
|
||
}
|
||
else
|
||
{
|
||
fishingData.IsDrawing = true;
|
||
}
|
||
}
|
||
}
|
||
async void PiercingToComboB()
|
||
{
|
||
if (piercingToComboB > 0)
|
||
{
|
||
await Awaiters.Seconds(damageProtectionTime);
|
||
_comboMultiplayer += Random.Range(piercingToComboA, piercingToComboB);
|
||
//新技能生效 刺鱼触发全力收线进度
|
||
PublishPerkEvent(RodPerkType.BattlePerk_PiercingToCombo);
|
||
UpdateComboMultiplayer();
|
||
}
|
||
}
|
||
public async void EternalDeath()
|
||
{
|
||
await Awaiters.Seconds(damageProtectionTime);
|
||
|
||
StopAllCoroutines();
|
||
OnFishingIsOver();
|
||
}
|
||
void SetRodPerkValue(Dictionary<RodPerkType, string> RodPerkDic)
|
||
{
|
||
FishSkillChargingDelay = playerFishData.GetRodPerkValue(RodPerkType.FishSkillChargingDelay, RodPerkDic);
|
||
FishEscapeChargingDelay = playerFishData.GetRodPerkValue(RodPerkType.FishEscapeChargingDelay, RodPerkDic);
|
||
FishComboScaleResist = playerFishData.GetRodPerkValue(RodPerkType.FishComboScaleResist, RodPerkDic);
|
||
FishPowerResist = playerFishData.GetRodPerkValue(RodPerkType.FishPowerResist, RodPerkDic);
|
||
FishSpeedResist = playerFishData.GetRodPerkValue(RodPerkType.FishSpeedResist, RodPerkDic);
|
||
FishEscapeSpeedResist = playerFishData.GetRodPerkValue(RodPerkType.FishEscapeSpeedResist, RodPerkDic);
|
||
FishDistanceResist = playerFishData.GetRodPerkValue(RodPerkType.FishDistanceResist, RodPerkDic);
|
||
FishShakeResist = playerFishData.GetRodPerkValue(RodPerkType.FishShakeResist, RodPerkDic);
|
||
fishingData.EnhancedWaitingTime = playerFishData.GetRodPerkValue(RodPerkType.EnhancedWaitingTime, RodPerkDic);
|
||
}
|
||
void SetNewPerk(Dictionary<RodPerkType, string> RodPerkDic)
|
||
{
|
||
AllToCrit = playerFishData.GetRodPerkValue(RodPerkType.BattlePerk_AllToCrit, RodPerkDic);
|
||
|
||
string battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_AllToAtkSpeed, "");
|
||
atkSpeedPro = 0;
|
||
atkSpeedCD = 1;
|
||
curAtkSpeedCD = 0;
|
||
stkSpeed = 0;
|
||
curAddAtkSpeed = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 3)
|
||
{
|
||
atkSpeedPro = float.Parse(battlePerkStrs[0]);
|
||
atkSpeedCD = float.Parse(battlePerkStrs[1]);
|
||
stkSpeed = float.Parse(battlePerkStrs[2]);
|
||
}
|
||
}
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_ComboToExDmg, "");
|
||
comboToExDmg = 0;
|
||
curComboToExDmg = 0;
|
||
comboToExDmgCount = 0;
|
||
curComboToExDmgCount = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
comboToExDmg = float.Parse(battlePerkStrs[0]);
|
||
comboToExDmgCount = int.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_ComboToCombo, "");
|
||
ComboToCombo = 0;
|
||
ComboToComboMin = 0;
|
||
ComboToComboMax = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 3)
|
||
{
|
||
ComboToCombo = float.Parse(battlePerkStrs[0]);
|
||
ComboToComboMin = float.Parse(battlePerkStrs[1]);
|
||
ComboToComboMax = float.Parse(battlePerkStrs[2]);
|
||
}
|
||
}
|
||
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_FishSkillToAtkSpeed, "");
|
||
fishSkillToAtkSpeed = 0;
|
||
fishSkillToAtkSpeedDuration = 0;
|
||
curFishSkillToAtkSpeedDur = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
fishSkillToAtkSpeed = float.Parse(battlePerkStrs[0]);
|
||
fishSkillToAtkSpeedDuration = float.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_FishEscapeToAtkSpeed, "");
|
||
fishEscapeToAtkSpeedDuration = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
fishSkillToAtkSpeed = float.Parse(battlePerkStrs[0]);
|
||
fishEscapeToAtkSpeedDuration = float.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
FishEscapeToDmg = playerFishData.GetRodPerkValue(RodPerkType.BattlePerk_FishEscapeToDmg, RodPerkDic);
|
||
EatfishToDmg = playerFishData.GetRodPerkValue(RodPerkType.BattlePerk_EatfishToDmg, RodPerkDic);
|
||
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_PiercingToCombo, "");
|
||
piercingToComboA = 0;
|
||
piercingToComboB = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
piercingToComboA = float.Parse(battlePerkStrs[0]);
|
||
piercingToComboB = float.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_PiercingCritDmg, "");
|
||
PiercingCrit = 0;
|
||
PiercingCritDmg = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
PiercingCrit = float.Parse(battlePerkStrs[0]);
|
||
PiercingCritDmg = float.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
PiercingAddDamageTime = 0;
|
||
PiercingAddDamage = 0;
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_PiercingAddDamage, "");
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
PiercingAddDamageTime = float.Parse(battlePerkStrs[0]);
|
||
PiercingAddDamage = float.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
battlePerkStr = RodPerkDic.GetValueOrDefault(RodPerkType.BattlePerk_TensionToCrit, "");
|
||
tensionToCritA = 0;
|
||
tensionToCritB = 0;
|
||
if (!string.IsNullOrEmpty(battlePerkStr))
|
||
{
|
||
var battlePerkStrs = battlePerkStr.Split('|');
|
||
if (battlePerkStrs.Length == 2)
|
||
{
|
||
tensionToCritA = float.Parse(battlePerkStrs[0]);
|
||
tensionToCritB = float.Parse(battlePerkStrs[1]);
|
||
}
|
||
}
|
||
|
||
ComboToAtkSpeed = playerFishData.GetRodPerkValue(RodPerkType.BattlePerk_ComboToAtkSpeed, RodPerkDic);
|
||
NeverOvertensionToCrit = playerFishData.GetRodPerkValue(RodPerkType.BattlePerk_NeverOvertension, RodPerkDic);
|
||
}
|
||
void InitRodExtra()
|
||
{
|
||
TbRodOperatingStats RodOperatingStatsAdvanced = _tables.TbRodOperatingStats;
|
||
int star = playerFishData.GetRodPiece(fishingData.fishRodData.ID);
|
||
perkLevel = playerFishData.GetRodPerkLevel(fishingData.fishRodData.ID, star);
|
||
Dictionary<RodPerkType, string> RodPerkDic = playerFishData.GetRodPerk(fishingData.fishRodData.ID, star);
|
||
SetRodPerkValue(RodPerkDic);
|
||
//新增1001~1062
|
||
SetNewPerk(RodPerkDic);
|
||
ExtraDrawingHP = fishingData.fishRodData.PiercingAmp;
|
||
ComboDrawingHP = fishingData.fishRodData.PowerReelAmp;
|
||
|
||
//===============属性===================
|
||
var valuesInt = playerFishData.GetRodAttribute(fishingData.fishRodData.ID);
|
||
List<float> values = new List<float>();
|
||
float perkValue;
|
||
for (int i = 0; i < valuesInt.Count; i++)
|
||
{
|
||
perkValue = playerFishData.GetRodPerkValue(RodPerkType.AscentBasicStat_1 + i, RodPerkDic);
|
||
values.Add(valuesInt[i] * (1 + perkValue));
|
||
}
|
||
|
||
MaxDrawingHP = playerFishData.GetAscendValue(values[0], RodOperatingStatsAdvanced.MaxDrawingHP);
|
||
|
||
ComboInc = playerFishData.GetAscendValue(values[1], RodOperatingStatsAdvanced.ComboInc);
|
||
float EnhancedComboZoneScale = valuesInt[1] * (1 + playerFishData.GetRodPerkValue(RodPerkType.EnhancedComboZoneScale, RodPerkDic));
|
||
ComboZoneScale = playerFishData.GetAscendValue(EnhancedComboZoneScale, RodOperatingStatsAdvanced.ComboZoneScale);
|
||
string FactoryLabel_ScaleG = RodPerkDic.GetValueOrDefault(RodPerkType.FactoryLabel_ScaleG, "");
|
||
if (!string.IsNullOrEmpty(FactoryLabel_ScaleG))
|
||
{
|
||
var FactoryLabel_ScaleGs = FactoryLabel_ScaleG.Split('|');
|
||
if (FactoryLabel_ScaleGs.Length == 2)
|
||
{
|
||
ComboZoneScale *= (1 + float.Parse(FactoryLabel_ScaleGs[0]));
|
||
if (FactoryLabel_ScaleGs[1] != "0")
|
||
{
|
||
FishPowerResist = float.Parse(FactoryLabel_ScaleGs[1]);
|
||
}
|
||
}
|
||
}
|
||
string FactoryLabel_Ilmarinen = RodPerkDic.GetValueOrDefault(RodPerkType.FactoryLabel_Ilmarinen, "");
|
||
if (!string.IsNullOrEmpty(FactoryLabel_Ilmarinen))
|
||
{
|
||
var FactoryLabel_Ilmarinens = FactoryLabel_Ilmarinen.Split('|');
|
||
if (FactoryLabel_Ilmarinens.Length == 2)
|
||
{
|
||
ComboInc *= (1 + float.Parse(FactoryLabel_Ilmarinens[0]));
|
||
if (FactoryLabel_Ilmarinens[1] != "0")
|
||
{
|
||
ComboDrawingHP *= (1 + float.Parse(FactoryLabel_Ilmarinens[1]));
|
||
}
|
||
}
|
||
}
|
||
|
||
string FactoryLabel_ChromaCast = RodPerkDic.GetValueOrDefault(RodPerkType.FactoryLabel_ChromaCast, "");
|
||
if (!string.IsNullOrEmpty(FactoryLabel_ChromaCast))
|
||
{
|
||
var FactoryLabel_ChromaCasts = FactoryLabel_ChromaCast.Split('|');
|
||
if (FactoryLabel_ChromaCasts.Length == 2)
|
||
{
|
||
ComboZoneScale *= (1 + float.Parse(FactoryLabel_ChromaCasts[0]));
|
||
if (FactoryLabel_ChromaCasts[1] != "0")
|
||
{
|
||
FishEscapeSpeedResist = float.Parse(FactoryLabel_ChromaCasts[1]);
|
||
}
|
||
}
|
||
}
|
||
|
||
fishingData.MaxLinelength = playerFishData.GetAscendValue(values[2], new List<float> { _tables.TbGlobalConfig.LineLengthParam });
|
||
NewPiercingZone1 = "";
|
||
NewPiercingZone2 = "";
|
||
string NewPiercingZone = RodPerkDic.GetValueOrDefault(RodPerkType.NewPiercingZone, "");
|
||
if (!string.IsNullOrEmpty(NewPiercingZone))
|
||
{
|
||
var NewPiercingZones = NewPiercingZone.Split('|');
|
||
if (NewPiercingZones.Length == 2)
|
||
{
|
||
NewPiercingZone1 = NewPiercingZones[0];
|
||
NewPiercingZone2 = NewPiercingZones[1];
|
||
}
|
||
}
|
||
NewPiercingZone = RodPerkDic.GetValueOrDefault(RodPerkType.FactoryLabel_Victoria, "");
|
||
if (!string.IsNullOrEmpty(NewPiercingZone))
|
||
{
|
||
var NewPiercingZones = NewPiercingZone.Split('|');
|
||
if (NewPiercingZones.Length == 3)
|
||
{
|
||
ExtraDrawingHP *= (1 + float.Parse(NewPiercingZones[0]));
|
||
if (NewPiercingZones[1] != "0")
|
||
{
|
||
NewPiercingZone1 = NewPiercingZones[1];
|
||
}
|
||
if (NewPiercingZones[2] != "0")
|
||
{
|
||
NewPiercingZone2 = NewPiercingZones[2];
|
||
}
|
||
}
|
||
}
|
||
string FactoryLabel_Sakura = RodPerkDic.GetValueOrDefault(RodPerkType.FactoryLabel_Sakura, "");
|
||
if (!string.IsNullOrEmpty(FactoryLabel_Sakura))
|
||
{
|
||
var FactoryLabel_Sakuras = FactoryLabel_Sakura.Split('|');
|
||
if (FactoryLabel_Sakuras.Length == 2)
|
||
{
|
||
ExtraDrawingHP *= (1 + float.Parse(FactoryLabel_Sakuras[0]));
|
||
if (FactoryLabel_Sakuras[1] != "0")
|
||
{
|
||
PiercingCrit = float.Parse(FactoryLabel_Sakuras[1]);
|
||
}
|
||
}
|
||
}
|
||
string Titan = RodPerkDic.GetValueOrDefault(RodPerkType.FactoryLabel_Titan, "");
|
||
if (!string.IsNullOrEmpty(Titan))
|
||
{
|
||
var Titans = Titan.Split('|');
|
||
if (Titans.Length == 2)
|
||
{
|
||
Titan1 = float.Parse(Titans[0]);
|
||
if (Titans[1] != "0")
|
||
{
|
||
Titan2 = float.Parse(Titans[1]);
|
||
}
|
||
}
|
||
}
|
||
|
||
DamageIntervalTime = 0;
|
||
|
||
float balance = fishingData.fishRodData.Balance;
|
||
|
||
BarShakeBounceRand = playerFishData.GetAscendValue(balance, RodOperatingStatsAdvanced.BarShakeBounceRand);
|
||
BarShakeMinAmp = playerFishData.GetAscendValue(balance, RodOperatingStatsAdvanced.BarShakeMinAmp);
|
||
BarShakeMaxAmp = playerFishData.GetAscendValue(balance, RodOperatingStatsAdvanced.BarShakeMaxAmp);
|
||
|
||
float reelingSpeed = fishingData.fishRodData.ReelingSpeed;
|
||
ComboBarIncAmp = playerFishData.GetAscendValue(reelingSpeed, RodOperatingStatsAdvanced.ComboBarIncAmp);
|
||
ComboBarDecAmp = playerFishData.GetAscendValue(reelingSpeed, RodOperatingStatsAdvanced.ComboBarDecAmp);
|
||
MinDrawingHP = playerFishData.GetAscendValue(reelingSpeed, RodOperatingStatsAdvanced.MinDrawingHP);
|
||
List<float> MinDamp;
|
||
List<float> MaxDamp;
|
||
if (fishingData.fishRodData.PowerType == 0)
|
||
{
|
||
MinDamp = RodOperatingStatsAdvanced.MinDampSoft;
|
||
MaxDamp = RodOperatingStatsAdvanced.MaxDampSoft;
|
||
}
|
||
else
|
||
{
|
||
MinDamp = RodOperatingStatsAdvanced.MinDampHard;
|
||
MaxDamp = RodOperatingStatsAdvanced.MaxDampHard;
|
||
}
|
||
|
||
minDamp = playerFishData.GetAscendValue(reelingSpeed, MinDamp);
|
||
maxDamp = playerFishData.GetAscendValue(reelingSpeed, MaxDamp);
|
||
|
||
List<float> BarDecrease;
|
||
List<float> BarIncrease;
|
||
if (fishingData.fishRodData.ActionType == 0)
|
||
{
|
||
BarDecrease = RodOperatingStatsAdvanced.BarDecreaseSlow;
|
||
BarIncrease = RodOperatingStatsAdvanced.BarIncreaseSlow;
|
||
}
|
||
else
|
||
{
|
||
BarDecrease = RodOperatingStatsAdvanced.BarDecreaseFast;
|
||
BarIncrease = RodOperatingStatsAdvanced.BarIncreaseFast;
|
||
}
|
||
barDecrease = playerFishData.GetAscendValue(reelingSpeed, BarDecrease);
|
||
barIncrease = playerFishData.GetAscendValue(reelingSpeed, BarIncrease);
|
||
}
|
||
void OnLimitStayTime()
|
||
{
|
||
if (_linePower < FishingFailProgressLeft + 0.01f)
|
||
{
|
||
//张力过小
|
||
isFail1 = false;
|
||
fishingData.fishingResult = FishingResult.Fail2;
|
||
}
|
||
else
|
||
{
|
||
//张力过大
|
||
isFail1 = true;
|
||
isFail2 = false;
|
||
fishingData.fishingResult = FishingResult.Fail1;
|
||
}
|
||
|
||
if (_tables.TbGlobalConfig.NoFailWithGuidance <= GContext.container.Resolve<PlayerFishData>().GetAnglingCount()
|
||
|| GContext.container.Resolve<PlayerData>().lastMapId != _tables.TbMapData.DataList[0].ID)
|
||
{
|
||
if (_linePower < FishingFailProgressLeft + 0.01f)
|
||
{
|
||
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_fail_forcetoosmall));
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_fail_forcetoobig));
|
||
}
|
||
isFail = true;
|
||
OnFishingIsOver();
|
||
}
|
||
else
|
||
{
|
||
if (isFail1)
|
||
{
|
||
GContext.container.Resolve<GuideDataCenter>().ShowGuidancePopupPanel("station_overtension");
|
||
//GContext.container.Resolve<GuideDataCenter>().TriggerGuide(GroupName.Tension01.ToString(), "FishingPanel_Advanced");
|
||
}
|
||
else
|
||
{
|
||
GContext.container.Resolve<GuideDataCenter>().ShowGuidancePopupPanel("station_undertension");
|
||
//GContext.container.Resolve<GuideDataCenter>().TriggerGuide(GroupName.Tension02.ToString(), "FishingPanel_Advanced");
|
||
}
|
||
isFail1 = false;
|
||
isFail2 = false;
|
||
fishingData.fishingResult = FishingResult.Success;
|
||
_limitStayTime = 0;
|
||
noComboTime = 0;
|
||
}
|
||
}
|
||
private void Update()
|
||
{
|
||
if (fishingData.IsDrawing)
|
||
{
|
||
Vector3 fishPos = fishingBehavior.GetFishPos();
|
||
fishingBehavior.JumpWater();
|
||
|
||
FishingPanel_Advanced.Instance?.ShowFishInfoPos(fishPos);
|
||
IsShowGuidance isShowGuidance = new IsShowGuidance();
|
||
GContext.Publish(isShowGuidance);
|
||
AllDamageTime += Time.deltaTime;
|
||
bool isShow = isShowGuidance.isShow;
|
||
|
||
//power区间值
|
||
float a = 1 - ComboZone;
|
||
isHold = false;
|
||
bool isGuideLine = false;
|
||
if (isShowGuidance.isShow)
|
||
{
|
||
isGuideLine = isShowGuidance.curIndexDes.Contains("GuidLine");
|
||
}
|
||
if (isShowUI)
|
||
{
|
||
if (curFishingStateName != FishingStateName.SpEating && _fishCurrentHealth > 0)
|
||
{
|
||
UpdateTension(a, isShowGuidance, isGuideLine);
|
||
}
|
||
else
|
||
{
|
||
isHold = true;
|
||
}
|
||
if (!isShowGuidance.isShow && barTarget != null)
|
||
{
|
||
///腐蚀进度条
|
||
if (fishSpSkillData != null && !fishSpSkillData.End && fishSpSkillData.InProgress)
|
||
{
|
||
fishingFailProgressLeft += barTarget.CorruptSpeed * Time.deltaTime;
|
||
if (fishingFailProgressLeft > barTarget.CorruptMaxPercent * a)
|
||
{
|
||
fishingFailProgressLeft = barTarget.CorruptMaxPercent * a;
|
||
}
|
||
FishingPanel_Advanced.Instance?.UpdateTargetBar(fishingFailProgressLeft);
|
||
}
|
||
else if (fishingFailProgressLeft > 0 && _isCombo == 2)
|
||
{
|
||
fishingFailProgressLeft -= barTarget.ClearSpeed * Time.deltaTime;
|
||
if (fishingFailProgressLeft < 0)
|
||
{
|
||
fishingFailProgressLeft = 0;
|
||
}
|
||
FishingPanel_Advanced.Instance?.UpdateTargetBar(fishingFailProgressLeft);
|
||
}
|
||
}
|
||
FishingPanel_Advanced.Instance?.UpdateTensionBar(_linePowerType, _linePower, fishingBehavior.fishSwimAreaZFar, fishingBehavior.fishSwimAreaZNear, fishingBehavior.LineDistance);
|
||
}
|
||
else
|
||
{
|
||
if (AllDamageTime > damageProtectionTime)
|
||
{
|
||
LooseBarShake();
|
||
isShowUI = true;
|
||
AllDamageTime = 0;
|
||
fishingBehavior?.CameraDrawing();
|
||
}
|
||
}
|
||
|
||
if (isShowGuidance.isShow && !isGuideLine)
|
||
{
|
||
fishingBehavior?.ControlFishingRodAnim(FishingStateName.Idle, 0, _nearDistance, _farDistance);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
SetFishSpeed();
|
||
float speed = _fishSpeed * curFishingState.fishMoveSpeed;
|
||
speed *= EscapeSpeedMag;
|
||
if (isShowGuidance.curGroupName == GroupName.Fish_02 && (isShowGuidance.curIndex == 7 || isShowGuidance.curIndex == 8))
|
||
{
|
||
speed = 0;
|
||
}
|
||
fishingBehavior?.ControlFishingRodAnim(curFishingStateName, speed, _nearDistance, _farDistance);
|
||
|
||
if ((isHold || _isCombo == 2) && curFishingStateName != FishingStateName.UIEating)
|
||
{
|
||
DrawingHP();
|
||
SetComboZone();
|
||
}
|
||
}
|
||
|
||
if (!isShowGuidance.isShow && nextEvent == null &&
|
||
(_tables.TbGlobalConfig.NoFail <= GContext.container.Resolve<PlayerFishData>().GetAnglingCount() || GContext.container.Resolve<PlayerData>().lastMapId != _tables.TbMapData.DataList[0].ID) &&
|
||
(curFishingStateName == FishingStateName.Move
|
||
|| curFishingStateName == FishingStateName.Jump
|
||
|| curFishingStateName == FishingStateName.Escape))
|
||
{
|
||
//永远不会张力过大
|
||
if (_linePower < FishingFailProgressLeft || _linePower > 1 - FishingFailProgressRight)
|
||
{
|
||
_limitStayTime += Time.deltaTime;
|
||
if (_limitStayTime < Time.deltaTime + 0.0001f)
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.Warning));
|
||
}
|
||
if (NeverOvertensionToCrit > 0 && _linePower > 1 - FishingFailProgressRight)
|
||
{
|
||
NOCrit = NeverOvertensionToCrit;
|
||
//新技能生效 永远不会张力过大
|
||
PublishPerkEvent(RodPerkType.BattlePerk_NeverOvertension);
|
||
}
|
||
else
|
||
{
|
||
isFail2 = _limitStayTime > _tables.TbGlobalConfig.FishingFailStrugglingTime;
|
||
if (isFail2)
|
||
{
|
||
OnLimitStayTime();
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (NeverOvertensionToCrit > 0)
|
||
{
|
||
NOCrit = 0;
|
||
}
|
||
_limitStayTime = 0;
|
||
}
|
||
|
||
if (fishSpSkillData != null && fishSpSkillData.InProgress && !fishSpSkillData.End)
|
||
{
|
||
bool localWarning = false;
|
||
if (_linePower < FishingFailProgressLeft && _limitStayTime > 0.2f)
|
||
{
|
||
localWarning = true;
|
||
}
|
||
if (isFailFxScreenWarning != localWarning)
|
||
{
|
||
isFailFxScreenWarning = localWarning;
|
||
FishingPanel_Advanced.Instance.ShowFxScreenWarning(isFailFxScreenWarning);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
_limitStayTime = 0;
|
||
}
|
||
#if UNITY_EDITOR
|
||
//如果点击S键,鱼的血量减少
|
||
if (Input.GetKeyDown(KeyCode.S))
|
||
{
|
||
_fishCurrentHealth = -1f;
|
||
}
|
||
#endif
|
||
}
|
||
|
||
if ((fishingData.IsCaughtFish || isFail) && !fishingData.IsShowRewardPanel)
|
||
{
|
||
FishEnd();
|
||
}
|
||
}
|
||
|
||
void FishEnd()
|
||
{
|
||
if (isFail)
|
||
{
|
||
if (isFail1 || isFail2)
|
||
{
|
||
//再逃跑
|
||
fishingBehavior?.OnFail(Mathf.Max(fishingData.MaxZEscape, fishingData.MaxLinelength) + 5, _fishSpeed * curFishingState.fishMoveSpeed);
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.Failure));
|
||
}
|
||
GContext.Publish(new SetWeatherEvent());
|
||
}
|
||
fishingBehavior?.CloseBaitDoTween();
|
||
int itemID = playerFishData.GetFishSwimToMap(fishingData.MapId);
|
||
if (itemID > 0)
|
||
{
|
||
Item item = _tables.TbItem.GetOrDefault(itemID);
|
||
var fishData = _tables.TbFishData.GetOrDefault(item.RedirectID);
|
||
var fishEatFish = _tables.TbFishEatFish.GetOrDefault(fishData.EatFishID);
|
||
int CruiseMaxCount = 0;
|
||
if (fishEatFish != null)
|
||
{
|
||
CruiseMaxCount = fishEatFish.CruiseMaxCount;
|
||
}
|
||
else
|
||
{
|
||
Debug.LogError("fishData.EatFishID:" + fishData.EatFishID);
|
||
}
|
||
playerFishData.SetFishSwimToMapCount(fishingData.MapId, CruiseMaxCount);
|
||
}
|
||
StopSkill();
|
||
Time.timeScale = 1;
|
||
fishingData.IsShowRewardPanel = true;
|
||
fishingData.endTimer = Time.time;
|
||
UIManager.Instance.DestroyUI(UITypes.FishingPanel);
|
||
fishingBehavior?.DestroySwimFish();
|
||
if (fishingData.IsCaughtFish)
|
||
{
|
||
var _fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
_fishingEventData.preCollectingTarget = null;
|
||
_fishingEventData.preRankTarget = null;
|
||
fishingData.fishingResult = FishingResult.Success;
|
||
|
||
if (fishingData.IsPackItemFish())
|
||
{
|
||
if (!fishingData.IsFree)
|
||
{
|
||
GContext.container.Resolve<PlayerData>().RecoverEnergy();
|
||
}
|
||
GContext.Publish(new TargetAddData(1001, 0, GContext.container.Resolve<PlayerData>().GetMagnification()));
|
||
}
|
||
|
||
if (fishingData.IsEventGameFish())
|
||
{
|
||
EventGamePlayPanel();
|
||
}
|
||
else
|
||
{
|
||
GContext.Publish(new OnSoundStateEvent(0));
|
||
if (fishingData.IsDuel)
|
||
{
|
||
_ = UIManager.Instance.ShowUI(UITypes.FishingDuelRewardPanel);
|
||
}
|
||
else
|
||
{
|
||
_ = UIManager.Instance.ShowUI(UITypes.FishingRewardPanel);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (isFail)
|
||
{
|
||
ShowRewardPanel();
|
||
}
|
||
if (fishingData.IsFree)
|
||
{
|
||
return;
|
||
}
|
||
if (!fishingData.IsFree
|
||
&& _tables.TbGlobalConfig.FailWithoutEnergyConsuming >
|
||
GContext.container.Resolve<PlayerFishData>().GetAnglingCount()
|
||
&& GContext.container.Resolve<PlayerData>().lastMapId ==
|
||
_tables.TbMapData.DataList[0].ID)
|
||
{
|
||
GContext.container.Resolve<PlayerData>().RecoverEnergy();
|
||
}
|
||
}
|
||
}
|
||
float beginDragPosY = 0;
|
||
|
||
// 更新鱼线的位置和状态,连击状态
|
||
void PressBarShake()
|
||
{
|
||
StopCoroutine("LooseBarShakeIE");
|
||
StopCoroutine("PressBarShakeIE");
|
||
frowarding = true;
|
||
var StrengthToPressBarShakeBounceRatio = _tables.TbFishStatsConfig.StrengthToPressBarShakeBounceRatio;
|
||
float barShakeBackRatio = StrengthToPressBarShakeBounceRatio[2]
|
||
+ _linePower * StrengthToPressBarShakeBounceRatio[3]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * StrengthToPressBarShakeBounceRatio[4];
|
||
barShakeBackRatio = Mathf.Clamp(barShakeBackRatio, StrengthToPressBarShakeBounceRatio[0], StrengthToPressBarShakeBounceRatio[1]);
|
||
|
||
var StrengthToPressBarShakeFreq = _tables.TbFishStatsConfig.StrengthToPressBarShakeFreq;
|
||
float _barShakeFreq = StrengthToPressBarShakeFreq[2]
|
||
+ _linePower * StrengthToPressBarShakeFreq[3]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * StrengthToPressBarShakeFreq[4];
|
||
_barShakeFreq = Mathf.Clamp(_barShakeFreq, StrengthToPressBarShakeFreq[0], StrengthToPressBarShakeFreq[1]);
|
||
|
||
frowardPressTime = _barShakeFreq * (1 - barShakeBackRatio);
|
||
backPressTime = _barShakeFreq * barShakeBackRatio;
|
||
speedRandValue = Random.Range(speedRandA, speedRandB);
|
||
|
||
StartCoroutine("PressBarShakeIE");
|
||
}
|
||
IEnumerator PressBarShakeIE()
|
||
{
|
||
yield return new WaitForSeconds(frowardPressTime);
|
||
frowarding = false;
|
||
yield return new WaitForSeconds(backPressTime);
|
||
PressBarShake();
|
||
}
|
||
void LooseBarShake()
|
||
{
|
||
StopCoroutine("LooseBarShakeIE");
|
||
StopCoroutine("PressBarShakeIE");
|
||
frowarding = true;
|
||
var StrengthToLooseBarShakeBounceRatio = _tables.TbFishStatsConfig.StrengthToLooseBarShakeBounceRatio;
|
||
float barShakeBackRatio = StrengthToLooseBarShakeBounceRatio[2]
|
||
+ _linePower * StrengthToLooseBarShakeBounceRatio[3]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * StrengthToLooseBarShakeBounceRatio[4];
|
||
barShakeBackRatio = Mathf.Clamp(barShakeBackRatio, StrengthToLooseBarShakeBounceRatio[0], StrengthToLooseBarShakeBounceRatio[1]);
|
||
|
||
var StrengthToLooseBarShakeFreq = _tables.TbFishStatsConfig.StrengthToLooseBarShakeFreq;
|
||
float _barShakeFreq = StrengthToLooseBarShakeFreq[2]
|
||
+ _linePower * StrengthToLooseBarShakeFreq[3]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * StrengthToLooseBarShakeFreq[4];
|
||
_barShakeFreq = Mathf.Clamp(_barShakeFreq, StrengthToLooseBarShakeFreq[0], StrengthToLooseBarShakeFreq[1]);
|
||
|
||
frowardLooseTime = _barShakeFreq * (1 - barShakeBackRatio);
|
||
backLooseTime = _barShakeFreq * barShakeBackRatio;
|
||
speedRandValue = Random.Range(speedRandA, speedRandB);
|
||
|
||
StartCoroutine("LooseBarShakeIE");
|
||
}
|
||
IEnumerator LooseBarShakeIE()
|
||
{
|
||
yield return new WaitForSeconds(frowardLooseTime);
|
||
frowarding = false;
|
||
yield return new WaitForSeconds(backLooseTime);
|
||
LooseBarShake();
|
||
}
|
||
void StopRodAudio()
|
||
{
|
||
if (soundLine)
|
||
{
|
||
soundLine.audioSource.Stop();
|
||
soundLine.ReturnPool();
|
||
soundLine = null;
|
||
}
|
||
if (soundReeling)
|
||
{
|
||
soundReeling.audioSource.Stop();
|
||
soundReeling.ReturnPool();
|
||
soundReeling = null;
|
||
}
|
||
}
|
||
void PlayRodAudio()
|
||
{
|
||
StopRodAudio();
|
||
soundLine = GContext.container.Resolve<ISoundService>().GetNewUISound(lineAudio);
|
||
soundLine.audioSource.Play();
|
||
soundLine.audioSource.loop = true;
|
||
soundReeling = GContext.container.Resolve<ISoundService>().GetNewUISound(reelingAudio);
|
||
soundReeling.audioSource.Play();
|
||
soundReeling.audioSource.loop = true;
|
||
|
||
}
|
||
void StopNotReeling()
|
||
{
|
||
if (soundNotReeling)
|
||
{
|
||
soundNotReeling.audioSource.Stop();
|
||
soundNotReeling.ReturnPool();
|
||
soundNotReeling = null;
|
||
}
|
||
}
|
||
void PlayRodNotReelingAudio()
|
||
{
|
||
StopNotReeling();
|
||
soundNotReeling = GContext.container.Resolve<ISoundService>().GetNewUISound(notReelingAudio);
|
||
soundNotReeling.audioSource.Play();
|
||
soundNotReeling.audioSource.loop = true;
|
||
}
|
||
void StopDrawingSplash()
|
||
{
|
||
if (soundDrawingSplash != null)
|
||
{
|
||
soundDrawingSplash.audioSource.Stop();
|
||
soundDrawingSplash.ReturnPool();
|
||
soundDrawingSplash = null;
|
||
}
|
||
}
|
||
void PlayDrawingSplash()
|
||
{
|
||
StopDrawingSplash();
|
||
soundDrawingSplash = GContext.container.Resolve<ISoundService>().GetNewUISound(drawingSplash);
|
||
soundDrawingSplash.audioSource.Play();
|
||
soundDrawingSplash.audioSource.loop = true;
|
||
}
|
||
void StopSoundCombo()
|
||
{
|
||
if (soundCombo != null)
|
||
{
|
||
soundCombo.audioSource.Stop();
|
||
soundCombo.ReturnPool();
|
||
soundCombo = null;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 是否有收线相关操作
|
||
/// </summary>
|
||
/// <param name="isGuide"></param>
|
||
/// <param name="isGuideLine"></param>
|
||
/// <returns></returns>
|
||
public bool MouseButtonFishingPanel(IsShowGuidance isShowGuidance, bool isGuideLine)
|
||
{
|
||
bool isButton = false;
|
||
if (FishingPanel_Advanced.Instance == null || FishingPanel_Advanced.Instance.UISpSkill)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
//特殊技能 禁止收线操作
|
||
|
||
Vector2 mousePosition = Input.mousePosition;
|
||
if (Input.GetMouseButtonDown(0))
|
||
{
|
||
if (FishingPanel_Advanced.Instance != null && FishingPanel_Advanced.Instance.IsDown())
|
||
{
|
||
PressBarShake();
|
||
if (_isCombo == 1)
|
||
{
|
||
//记录开始滑动的位置
|
||
beginDragPosY = mousePosition.y;
|
||
}
|
||
StopNotReeling();
|
||
PlayRodAudio();
|
||
GContext.Publish(new VibrationData(HapticTypes.LightImpact));
|
||
}
|
||
else
|
||
{
|
||
beginDragPosY = 0;
|
||
}
|
||
isButton = true;
|
||
}
|
||
else if (Input.GetMouseButton(0))
|
||
{
|
||
if ((!isShowGuidance.isShow || isGuideLine) && FishingPanel_Advanced.Instance != null && FishingPanel_Advanced.Instance.IsDown())
|
||
{
|
||
isHold = true;
|
||
|
||
if (_isCombo == 0)
|
||
{
|
||
//记录开始滑动的位置
|
||
beginDragPosY = mousePosition.y;
|
||
}
|
||
if (!lockCombo)
|
||
{
|
||
var strengthToBarShake = _tables.TbFishStatsConfig.StrengthToPressBarIncreaseShake;
|
||
float barShake = strengthToBarShake[2]
|
||
+ _linePower * strengthToBarShake[3]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * strengthToBarShake[4];
|
||
barIncreaseShake = Mathf.Clamp(barShake, strengthToBarShake[0], strengthToBarShake[1]);
|
||
barIncreaseShake *= UnityEngine.Random.Range(1 - 0.5f * BarShakeBounceRand, 1 + 0.5f * BarShakeBounceRand);
|
||
//长按的前进数值
|
||
float speed = barIncreaseShake * (1 + maxStruggling) * speedRandValue * (1 - FishShakeResist);
|
||
if (frowarding)
|
||
{
|
||
_barSpeed = speed + barIncrease * Mathf.Lerp(minDamp, maxDamp, _linePower)
|
||
* (((1 - maxStruggling) * speedRandValue * fishingData.FishSkillPerformSpeed - 1)
|
||
* (1 - FishPowerResist) + 1);
|
||
}
|
||
else
|
||
{
|
||
_barSpeed = -speed;
|
||
}
|
||
if (_isCombo == 2)
|
||
{
|
||
_barSpeed *= ComboBarIncAmp;
|
||
}
|
||
_linePower += _barSpeed * Time.deltaTime * strugglingReverse;
|
||
}
|
||
}
|
||
//滑动屏幕一半距离触发OnLeftClick或OnRightClick
|
||
if ((!isShowGuidance.isShow || isShowGuidance.fingerType != FingerType.None) && _isCombo == 1 && beginDragPosY > 1
|
||
&& mousePosition.y > beginDragPosY
|
||
&& Mathf.Abs(mousePosition.y - beginDragPosY) > 15)
|
||
{
|
||
beginDragPosY = 0;
|
||
FullCombo();
|
||
}
|
||
isButton = true;
|
||
}
|
||
else if (Input.GetMouseButtonUp(0))
|
||
{
|
||
StopRodAudio();
|
||
PlayRodNotReelingAudio();
|
||
beginDragPosY = 0;
|
||
LooseBarShake();
|
||
isButton = true;
|
||
}
|
||
return isButton;
|
||
}
|
||
private void UpdateTension(float a, IsShowGuidance isShowGuidance, bool isGuideLine)
|
||
{
|
||
bool isButton = MouseButtonFishingPanel(isShowGuidance, isGuideLine);
|
||
//没有收线相关操作,进度条后退
|
||
if (!isButton && !lockCombo && (!isShowGuidance.isShow || isGuideLine))
|
||
{
|
||
var strengthToBarShake = _tables.TbFishStatsConfig.StrengthToLooseBarIncreaseShake;
|
||
float barShake = strengthToBarShake[2]
|
||
+ _linePower * strengthToBarShake[3]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * strengthToBarShake[4];
|
||
barDecreasShake = Mathf.Clamp(barShake, strengthToBarShake[0], strengthToBarShake[1]);
|
||
barDecreasShake *= Random.Range(1 - 0.5f * BarShakeBounceRand, 1 + 0.5f * BarShakeBounceRand);
|
||
//长按的前进数值
|
||
float speed = barDecreasShake * (1 + maxStruggling) * speedRandValue * (1 - FishShakeResist);
|
||
float CorruptBarIncPercent = 1;
|
||
float CorruptBarDecPercent = 1;
|
||
if (_linePower < fishingFailProgressLeft && barTarget != null && fishSpSkillData != null && !fishSpSkillData.End)
|
||
{
|
||
CorruptBarIncPercent = barTarget.CorruptBarIncPercent;
|
||
CorruptBarDecPercent = barTarget.CorruptBarDecPercent;
|
||
}
|
||
if (frowarding)
|
||
{
|
||
_barBack = speed + barDecrease * Mathf.Lerp(maxDamp, minDamp, _linePower)
|
||
* (((1 + maxStruggling) * speedRandValue * fishingData.FishSkillPerformBack - 1)
|
||
* (1 - FishPowerResist) + 1);
|
||
_barBack *= CorruptBarIncPercent;
|
||
}
|
||
else
|
||
{
|
||
_barBack = -speed;
|
||
_barBack *= CorruptBarDecPercent;
|
||
|
||
}
|
||
if (!isGuideLine || _linePower > GuideLineMinBar)
|
||
{
|
||
if (_isCombo == 2)
|
||
{
|
||
_barBack *= curComboBarDecAmp;
|
||
}
|
||
_linePower -= _barBack * Time.deltaTime * strugglingReverse;
|
||
}
|
||
}
|
||
|
||
_linePower = Mathf.Clamp(_linePower, 0, 1);
|
||
if (_isCombo == 2)
|
||
{
|
||
//刺鱼
|
||
StartFullCombo();
|
||
}
|
||
else if (!isShowGuidance.isShow)
|
||
{
|
||
int type = 0;
|
||
if (_linePower > a)
|
||
{
|
||
type = 1;
|
||
ComboSuccess();
|
||
}
|
||
if (_isCombo == 0 && fishingData.fixedFishList != null && fishingData.fixedFishList.IfStaPowPopUp == 1)
|
||
{
|
||
if (_linePower > a)
|
||
{
|
||
noComboTime = 0;
|
||
}
|
||
else if (isCanCombo)
|
||
{
|
||
noComboTime += Time.deltaTime;
|
||
if (noComboTime > _tables.TbGlobalConfig.StaPowPopupTime)
|
||
{
|
||
GContext.container.Resolve<GuideDataCenter>().ShowGuidancePopupPanel("station_powerreel");
|
||
noComboTime = 0;
|
||
_limitStayTime = 0;
|
||
}
|
||
}
|
||
}
|
||
if (_linePowerType != type)
|
||
{
|
||
FishingPanel_Advanced.Instance?.PlayBarAni("bar_shake_comboing", type == 1);
|
||
_linePowerType = type;
|
||
}
|
||
float drawingForce = _linePower / a;
|
||
drawingForce = Mathf.Clamp(drawingForce, 0, 1);
|
||
fishingBehavior?.SetDrawingForce(drawingForce);
|
||
var ExtraUnderwaterOffset = _tables.TbFishStatsConfig.ExtraUnderwaterOffset;
|
||
fishingData.ExtraUnderwaterOffset = _linePower + ExtraUnderwaterOffset[2] + fishingBehavior.LineDistance * ExtraUnderwaterOffset[3];
|
||
fishingData.ExtraUnderwaterOffset = Mathf.Clamp(fishingData.ExtraUnderwaterOffset, ExtraUnderwaterOffset[0], ExtraUnderwaterOffset[1]);
|
||
|
||
if (fishingBehavior?.LineDistance > fishingData.MaxLinelength)
|
||
{
|
||
FailDelayTime += Time.deltaTime;
|
||
if (FailDelayTime >= _tables.TbGlobalConfig.FailDelayTime)
|
||
{
|
||
isFail = true;
|
||
fishingData.fishingResult = FishingResult.Fail3;
|
||
FishingPanel_Advanced.Instance?.StopDistance();
|
||
OnFishingIsOver();
|
||
}
|
||
else
|
||
{
|
||
//播放警告
|
||
FishingPanel_Advanced.Instance?.PlayDistance();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
FailDelayTime = 0;
|
||
//停止播放警告
|
||
FishingPanel_Advanced.Instance?.StopDistance();
|
||
}
|
||
}
|
||
}
|
||
void StartFullCombo()
|
||
{
|
||
_fullFishStayTime += Time.deltaTime;
|
||
curComboBarDecAmp = ComboBarDecAmp - ComboBarDecAmp * _fullFishStayTime / fishingData.fishRodData.ComboTime;
|
||
if (_fullFishStayTime >= fishingData.fishRodData.ComboTime)
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowFX_info_combo(false);
|
||
_curComboMultiplayer = 0;
|
||
_comboMultiplayer = 0;
|
||
_isCombo = 0;
|
||
lockCombo = false;
|
||
FishingPanel_Advanced.Instance?.PlayBarAni("bar_shake_maxcombo", false);
|
||
|
||
if (curFishingStateName == FishingStateName.MaxCombo)
|
||
{
|
||
if (escapeFish)
|
||
{
|
||
EscapeFish();
|
||
}
|
||
else if (jumpFish)
|
||
{
|
||
ChangeFishingState(FishingStateName.Jump);
|
||
}
|
||
else
|
||
{
|
||
ChangeFishingState(FishingStateName.Move);
|
||
}
|
||
}
|
||
if (ComboToCombo > 0 && ComboToCombo > Random.value)
|
||
{
|
||
_comboMultiplayer = Random.Range(ComboToComboMin, ComboToComboMax);
|
||
//新技能生效 全力收线触发连击进度
|
||
PublishPerkEvent(RodPerkType.BattlePerk_ComboToCombo);
|
||
}
|
||
}
|
||
}
|
||
|
||
//全力收线
|
||
public async void FullCombo()
|
||
{
|
||
if (_isCombo == 1 && curFishingStateName != FishingStateName.UIEating)
|
||
{
|
||
if (comboToExDmg > 0 && comboToExDmgCount < curComboToExDmgCount)
|
||
{
|
||
curComboToExDmgCount++;
|
||
curComboToExDmg += comboToExDmg;
|
||
//新技能生效 全力收线触发增伤
|
||
PublishPerkEvent(RodPerkType.BattlePerk_ComboToExDmg);
|
||
}
|
||
GContext.Publish(new VibrationData(HapticTypes.Success));
|
||
GContext.Publish(new GuideNextEvent());
|
||
fishingData.jerking_count++;
|
||
_isCombo = 2;
|
||
curComboBarDecAmp = ComboBarDecAmp;
|
||
lockCombo = true;
|
||
FishingPanel_Advanced.Instance?.PlayBarAni("bar_shake_maxcombo", true);
|
||
_fullFishStayTime = 0;
|
||
_ = StartCoroutine("PlayAudioMaxCombo");
|
||
FishingPanel_Advanced.Instance?.ShowFX_info_combo(true);
|
||
ChangeFishingState(FishingStateName.MaxCombo);
|
||
if (fishSpSkillData != null && !fishSpSkillData.End)
|
||
{
|
||
StopStrugglingReverseSpKill();
|
||
}
|
||
await Awaiters.Seconds(0.2f);
|
||
lockCombo = false;
|
||
}
|
||
}
|
||
//音效fishingData.fishRodData.ComboOutAudio;
|
||
/// <summary>
|
||
/// 字符串启动协程
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
IEnumerator PlayAudioMaxCombo()
|
||
{
|
||
soundCombo = GContext.container.Resolve<ISoundService>().GetNewUISound(audioClipL);
|
||
soundCombo.audioSource.Play();
|
||
float time = audioClipL.length;
|
||
yield return new WaitForSeconds(time);
|
||
soundCombo.audioSource.clip = audioClipLoop;
|
||
soundCombo.audioSource.loop = true;
|
||
soundCombo.audioSource.Play();
|
||
yield return new WaitForSeconds(fishingData.fishRodData.ComboTime - time);
|
||
soundCombo.audioSource.loop = false;
|
||
soundCombo.audioSource.clip = maxcombo_out_general;
|
||
soundCombo.audioSource.Play();
|
||
yield return new WaitForSeconds(maxcombo_out_general.length);
|
||
soundCombo.audioSource.Stop();
|
||
soundCombo.ReturnPool();
|
||
soundCombo = null;
|
||
}
|
||
//连击成功
|
||
public void ComboSuccess()
|
||
{
|
||
//特定条件解锁练连击数显示和maxcombo释放
|
||
if (isCanCombo)
|
||
{
|
||
_comboMultiplayer += comboSpeedAdd * ComboInc * Time.deltaTime;
|
||
UpdateComboMultiplayer();
|
||
}
|
||
else
|
||
{
|
||
FishingPanel_Advanced.Instance?.UpdateComboMultiplayer(-1, false);
|
||
}
|
||
}
|
||
//新手引导让玩家立即Combo设置连击100%
|
||
void SetShowCombo()
|
||
{
|
||
if (!isCanCombo && playerFishData.GetAnglingCount() == 1)
|
||
{
|
||
isCanCombo = true;
|
||
bool isGuide = GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("FishingPanel_Advanced");
|
||
if (isGuide && _comboDisposable == null)
|
||
{
|
||
//特殊弹窗,之后引导玩家立即Combo
|
||
_comboDisposable = GContext.OnEvent<AddIndexEvent>().Subscribe(ShowComboTipsGuide);
|
||
}
|
||
}
|
||
}
|
||
|
||
void EscapeShowGuide()
|
||
{
|
||
if (playerFishData.GetAnglingCount() == 5 && fishingData.fishEatDataList.Count == 0)
|
||
{
|
||
bool isGuide = GContext.container.Resolve<GuideDataCenter>().TriggerGuide(GroupName.FishEscape.ToString(), "FishingPanel_Advanced");
|
||
if (isGuide && _comboDisposable == null)
|
||
{
|
||
//特殊弹窗,之后引导玩家立即Combo
|
||
_comboDisposable = GContext.OnEvent<AddIndexEvent>().Subscribe(ShowComboTipsGuide);
|
||
}
|
||
}
|
||
}
|
||
|
||
void ShowComboTipsGuide(AddIndexEvent addIndexEvent)
|
||
{
|
||
int anglingCount = playerFishData.GetAnglingCount();
|
||
if (anglingCount == 0 && addIndexEvent.guideSubIndex == 5)
|
||
{
|
||
isShowCombo = true;
|
||
SetComboZone();
|
||
_comboDisposable?.Dispose();
|
||
_comboDisposable = null;
|
||
}
|
||
if (anglingCount == 1 && addIndexEvent.guideSubIndex == Fish_02ShowFingerIndex)
|
||
{
|
||
if (addIndexEvent.isAutoNext)
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowComboTips(true);
|
||
}
|
||
else
|
||
{
|
||
ShowFinger();
|
||
}
|
||
}
|
||
else if (anglingCount == 5 && addIndexEvent.guideSubIndex == FishEscapeShowFingerIndex)
|
||
{
|
||
if (addIndexEvent.isAutoNext)
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowComboTips(true);
|
||
}
|
||
else
|
||
{
|
||
ShowFinger();
|
||
}
|
||
}
|
||
}
|
||
|
||
void ShowFinger()
|
||
{
|
||
_comboDisposable?.Dispose();
|
||
_comboDisposable = null;
|
||
if (_isCombo == 1)
|
||
{
|
||
HideFinger();
|
||
}
|
||
else
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowFinger();
|
||
}
|
||
}
|
||
|
||
public void UpdateComboMultiplayer()
|
||
{
|
||
_comboMultiplayer = Mathf.Clamp01(_comboMultiplayer);
|
||
_curComboMultiplayer = _comboMultiplayer;
|
||
|
||
if (isCanCombo && _isCombo == 0)
|
||
{
|
||
_isCombo = _curComboMultiplayer > 0.99f ? 1 : 0;
|
||
OnCombo1();
|
||
}
|
||
FishingPanel_Advanced.Instance?.UpdateComboMultiplayer(_curComboMultiplayer, _isCombo == 1 && curFishingStateName != FishingStateName.UIEating && curFishingStateName != FishingStateName.SpEating);
|
||
}
|
||
void OnCombo1()
|
||
{
|
||
if (_isCombo == 1 && curFishingStateName != FishingStateName.UIEating && curFishingStateName != FishingStateName.SpEating)
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.Success));
|
||
FishingPanel_Advanced.Instance?.ShowMaxComboTip();
|
||
HideFinger();
|
||
}
|
||
}
|
||
|
||
void HideFinger()
|
||
{
|
||
int anglingCount = playerFishData.GetAnglingCount();
|
||
bool isGuide = false;
|
||
if (anglingCount == 1)
|
||
{
|
||
isGuide = GContext.container.Resolve<GuideDataCenter>().IsGuide("FishingPanel_Advanced", Fish_02ShowFingerIndex, GroupName.Fish_02);
|
||
}
|
||
else if (anglingCount == 5)
|
||
{
|
||
isGuide = GContext.container.Resolve<GuideDataCenter>().IsGuide("FishingPanel_Advanced", FishEscapeShowFingerIndex, GroupName.FishEscape);
|
||
}
|
||
if (isGuide)
|
||
{
|
||
FishingPanel_Advanced.Instance?.HideFinger();
|
||
FishingPanel_Advanced.Instance?.ShowComboTips(false);
|
||
}
|
||
}
|
||
|
||
async void ShowRewardPanel()
|
||
{
|
||
fishingBehavior?.cameraAnimator.SetBool("_drawing", false);
|
||
fishingData.mainCamera.DOLocalRotateQuaternion(Quaternion.identity, 0.5f);
|
||
GContext.Publish(new VibrationData(HapticTypes.Failure));
|
||
GContext.Publish(new IsCancelledEvent());
|
||
fishingBehavior?.CloseAllEffect();
|
||
await Awaiters.Seconds(_tables.TbGlobalConfig.FishingFailPanelDelay);
|
||
|
||
if (fishingData.IsDuel)
|
||
{
|
||
await UIManager.Instance.ShowUI(UITypes.FishingDuelRewardPanel);
|
||
}
|
||
else
|
||
{
|
||
await UIManager.Instance.ShowUI(UITypes.FishingRewardPanel);
|
||
}
|
||
fishingBehavior?.OnFild();
|
||
}
|
||
|
||
async void EventGamePlayPanel()
|
||
{
|
||
GContext.container.Resolve<GuideDataCenter>().AddIndex(true);
|
||
playerFishData.SaveFishingFrequency();
|
||
#if AGG
|
||
using (var e = GEvent.GameEvent("go_fishing"))
|
||
{
|
||
PlayerData playerData = GContext.container.Resolve<PlayerData>();
|
||
int currentRodLevel = playerFishData.GetRodLevel(playerData.equipRodID);
|
||
int currentRodStar = playerFishData.GetRodPiece(playerData.equipRodID);
|
||
e.AddContent("map_id", fishingData.MapId)
|
||
.AddContent("fishing_state", 1)
|
||
.AddContent("fish_count", playerFishData.GetAnglingCount())
|
||
.AddContent("fish_id", fishingData.fishItem.RedirectID)
|
||
.AddContent("fish_multiple", playerData.GetMagnification())
|
||
.AddContent("charge_count", GContext.container.Resolve<PlayerShopData>().GetBuyPaymentAmount())
|
||
.AddContent("hook_count", playerData.GetEnergyRM())
|
||
.AddContent("available_hook_num", playerData.Energy)
|
||
.AddContent("available_cash_num", playerData.gold)
|
||
.AddContent("jerking_count", fishingData.jerking_count)
|
||
.AddContent("stickle_state", fishingData.stickle_state)
|
||
.AddContent("fish_time", fishingData.GetFishingTimer())
|
||
.AddContent("fish_card_lv", fishingData.CardLevel)
|
||
.AddContent("current_rod", playerData.equipRodID)
|
||
.AddContent("current_rod_level", currentRodLevel)
|
||
.AddContent("current_rod_star", currentRodStar)
|
||
.AddContent("retry", fishingData.IsRetry)
|
||
.AddContent("retry_ways", fishingData.retry_ways);
|
||
var _socialData = GContext.container.Resolve<ClubService>();
|
||
if (_socialData.myClubInfo != null)
|
||
{
|
||
e.AddContent("guild_id", _socialData.myClubInfo.id);
|
||
}
|
||
else
|
||
{
|
||
e.AddContent("guild_id", 0);
|
||
}
|
||
}
|
||
#endif
|
||
//#if UNITY_EDITOR
|
||
// EventBankHeistPanel.selectionType = 0;
|
||
//#endif
|
||
await Awaiters.Seconds(BottleDelay);
|
||
var eventGamePlayPanel = (await UIManager.Instance.GetUIAsync(UITypes.EventGamePlayPanel)).GetComponent<EventGamePlayPanel>();
|
||
eventGamePlayPanel.StartGame(fishingData.fishItem.SubType, true);
|
||
}
|
||
void OnFishingIsOver()
|
||
{
|
||
fishingBehavior.fishAnimator.enabled = true;
|
||
fishingData.IsDrawing = false;
|
||
fishingBehavior?.InitAni();
|
||
FishingPanel_Advanced.Instance?.HideFishInfo();
|
||
FishingPanel_Advanced.Instance?.HideDrawButton();
|
||
ChangeFishingState(FishingStateName.Move);
|
||
_limitStayTime = 0;
|
||
DOTween.Kill("FishHPEventType");
|
||
StopCoroutine("PlayAudioMaxCombo");
|
||
StopSoundCombo();
|
||
StopRodAudio();
|
||
StopNotReeling();
|
||
//停止鱼audio_fishing_drawing_splash
|
||
StopDrawingSplash();
|
||
StopSkill();
|
||
}
|
||
//触发鱼血量事件
|
||
public void TriggerFishHpEvent(FishSkill _event)
|
||
{
|
||
GContext.Publish(new EventFishingSound(SoundType.HPEvent));
|
||
_hpcoroutine = StartCoroutine(PlaySkill(_event));
|
||
}
|
||
public float GetBarShakeAmp()
|
||
{
|
||
return Mathf.Lerp(BarShakeMinAmp, BarShakeMaxAmp, _linePower);
|
||
}
|
||
void FishToDmg(float dmg)
|
||
{
|
||
float _damageMultiplier = _fishCurrentHealth * dmg;
|
||
_fishCurrentHealth -= _damageMultiplier;
|
||
if (!jumpFish && fishingData.UIEatHpPercent > -0.0001f && _fishCurrentHealth / _fishMaxHealth < fishingData.UIEatHpPercent - 0.0001f)
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowFishInfo(
|
||
(int)_damageMultiplier,
|
||
_fishCurrentHealth / _fishMaxHealth, false, false);
|
||
}
|
||
}
|
||
IEnumerator PlaySkill(FishSkill _event)
|
||
{
|
||
float chargingTimeBase = Random.Range(_event.ChargingTime[0], _event.ChargingTime[1]) * collectingData.StatsChange(5);
|
||
float ChargingTime = chargingTimeBase * (1 + FishSkillChargingDelay);
|
||
int type = 1;
|
||
if (_event.SpSkillType == FishHPEventTypeAdvanced.Escape)
|
||
{
|
||
escapeFishStart = true;
|
||
//逃跑
|
||
ChargingTime = chargingTimeBase * (1 + FishEscapeChargingDelay);
|
||
type = 2;
|
||
}
|
||
//延时头像冒火
|
||
//逃跑特效
|
||
GContext.Publish(new UISkillShow() { type = type, chargingTime = ChargingTime, executeTime = _event.ExecuteTime, isStart = true });
|
||
yield return new WaitForSeconds(ChargingTime);
|
||
nextEvent = null;
|
||
GContext.Publish(new VibrationData(HapticTypes.Warning));
|
||
if (currentEvent == _event)
|
||
{
|
||
FishingPanel_Advanced.Instance?.PlayBarAni(currentEvent.ShakeAnimation, true);
|
||
//属性加值
|
||
switch (_event.StatsIncType)
|
||
{
|
||
case FishBasicStats.Power:
|
||
DOTween.Kill("FatigueStrugglingPower");
|
||
strugglingPowerInc = _event.StatsIncParam * collectingData.StatsChange(0);
|
||
if (fishingData.IsRetry)
|
||
{
|
||
Debug.Log("FishingRetryPowerReduction Inc :" + fishingData.FishingRetryPowerReduction);
|
||
|
||
strugglingPowerInc *= fishingData.FishingRetryPowerReduction;
|
||
}
|
||
//fishingData.StrugglingPower = fishingData.curFishData.StrugglingPower;
|
||
OnPowerIncChange();
|
||
break;
|
||
case FishBasicStats.Speed:
|
||
speedInc = _event.StatsIncParam * collectingData.StatsChange(1);
|
||
OnSpeedIncChange();
|
||
break;
|
||
case FishBasicStats.Vigilance:
|
||
viliganceInc = _event.StatsIncParam * collectingData.StatsChange(2);
|
||
OnViliganceIncChange();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
//具体技能
|
||
switch (_event.SpSkillType)
|
||
{
|
||
case FishHPEventTypeAdvanced.HPRecover:
|
||
StartCoroutine(HPRecover(_event));
|
||
FishingPanel_Advanced.Instance?.FXInfo(3);
|
||
break;
|
||
case FishHPEventTypeAdvanced.BarDisable:
|
||
//fishingFailProgressLeft = _event.SpSkillParams[0];
|
||
FishingPanel_Advanced.Instance?.FXInfo(1);
|
||
break;
|
||
case FishHPEventTypeAdvanced.StrugglingReverse:
|
||
strugglingReverse = -1;
|
||
FishingPanel_Advanced.Instance?.FXInfo(1);
|
||
break;
|
||
case FishHPEventTypeAdvanced.Escape:
|
||
//逃跑
|
||
MapData data = _tables.TbMapData.GetOrDefault(GContext.container.Resolve<PlayerData>().lastMapId);
|
||
EscapeSpeedMag = data.EscapeSpeedMag * collectingData.StatsChange(4);
|
||
if (fishingData.IsRetry)
|
||
{
|
||
Debug.Log("FishingRetryEscapeReduction :" + fishingData.FishingRetryEscapeReduction);
|
||
|
||
EscapeSpeedMag *= fishingData.FishingRetryEscapeReduction;
|
||
}
|
||
EscapeShowGuide();
|
||
fishingData.MaxZEscape = _event.SpSkillParams[0];
|
||
fishingData.MaxYEscape = _event.SpSkillParams[1];
|
||
fishingBehavior?.StartMoveFish();
|
||
FishingPanel_Advanced.Instance?.FXInfo(2);
|
||
break;
|
||
case FishHPEventTypeAdvanced.ComboZoneShift:
|
||
case FishHPEventTypeAdvanced.None:
|
||
default:
|
||
FishingPanel_Advanced.Instance?.FXInfo(1);
|
||
break;
|
||
|
||
}
|
||
if (fishingBehavior?.FishBehaviour != null)
|
||
{
|
||
fishingBehavior?.FishBehaviour.SetSkillType((int)_event.PerformanceType);
|
||
}
|
||
fishingBehavior?.CloseBaitDoTween();
|
||
|
||
//特殊表现
|
||
StartCoroutine(StartFishSpSkill(_event));
|
||
|
||
//表现形式
|
||
switch (_event.PerformanceType)
|
||
{
|
||
case FishPerformanceType.Jump:
|
||
//技能表现
|
||
StartCoroutine(Jumping(_event));
|
||
break;
|
||
case FishPerformanceType.Dash:
|
||
//技能表现和动画
|
||
Dashing(_event);
|
||
break;
|
||
case FishPerformanceType.Struggle:
|
||
StartCoroutine(Struggling(_event));
|
||
break;
|
||
}
|
||
if (_event.SpSkillType == FishHPEventTypeAdvanced.Escape)
|
||
{
|
||
if (fishSkillToAtkSpeedDuration > 0)
|
||
{
|
||
curAddAtkSpeed = 0;
|
||
curFishSkillToAtkSpeedDur = fishSkillToAtkSpeedDuration;
|
||
//新技能生效 逃跑触发增攻速
|
||
PublishPerkEvent(RodPerkType.BattlePerk_FishEscapeToAtkSpeed);
|
||
}
|
||
if (FishEscapeToDmg > 0)
|
||
{
|
||
FishToDmg(FishEscapeToDmg);
|
||
//新技能生效 逃跑触发伤害
|
||
PublishPerkEvent(RodPerkType.BattlePerk_FishEscapeToDmg);
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
if (fishEscapeToAtkSpeedDuration > 0)
|
||
{
|
||
curAddAtkSpeed = 0;
|
||
curFishSkillToAtkSpeedDur = fishEscapeToAtkSpeedDuration;
|
||
//新技能生效 技能触发增攻速
|
||
PublishPerkEvent(RodPerkType.BattlePerk_FishSkillToAtkSpeed);
|
||
}
|
||
}
|
||
if (_event.ExecuteTime > 0.001f)
|
||
{
|
||
yield return new WaitForSeconds(_event.ExecuteTime);
|
||
if (currentEvent == _event)
|
||
{
|
||
if (_event.SpSkillType == FishHPEventTypeAdvanced.Escape)
|
||
{
|
||
EscapeFish();
|
||
}
|
||
StopSkill();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 特殊技能操作
|
||
/// </summary>
|
||
IEnumerator StartFishSpSkill(FishSkill _event)
|
||
{
|
||
FishSpSkill fishSpSkill = _tables.TbFishSpSkill.GetOrDefault(_event.SpSkillID);
|
||
if (fishSpSkill == null)
|
||
{
|
||
yield break;
|
||
}
|
||
|
||
if (fishSpSkill.FishSpSkillDef is Freeze)
|
||
{
|
||
yield return new WaitForSeconds(_event.SpSkillDelay);
|
||
Freeze freeze = fishSpSkill.FishSpSkillDef as Freeze;
|
||
ShowFrostSkill(freeze);
|
||
}
|
||
else
|
||
{
|
||
if (fishSpSkillData == null)
|
||
{
|
||
fishSpSkillData = GetIFishSpSkillCenter(fishSpSkill.FishSpSkillDef);
|
||
}
|
||
else
|
||
{
|
||
fishSpSkillData.RefreshSkill(fishSpSkill.FishSpSkillDef);
|
||
}
|
||
fishSpSkillData.fishSkill = _event;
|
||
fishingData.AudioRewardFish = fishSpSkillData.AudioRewardFish();
|
||
barTarget = fishSpSkillData.GetBarTarget();
|
||
}
|
||
}
|
||
|
||
|
||
IFishSpSkillData GetIFishSpSkillCenter(FishSpSkillLabel fishSpSkillDef)
|
||
{
|
||
IFishSpSkillData _fishSpSkillData = null;
|
||
if (fishSpSkillDef is Corrupt)
|
||
{
|
||
_fishSpSkillData = new CorruptSpSkillData();
|
||
}
|
||
else if (fishSpSkillDef is ElectricShock)
|
||
{
|
||
_fishSpSkillData = new ElectricShockSpSkillData();
|
||
}
|
||
_fishSpSkillData.StartSkill(fishSpSkillDef);
|
||
return _fishSpSkillData;
|
||
}
|
||
|
||
void StopStrugglingReverseSpKill()
|
||
{
|
||
fishingBehavior?.StopFxFishSkill();
|
||
FishingPanel_Advanced.Instance?.StopFxSpKill();
|
||
fishSpSkillData.StopCount++;
|
||
fishSpSkillData.InProgress = false;
|
||
DOTween.Kill("StrugglingReverse");
|
||
strugglingReverse = 1;
|
||
}
|
||
|
||
|
||
IEnumerator StrugglingReverseSpKill(int curCount)
|
||
{
|
||
if (fishSpSkillData.Type == SpKillType.ElectricShock)
|
||
{
|
||
var spSkillData = fishSpSkillData as ElectricShockSpSkillData;
|
||
var electricShock = spSkillData.spSkill;
|
||
var shockPeriods = electricShock.ShockPeriod;
|
||
var DecayTime = electricShock.DecayTime;
|
||
var BarRandBigParam = electricShock.BarRandBigParam;
|
||
var BarRandNormalParam = electricShock.BarRandNormalParam;
|
||
while (fishSpSkillData != null && !fishSpSkillData.End && curCount == fishSpSkillData.StopCount)
|
||
{
|
||
float shockPeriod = Random.Range(shockPeriods[0], shockPeriods[1]);
|
||
float decayTime = Random.Range(DecayTime[0], DecayTime[1]);
|
||
float barRandBigParam = Random.Range(BarRandBigParam[0], BarRandBigParam[1]);
|
||
float barRandNormalParam = Random.Range(BarRandNormalParam[0], BarRandNormalParam[1]);
|
||
strugglingReverse = barRandBigParam;
|
||
DOTween.To(() => strugglingReverse, x => strugglingReverse = x, barRandNormalParam, decayTime).SetId("StrugglingReverse");
|
||
yield return new WaitForSeconds(shockPeriod);
|
||
}
|
||
}
|
||
}
|
||
|
||
IEnumerator ShowSpSkill()
|
||
{
|
||
int curCount = fishSpSkillData.StopCount;
|
||
if (barTarget != null)
|
||
{
|
||
FishingPanel_Advanced.Instance?.SetImageSprite(barTarget);
|
||
}
|
||
yield return new WaitForSeconds(fishSpSkillData.fishSkill.SpSkillDelay);
|
||
if (fishSpSkillData.End || curCount != fishSpSkillData.StopCount)
|
||
{
|
||
yield break;
|
||
}
|
||
|
||
fishingBehavior?.PlayFxFishSkill(fishSpSkillData);
|
||
GContext.Publish(new EventUISound(fishSpSkillData.AudioScreen()));
|
||
FishingPanel_Advanced.Instance?.PlaySpKillFx(fishSpSkillData);
|
||
if (fishSpSkillData.InProgress)
|
||
{
|
||
yield break;
|
||
}
|
||
fishSpSkillData.InProgress = true;
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
if (fishSpSkillData.Type == SpKillType.ElectricShock)
|
||
{
|
||
bool isGuide = fishingEventData.TargetGuidance(_tables.TbGlobalConfig.ElectricSkillGuidance);
|
||
StartCoroutine(StrugglingReverseSpKill(curCount));
|
||
}
|
||
else if (fishSpSkillData.Type == SpKillType.Corrupt)
|
||
{
|
||
bool isGuide = fishingEventData.TargetGuidance(_tables.TbGlobalConfig.CorruptSkillGuidance);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 显示冰冻界面
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
void ShowFrostSkill(Freeze freeze)
|
||
{
|
||
FishingEventData fishingEventData = GContext.container.Resolve<FishingEventData>();
|
||
bool isGuide = fishingEventData.TargetGuidance(_tables.TbGlobalConfig.FreezeSkillGuidance);
|
||
FishingPanel_Advanced.Instance?.ShowFreezeSkill(freeze);
|
||
}
|
||
|
||
FishJump GetFishJump()
|
||
{
|
||
List<int> animationTypeList = fishingData.curFishData.AnimationTypeList;
|
||
if (animationTypeList.Count <= 1)
|
||
{
|
||
return _tables.TbFishJump.GetOrDefault(animationTypeList[0]);
|
||
}
|
||
List<FishJump> fishJumps = new List<FishJump>();
|
||
int weight = 0;
|
||
foreach (var item in animationTypeList)
|
||
{
|
||
FishJump fishJump = _tables.TbFishJump.GetOrDefault(item);
|
||
if (fishJump != null)
|
||
{
|
||
fishJumps.Add(fishJump);
|
||
weight += fishJump.Weight;
|
||
}
|
||
}
|
||
if (fishJumps.Count == 1)
|
||
{
|
||
return fishJumps[0];
|
||
}
|
||
int random = Random.Range(0, weight);
|
||
foreach (var item in fishJumps)
|
||
{
|
||
random -= item.Weight;
|
||
if (random <= 0)
|
||
{
|
||
return item;
|
||
}
|
||
}
|
||
Debug.LogError("Not FishJump FishDataID =" + fishingData.curFishData.ID);
|
||
return null;
|
||
}
|
||
|
||
FishStruggle GetFishStruggle()
|
||
{
|
||
List<int> animationTypeList = fishingData.curFishData.AnimationTypeList;
|
||
if (animationTypeList.Count <= 1)
|
||
{
|
||
return _tables.TbFishStruggle.GetOrDefault(animationTypeList[0]);
|
||
}
|
||
List<FishStruggle> fishStruggles = new List<FishStruggle>();
|
||
int weight = 0;
|
||
foreach (var item in animationTypeList)
|
||
{
|
||
FishStruggle fishStruggle = _tables.TbFishStruggle.GetOrDefault(item);
|
||
if (fishStruggle != null)
|
||
{
|
||
fishStruggles.Add(fishStruggle);
|
||
weight += fishStruggle.Weight;
|
||
}
|
||
}
|
||
if (fishStruggles.Count == 1)
|
||
{
|
||
return fishStruggles[0];
|
||
}
|
||
int random = Random.Range(0, weight);
|
||
foreach (var item in fishStruggles)
|
||
{
|
||
random -= item.Weight;
|
||
if (random < 0)
|
||
{
|
||
return item;
|
||
}
|
||
}
|
||
Debug.LogError("Not FishStruggle FishDataID =" + fishingData.curFishData.ID);
|
||
return null;
|
||
}
|
||
void EscapeFish()
|
||
{
|
||
GContext.Publish(new VibrationData(HapticTypes.Warning));
|
||
escapeFish = true;
|
||
ChangeFishingState(FishingStateName.Escape);
|
||
//往外游
|
||
fishingBehavior?.EscapeFish(Mathf.Max(fishingData.MaxZEscape, fishingData.MaxLinelength) + 5);
|
||
}
|
||
|
||
IEnumerator Jumping(FishSkill _event)
|
||
{
|
||
jumpFish = true;
|
||
ChangeFishingState(FishingStateName.Jump);
|
||
float executeTime = _event.ExecuteTime;
|
||
while (currentEvent == _event && executeTime > 0.001f && fishingData.IsDrawing)
|
||
{
|
||
//跳跃
|
||
float jumpTime = Random.Range(_event.PerformanceParam[0], _event.PerformanceParam[1]);
|
||
if (curFishingStateName == FishingStateName.Jump)
|
||
{
|
||
fishingData.FishJump = GetFishJump();
|
||
if (fishingData.FishJump != null)
|
||
{
|
||
fishingBehavior?.PlayJump();
|
||
PlayShowSpSkill();
|
||
float jumpEndTime = fishingData.FishJump.JumpEndTime;
|
||
executeTime -= jumpEndTime;
|
||
fishingData.FishSkillPerformSpeed = 1 / fishingData.FishSkillIncPerform;
|
||
fishingData.FishSkillPerformBack = 1;
|
||
DOTween.To(() => fishingData.FishSkillPerformSpeed, x => fishingData.FishSkillPerformSpeed = x, 1, jumpEndTime);
|
||
yield return new WaitForSeconds(jumpEndTime);
|
||
if (fishSpSkillData != null && !fishSpSkillData.End && fishSpSkillData.Type == SpKillType.Corrupt)
|
||
{
|
||
StopStrugglingReverseSpKill();
|
||
}
|
||
fishingData.FishSkillPerformSpeed = fishingData.FishSkillIncPerform;
|
||
fishingData.FishSkillPerformBack = fishingData.FishSkillDecPerform;
|
||
DOTween.To(() => fishingData.FishSkillPerformSpeed, x => fishingData.FishSkillPerformSpeed = x, 1, jumpTime);
|
||
DOTween.To(() => fishingData.FishSkillPerformBack, x => fishingData.FishSkillPerformBack = x, 1, jumpTime);
|
||
|
||
}
|
||
}
|
||
executeTime -= jumpTime;
|
||
if (executeTime > 0.001f)
|
||
{
|
||
yield return new WaitForSeconds(jumpTime);
|
||
}
|
||
}
|
||
jumpFish = false;
|
||
if (curFishingStateName == FishingStateName.Jump)
|
||
{
|
||
ChangeFishingState(FishingStateName.Move);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 鱼的移动速度不固定,所以时间方面放在FishingBehavior里面
|
||
/// </summary>
|
||
/// <param name="_event"></param>
|
||
void Dashing(FishSkill _event)
|
||
{
|
||
dashSpeedPercentInc = _event.PerformanceParam[0];
|
||
fishingData.DashStayTime = _event.PerformanceParam[1];
|
||
fishingData.NextPointNearDistance = _event.PerformanceParam[2];
|
||
fishingData.NextPointFarDistance = _event.PerformanceParam[3];
|
||
fishingBehavior?.DashStayTime();
|
||
}
|
||
/// <summary>
|
||
/// 开始跳跃或者挣扎
|
||
/// </summary>
|
||
public void PlayShowSpSkill()
|
||
{
|
||
if (fishSpSkillData != null && !fishSpSkillData.End)
|
||
{
|
||
StartCoroutine(ShowSpSkill());
|
||
}
|
||
}
|
||
bool struggleing;
|
||
IEnumerator Struggling(FishSkill _event)
|
||
{
|
||
float executeTime = _event.ExecuteTime;
|
||
float struggleTime = 0;
|
||
while (currentEvent == _event && executeTime > 0.001f && fishingData.IsDrawing)
|
||
{
|
||
SetFishStruggle();
|
||
fishingBehavior?.SetStruggle();
|
||
struggleing = true;
|
||
PlayShowSpSkill();
|
||
//开始挣扎
|
||
//fishingBehavior?.StartSplashloopScale();
|
||
dashSpeedPercentInc = _event.PerformanceParam[0];
|
||
fishingBehavior?.CloseBaitDoTween();
|
||
fishingData.FishSkillPerformSpeed = 1 / fishingData.FishSkillIncPerform;
|
||
fishingData.FishSkillPerformBack = 1;
|
||
struggleTime = Random.Range(_event.PerformanceParam[2], _event.PerformanceParam[3]);
|
||
yield return new WaitForSeconds(struggleTime);
|
||
if (fishSpSkillData != null && !fishSpSkillData.End && fishSpSkillData.Type == SpKillType.Corrupt)
|
||
{
|
||
StopStrugglingReverseSpKill();
|
||
}
|
||
executeTime -= struggleTime;
|
||
struggleing = false;
|
||
//fishingBehavior?.EndSplashloopScale();
|
||
//挣扎间隔
|
||
struggleTime = Random.Range(_event.PerformanceParam[4], _event.PerformanceParam[5]);
|
||
//下潜等逻辑
|
||
dashSpeedPercentInc = _event.PerformanceParam[1];
|
||
fishingBehavior?.CloseBaitDoTween();
|
||
fishingData.FishSkillPerformSpeed = fishingData.FishSkillIncPerform;
|
||
fishingData.FishSkillPerformBack = fishingData.FishSkillDecPerform;
|
||
DOTween.To(() => fishingData.FishSkillPerformSpeed, x => fishingData.FishSkillPerformSpeed = x, 1, struggleTime);
|
||
DOTween.To(() => fishingData.FishSkillPerformBack, x => fishingData.FishSkillPerformBack = x, 1, struggleTime);
|
||
|
||
if (fishingBehavior?.FishBehaviour != null)
|
||
{
|
||
fishingBehavior?.FishBehaviour.PlaySwim01();
|
||
float subStruggleTime = struggleTime / 2;
|
||
fishingBehavior.FishBehaviour.transform.DOLocalMoveY(_event.PerformanceParam[6], subStruggleTime);
|
||
yield return new WaitForSeconds(subStruggleTime);
|
||
fishingBehavior.FishBehaviour.transform.DOLocalMoveY(0, subStruggleTime);
|
||
yield return new WaitForSeconds(subStruggleTime);
|
||
}
|
||
else
|
||
{
|
||
yield return new WaitForSeconds(struggleTime);
|
||
}
|
||
executeTime -= struggleTime;
|
||
}
|
||
}
|
||
void SetFishStruggle()
|
||
{
|
||
fishingData.FishStruggle = GetFishStruggle();
|
||
}
|
||
IEnumerator HPRecover(FishSkill _event)
|
||
{
|
||
//FishHPEventType
|
||
float ExecuteTime = _event.ExecuteTime;
|
||
//每秒回血
|
||
float HPRecover = _event.SpSkillParams[0] / ExecuteTime;
|
||
while (ExecuteTime > 0 && _fishCurrentHealth < _fishMaxHealth && currentEvent == _event)
|
||
{
|
||
ExecuteTime -= Time.deltaTime;
|
||
_fishCurrentHealth += _fishMaxHealth * HPRecover * Time.deltaTime;
|
||
yield return null;
|
||
}
|
||
}
|
||
void SetComboZone()
|
||
{
|
||
if (!isShowCombo)
|
||
{
|
||
ComboZone = 0;
|
||
}
|
||
else
|
||
{
|
||
var fishDistanceToZoneScaleParam = _tables.TbFishStatsConfig.FishDistanceToZoneScaleParam;
|
||
float comboZoneParam1 = (fishingBehavior.LineDistance + fishDistanceToZoneScaleParam[2]) * fishDistanceToZoneScaleParam[3];
|
||
comboZoneParam1 = Mathf.Clamp(comboZoneParam1, fishDistanceToZoneScaleParam[0], fishDistanceToZoneScaleParam[1]);
|
||
float fishHeightToZoneScaleParam = _tables.TbFishStatsConfig.FishHeightToZoneScaleParam[2] * (fishingBehavior.FishAnimationRoot.position.y - fishingData.curFishData.UnderwaterOffset);
|
||
float comboZoneParam2 = Mathf.Clamp(fishHeightToZoneScaleParam, _tables.TbFishStatsConfig.FishHeightToZoneScaleParam[0], _tables.TbFishStatsConfig.FishHeightToZoneScaleParam[1]);
|
||
float comboZoneParam = 1 - comboZoneParam1 - comboZoneParam2;
|
||
//鱼竿稳定性抵抗
|
||
ComboZone = ComboZoneScale * Mathf.Min(1, (1 + FishComboScaleResist) * comboZoneParam);
|
||
}
|
||
FishingPanel_Advanced.Instance?.SetTensionBarScale(ComboZone);
|
||
}
|
||
void SetFishSpeed()
|
||
{
|
||
float ReelingToFishSpeed = 1 / (_linePower * _tables.TbFishStatsConfig.ReelingToFishSpeedParam[2] + 1);
|
||
ReelingToFishSpeed = Mathf.Clamp(ReelingToFishSpeed, _tables.TbFishStatsConfig.ReelingToFishSpeedParam[0], _tables.TbFishStatsConfig.ReelingToFishSpeedParam[1]);
|
||
float speedHpCurveValue = fishingBehavior.GetSpeedHpCurveValue(_fishCurrentHealth / _fishMaxHealth);
|
||
float fishSpeedParam = (1 - FishSpeedResist) * (1 - FishEscapeSpeedResist);//鱼的速度属性参数
|
||
_fishSpeed = fishingData.FishSpeed *
|
||
fishSpeedParam *
|
||
speedHpCurveValue *
|
||
ReelingToFishSpeed *
|
||
dashSpeedPercentInc;//*技能表现额外移动速度
|
||
|
||
var FishAnimSpeedParam = _tables.TbFishStatsConfig.FishAnimSpeedParam;
|
||
FishAnimSpeed = FishAnimSpeedParam[2]
|
||
+ (fishingData.StrugglingPower + strugglingPowerInc) * FishAnimSpeedParam[3]
|
||
+ (fishingData.Speed + speedInc) * FishAnimSpeedParam[4];
|
||
FishAnimSpeed = Mathf.Clamp(FishAnimSpeed, FishAnimSpeedParam[0], FishAnimSpeedParam[1]);
|
||
fishingData.FishAnimSpeed = FishAnimSpeed;
|
||
|
||
float ReelingToAnimSpeed = _linePower * _tables.TbFishStatsConfig.ReelingToFishSpeedParam[3] + 1;
|
||
_aniSpeed = FishAnimSpeed * fishingData.curFishData.AnimSpeed * speedHpCurveValue * ReelingToAnimSpeed * dashSpeedPercentInc;
|
||
if (struggleing)
|
||
{
|
||
fishingBehavior?.SetFishAnimSpeed(1);
|
||
return;
|
||
}
|
||
if (curFishingStateName == FishingStateName.MaxCombo)
|
||
{
|
||
fishingBehavior?.SetFishAnimSpeed(_aniSpeed * 1.2f);
|
||
}
|
||
else
|
||
{
|
||
fishingBehavior?.SetFishAnimSpeed(_aniSpeed);
|
||
}
|
||
}
|
||
void OnViliganceIncChange()
|
||
{
|
||
var VigilanceToSwimmingArea = _tables.TbFishStatsConfig.VigilanceToSwimmingNearZ;
|
||
//最近移动距离
|
||
_nearDistance = (VigilanceToSwimmingArea[2] + (fishingData.Vigilance + viliganceInc) * VigilanceToSwimmingArea[3]) * (1 - FishDistanceResist);
|
||
VigilanceToSwimmingArea = _tables.TbFishStatsConfig.VigilanceToSwimmingFarZ;
|
||
//最远移动距离
|
||
_farDistance = (VigilanceToSwimmingArea[2] + (fishingData.Vigilance + viliganceInc) * VigilanceToSwimmingArea[3]) * (1 - FishDistanceResist);
|
||
}
|
||
|
||
//更新血量
|
||
bool isShowUI = false;
|
||
|
||
public void UIEatCheck()
|
||
{
|
||
if (fishingData.UIEatHpPercent > -0.0001f/* && _fishCurrentHealth / _fishMaxHealth < fishingData.UIEatHpPercent - 0.0001f*/)
|
||
{
|
||
//UI吃鱼
|
||
if (!isEat)
|
||
{
|
||
FishingPanel_Advanced.Instance?.UpdateTensionBar(_linePowerType, _linePower, fishingBehavior.fishSwimAreaZFar, fishingBehavior.fishSwimAreaZNear, fishingBehavior.LineDistance);
|
||
|
||
isEat = true;
|
||
StartSpEatFish(_fishCurrentHealth / _fishMaxHealth > 0.001f);
|
||
}
|
||
}
|
||
}
|
||
|
||
void DrawingHP()
|
||
{
|
||
if (atkSpeedPro > 0)
|
||
{
|
||
curAtkSpeedCD += Time.deltaTime;
|
||
if (curAtkSpeedCD > 1)
|
||
{
|
||
curAtkSpeedCD = 0;
|
||
if (atkSpeedPro > Random.value)
|
||
{
|
||
curAtkSpeedCD = -atkSpeedCD + 1;
|
||
curAddAtkSpeed = stkSpeed;
|
||
//新技能生效 全程触发增攻速
|
||
PublishPerkEvent(RodPerkType.BattlePerk_AllToAtkSpeed);
|
||
}
|
||
else
|
||
{
|
||
curAddAtkSpeed = 0;
|
||
}
|
||
}
|
||
}
|
||
if (curFishSkillToAtkSpeedDur > 0)
|
||
{
|
||
curAddAtkSpeed = fishSkillToAtkSpeed;
|
||
curFishSkillToAtkSpeedDur -= Time.deltaTime;
|
||
if (curFishSkillToAtkSpeedDur < 0)
|
||
{
|
||
curAddAtkSpeed = 0;
|
||
}
|
||
}
|
||
if (PiercingAddDamageTime > 0)
|
||
{
|
||
PiercingAddDamageTime -= Time.deltaTime;
|
||
}
|
||
DamageIntervalTime += Time.deltaTime * (1 + curAddAtkSpeed);
|
||
if (DamageIntervalTime < fishingData.fishRodData.DamageInterval[curDamageIndex])
|
||
{
|
||
return;
|
||
}
|
||
DamageIntervalTime -= fishingData.fishRodData.DamageInterval[curDamageIndex];
|
||
float _damageMultiplier = Mathf.Lerp(MinDrawingHP, 1, _linePower);
|
||
bool isCombo = _isCombo == 2;
|
||
if (isCombo)
|
||
{
|
||
_damageMultiplier *= ComboDrawingHP;
|
||
GContext.Publish(new VibrationData(HapticTypes.LightImpact));
|
||
if (ComboToAtkSpeed > 0 && ComboToAtkSpeed > Random.value)
|
||
{
|
||
_damageMultiplier *= 2;
|
||
//新技能生效 全力收线触发暴击
|
||
PublishPerkEvent(RodPerkType.BattlePerk_ComboToAtkSpeed);
|
||
}
|
||
}
|
||
int damageIndex = curDamageIndex;
|
||
if (damageIndex >= fishingData.fishRodData.DamageMag.Count)
|
||
{
|
||
damageIndex %= fishingData.fishRodData.DamageMag.Count;
|
||
Debug.LogError($"{fishingData.fishRodData.ID} DamageMag Out Of Range {damageIndex} |" +
|
||
$" DamageInterval Count == {fishingData.fishRodData.DamageInterval.Count} | " +
|
||
$"DamageMag Count {fishingData.fishRodData.DamageMag.Count}");
|
||
}
|
||
_damageMultiplier *= MaxDrawingHP
|
||
* fishingData.fishRodData.DamageMag[damageIndex]
|
||
* (1 + fishingData.CardDamageMag) * (1 + fishingData.EventFishDamageMag);
|
||
if (PiercingAddDamageTime > 0)
|
||
{
|
||
_damageMultiplier *= (1 + PiercingAddDamage);
|
||
}
|
||
float crit = AllToCrit;
|
||
bool critHit = false;
|
||
if (tensionToCritB > 0)
|
||
{
|
||
crit = Mathf.Lerp(tensionToCritA, tensionToCritB, _linePower);
|
||
}
|
||
if (NOCrit > 0)
|
||
{
|
||
crit = NOCrit;
|
||
}
|
||
if (crit > Random.value)
|
||
{
|
||
critHit = true;
|
||
_damageMultiplier *= 2;
|
||
//新技能生效 全程触发暴击 or 张力触发暴击
|
||
if (AllToCrit > 0)
|
||
{
|
||
PublishPerkEvent(RodPerkType.BattlePerk_AllToCrit);
|
||
}
|
||
else if (tensionToCritB > 0)
|
||
{
|
||
PublishPerkEvent(RodPerkType.BattlePerk_TensionToCrit);
|
||
}
|
||
}
|
||
_damageMultiplier *= (1 + curComboToExDmg);
|
||
if (Titan1 > Random.value && Titan2 > 0)
|
||
{
|
||
_damageMultiplier *= Titan2;
|
||
}
|
||
if (curFishingStateName != FishingStateName.SpEating)
|
||
{
|
||
_fishCurrentHealth -= _damageMultiplier;
|
||
}
|
||
if (!jumpFish && fishingData.UIEatHpPercent > -0.0001f && _fishCurrentHealth / _fishMaxHealth < fishingData.UIEatHpPercent - 0.0001f)
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowFishInfo(
|
||
(int)_damageMultiplier,
|
||
_fishCurrentHealth / _fishMaxHealth, isCombo, critHit);
|
||
//UI吃鱼
|
||
if (!isEat && curFishingStateName != FishingStateName.UIEating && curFishingStateName != FishingStateName.SpEating)
|
||
{
|
||
isEat = true;
|
||
StartSpEatFish(_fishCurrentHealth / _fishMaxHealth > 0.001f);
|
||
}
|
||
return;
|
||
}
|
||
curDamageIndex++;
|
||
if (curDamageIndex >= fishingData.fishRodData.DamageInterval.Count)
|
||
{
|
||
curDamageIndex = 0;
|
||
}
|
||
|
||
// 如果鱼的血量小于0
|
||
if (_fishCurrentHealth + _damageMultiplier < 0.001f)
|
||
{
|
||
GContext.container.Resolve<GuideDataCenter>().AddIndex(true);
|
||
|
||
StopAllCoroutines();
|
||
fishingData.IsCatchingFish = true;
|
||
OnFishingIsOver();
|
||
fishingBehavior?.SetCatchStatus();
|
||
}
|
||
else
|
||
{
|
||
FishingPanel_Advanced.Instance?.ShowFishInfo(
|
||
(int)_damageMultiplier,
|
||
_fishCurrentHealth / _fishMaxHealth, isCombo, critHit);
|
||
//触发鱼的血量事件
|
||
if (escapeFishStart)
|
||
{
|
||
return;
|
||
}
|
||
if (_fishCurrentHealth / _fishMaxHealth < _lastHealth || AllDamageTime > _lastHealthTime)
|
||
{
|
||
FishSkill _event = null;
|
||
for (int i = _fishHPEventList.Count - 1; i >= 0; i--)
|
||
{
|
||
FishHPEvent fishHpEvent = _fishHPEventList[i];
|
||
|
||
//获取最低HP事件
|
||
if ((fishHpEvent.HPPercent > 0 && fishHpEvent.HPPercent < _lastHealth && fishHpEvent.HPPercent >= _fishCurrentHealth / _fishMaxHealth)
|
||
|| (fishHpEvent.MaxDelay > 0 && AllDamageTime >= fishHpEvent.MaxDelay && _lastHealthTime < fishHpEvent.MaxDelay))
|
||
{
|
||
_event = fishHpEvent.fishSkill;
|
||
|
||
if (fishHpEvent.HPPercent > 0 && _lastHealth > fishHpEvent.HPPercent)
|
||
{
|
||
_lastHealth = fishHpEvent.HPPercent;
|
||
}
|
||
if (fishHpEvent.MaxDelay > 0 && _lastHealthTime < fishHpEvent.MaxDelay)
|
||
{
|
||
_lastHealthTime = fishHpEvent.MaxDelay;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (_event != null)
|
||
{
|
||
StopSkill();
|
||
currentEvent = _event;
|
||
nextEvent = _event;
|
||
DOTween.Kill("FishHPEventType");
|
||
TriggerFishHpEvent(_event);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//开始ui吃鱼
|
||
IEnumerator UIEatFish(bool UIpre)
|
||
{
|
||
FishingPanel_Advanced.Instance?.CloseMaxComboTip();
|
||
//大鱼预游速度1秒
|
||
if (UIpre)
|
||
{
|
||
//大鱼预游
|
||
yield return StartCoroutine(fishingBehavior.UIPreSwim());
|
||
ChangeFishingState(FishingStateName.UIEating);
|
||
yield return new WaitForSeconds(fishingData.fishingBehaviorConf.bigFishEatTime);
|
||
}
|
||
else
|
||
{
|
||
fishingBehavior.UIPreSwimB();
|
||
ChangeFishingState(FishingStateName.UIEating);
|
||
}
|
||
//播放镜头动画
|
||
fishingBehavior.PlayEatEndAni();
|
||
isEat = false;
|
||
//干掉鱼
|
||
GContext.Publish(new LoadFishListEvent());
|
||
StopSkill();
|
||
fishingBehavior.fishAnimator.enabled = false;
|
||
|
||
//显示UI动画
|
||
FishingPanel_Advanced.Instance?.UIEatFish();
|
||
yield return new WaitForSeconds(fishingData.fishingBehaviorConf.UIEatExitTime);
|
||
fishingBehavior.fishAnimator.enabled = true;
|
||
fishingBehavior.fishAnimator.SetBool("_drawing01", false);
|
||
fishingBehavior.fishAnimator.SetBool("_drawing02", false);
|
||
fishingBehavior.fishAnimator.SetTrigger($"_drawing0{fishingData.curFishData.ShowAnimation}");
|
||
fishingBehavior.fishAnimator.SetTrigger("_drawing");
|
||
_linePower = 0.5f;
|
||
yield return new WaitForSeconds(fishingData.fishingBehaviorConf.UIEatEndTime);
|
||
GContext.Publish(ERightState.Drawing);
|
||
_linePower = 0.5f;
|
||
DamageIntervalTime = -0.1f;
|
||
ChangeFishingState(FishingStateName.Move);
|
||
FishingPanel_Advanced.Instance?.UIEatFishEnd();
|
||
PlayNewItem();
|
||
UpdateComboMultiplayer();
|
||
yield return new WaitForSeconds(damageProtectionTime);
|
||
//bool isGuide = GContext.container.Resolve<GuideDataCenter>().InspectTriggerGuide("FishingPanel_Advanced");
|
||
SetShowCombo();
|
||
OnCombo1();
|
||
|
||
if (EatfishToDmg > 0)
|
||
{
|
||
FishToDmg(EatfishToDmg);
|
||
//新技能生效 吃鱼触发伤害
|
||
PublishPerkEvent(RodPerkType.BattlePerk_EatfishToDmg);
|
||
}
|
||
}
|
||
void PublishPerkEvent(RodPerkType perkType)
|
||
{
|
||
if (perkLevel.TryGetValue(perkType, out (int id, int level) data))
|
||
{
|
||
perkLevel.Remove(perkType);
|
||
GContext.Publish(new RodPerkTriggerEvent(data.id, data.level));
|
||
}
|
||
}
|
||
//超级吃鱼
|
||
void StartSpEatFish(bool UIpre)
|
||
{
|
||
AllDamageTime = 0;
|
||
StartCoroutine(UIEatFish(UIpre));
|
||
}
|
||
//动画吃鱼结束从新钓鱼
|
||
public void OnEatEnd(OnEatEndEvent onEatEndEvent)
|
||
{
|
||
AllDamageTime = 0;
|
||
StopAllCoroutines();
|
||
fishingData.IsDrawing = true;
|
||
_linePower = 0.5f;
|
||
_curComboMultiplayer = 0;
|
||
_comboMultiplayer = 0;
|
||
_isCombo = 0;
|
||
DamageIntervalTime = 0;
|
||
ChangeFishingState(FishingStateName.Move);
|
||
FishingPanel_Advanced.Instance?.OnEatEnd();
|
||
PlayNewItem();
|
||
fishingBehavior.fishAnimator.enabled = true;
|
||
}
|
||
void PlayNewItem()
|
||
{
|
||
fishingBehavior?.PlayNewItem();
|
||
}
|
||
void ChangeFishingState(FishingStateName fishingStateName = FishingStateName.Move)
|
||
{
|
||
if (curFishingStateName == fishingStateName)
|
||
{
|
||
return;
|
||
}
|
||
if (curFishingState != null)
|
||
{
|
||
curFishingState.OutState();
|
||
}
|
||
curFishingStateName = fishingStateName;
|
||
switch (fishingStateName)
|
||
{
|
||
case FishingStateName.MaxCombo:
|
||
curFishingState = new FishingStateMaxCombo();
|
||
break;
|
||
default:
|
||
curFishingState = new FishingStateMove();
|
||
break;
|
||
}
|
||
curFishingState.InState(fishingBehavior, fishingData);
|
||
}
|
||
private void OnDisable()
|
||
{
|
||
StopSoundCombo();
|
||
StopRodAudio();
|
||
StopNotReeling();
|
||
StopDrawingSplash();
|
||
AudioRelease();
|
||
}
|
||
private void OnDestroy()
|
||
{
|
||
disposables?.Dispose();
|
||
_comboDisposable?.Dispose();
|
||
_hpcoroutine = null;
|
||
StopAllCoroutines();
|
||
}
|
||
}
|
||
public class RodPerkTriggerEvent
|
||
{
|
||
public int PerkID;
|
||
public int level;
|
||
public RodPerkTriggerEvent(int rodPerk, int level)
|
||
{
|
||
PerkID = rodPerk;
|
||
this.level = level;
|
||
}
|
||
} |