备份CatanBuilding瘦身独立工程
This commit is contained in:
118
Assets/Scripts/GampPlay/FishingB/FishCome.cs
Normal file
118
Assets/Scripts/GampPlay/FishingB/FishCome.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using DG.Tweening;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.Splines;
|
||||
|
||||
public class FishCome : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
public SplineAnimate ssplineAnimate;
|
||||
public Transform FishAnimationRoot;
|
||||
GameObject splinesRoot;
|
||||
FishComeSplines fishComeSplines;
|
||||
float posY;
|
||||
private void Awake()
|
||||
{
|
||||
ssplineAnimate.enabled = false;
|
||||
}
|
||||
public async void LoadSplines(string splinesRootName)
|
||||
{
|
||||
splinesRoot = await Addressables.InstantiateAsync(splinesRootName, transform.parent).Task;
|
||||
splinesRoot.transform.localPosition = Vector3.up * posY;
|
||||
fishComeSplines = splinesRoot.GetComponent<FishComeSplines>();
|
||||
}
|
||||
public void SetPosY(float y)
|
||||
{
|
||||
posY = y;
|
||||
var pos = transform.position;
|
||||
transform.position = new Vector3(pos.x, y, pos.z);
|
||||
splinesRoot.transform.position = new Vector3(0, y, 0);
|
||||
}
|
||||
public void FishComeMove(float speed)
|
||||
{
|
||||
if (fishComeSplines != null)
|
||||
{
|
||||
SplineContainer[] splineContainers = fishComeSplines.splineContainers;
|
||||
if (splineContainers == null || splineContainers.Length < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ssplineAnimate.MaxSpeed = speed;
|
||||
ssplineAnimate.Container = splineContainers[Random.Range(0, splineContainers.Length)];
|
||||
ssplineAnimate.enabled = true;
|
||||
ssplineAnimate.Restart(true);
|
||||
ssplineAnimate.Play();
|
||||
}
|
||||
}
|
||||
public float UIEatMove(float speed, SplineContainer splineContainer)
|
||||
{
|
||||
ssplineAnimate.MaxSpeed = speed;
|
||||
//SplineContainer splineContainer = UIEatSplines[Random.Range(0, UIEatSplines.Length)];
|
||||
ssplineAnimate.Container = splineContainer;
|
||||
ssplineAnimate.enabled = true;
|
||||
ssplineAnimate.Restart(false);
|
||||
ssplineAnimate.Play();
|
||||
return splineContainer.CalculateLength() / speed;
|
||||
}
|
||||
public async Task FishEatMove(float speed)
|
||||
{
|
||||
if (fishComeSplines == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SplineContainer[] UIEatSplines = fishComeSplines.UIEatSplines;
|
||||
if (UIEatSplines == null || UIEatSplines.Length < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SplineContainer splineContainer;
|
||||
if (ssplineAnimate.IsPlaying)
|
||||
{
|
||||
FishComeStop();
|
||||
Vector3 position = transform.position;
|
||||
splineContainer = UIEatSplines[0];
|
||||
Spline spline = splineContainer[0];
|
||||
Vector3 initialPosition = spline[0].Position;
|
||||
float distance = Vector3.Distance(initialPosition, position);
|
||||
SplineContainer splineContainer1;
|
||||
Spline spline1;
|
||||
Vector3 initialPosition1;
|
||||
float distance1;
|
||||
for (int i = 1; i < UIEatSplines.Length; i++)
|
||||
{
|
||||
splineContainer1 = UIEatSplines[i];
|
||||
spline1 = splineContainer1[0];
|
||||
initialPosition1 = spline1[0].Position;
|
||||
distance1 = Vector3.Distance(initialPosition1, position);
|
||||
if (distance1 < distance)
|
||||
{
|
||||
distance = distance1;
|
||||
splineContainer = splineContainer1;
|
||||
initialPosition = initialPosition1;
|
||||
}
|
||||
}
|
||||
initialPosition += fishComeSplines.transform.position;
|
||||
Quaternion rotation11 = Quaternion.LookRotation(transform.position - initialPosition);
|
||||
float time11 = distance / speed;
|
||||
transform.DORotateQuaternion(rotation11, 0.1f);
|
||||
transform.DOLocalMove(initialPosition, time11);
|
||||
await new WaitForSeconds(time11);
|
||||
}
|
||||
else
|
||||
{
|
||||
splineContainer = UIEatSplines[Random.Range(0, UIEatSplines.Length)];
|
||||
}
|
||||
float time = UIEatMove(speed, splineContainer);
|
||||
if (time > 4)
|
||||
{
|
||||
time = 4;
|
||||
}
|
||||
await new WaitForSeconds(time);
|
||||
}
|
||||
public void FishComeStop()
|
||||
{
|
||||
animator.Play("Idle01");
|
||||
ssplineAnimate.enabled = false;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GampPlay/FishingB/FishCome.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/FishCome.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e29717c77c91dc48a5f7012bf71dfda
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/Scripts/GampPlay/FishingB/FishComeSplines.cs
Normal file
10
Assets/Scripts/GampPlay/FishingB/FishComeSplines.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Splines;
|
||||
|
||||
public class FishComeSplines : MonoBehaviour
|
||||
{
|
||||
public SplineContainer[] splineContainers;
|
||||
public SplineContainer[] UIEatSplines;
|
||||
}
|
||||
11
Assets/Scripts/GampPlay/FishingB/FishComeSplines.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/FishComeSplines.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a510cf4a44c38444da147bfb7fa9224a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2601
Assets/Scripts/GampPlay/FishingB/FishingBehaviorB.cs
Normal file
2601
Assets/Scripts/GampPlay/FishingB/FishingBehaviorB.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/Scripts/GampPlay/FishingB/FishingBehaviorB.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/FishingBehaviorB.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a90fe48536dafa41809db36323d5571
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
104
Assets/Scripts/GampPlay/FishingB/FishingBehavior_EternalDeath.cs
Normal file
104
Assets/Scripts/GampPlay/FishingB/FishingBehavior_EternalDeath.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using asap.core;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
public partial class FishingBehaviorB : MonoBehaviour
|
||||
{
|
||||
void OnStartEternalDeath()
|
||||
{
|
||||
SetFfishWeight();
|
||||
fishingData.IsCatchingFish = true;
|
||||
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.SetActive(false);
|
||||
}
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.SetActive(false);
|
||||
}
|
||||
fishAnimator.speed = 1;
|
||||
|
||||
fishAnimator.SetBool("_drawing01", false);
|
||||
fishAnimator.SetBool("_drawing02", false);
|
||||
fishAnimator.SetBool("_drawing", false);
|
||||
fishAnimator.SetBool("_idle", false);
|
||||
SetPulling();
|
||||
GContext.Publish(ERightState.PiercingSp);
|
||||
_targetPos = new Vector3(0, -3, fishingBehaviorConf.piercingFishmMoveZ);
|
||||
_fish.transform.position = _targetPos;
|
||||
_fish.transform.DOKill();
|
||||
//CloseIK(true);
|
||||
_fish.transform.localRotation = Quaternion.identity;
|
||||
|
||||
_cameraAnimator.SetBool("_claim", false);
|
||||
GContext.Publish(new PlayNewItemFxEvent() { type = 1 });
|
||||
if (FishBehaviour != null)
|
||||
{
|
||||
FishBehaviour.FishAnimSpeed = 1;
|
||||
//ReelingScale 鱼缩放
|
||||
Vector3 localScale = FishBehaviour.transform.localScale * fishingData.curFishData.PullingScale;
|
||||
FishBehaviour.transform.DOScale(localScale, fishingBehaviorConf.jumpScaleTime).OnUpdate
|
||||
(
|
||||
() =>
|
||||
{
|
||||
if (FishBehaviour.mouthPos != null)
|
||||
{
|
||||
Vector3 vector3 = Vector3.zero;
|
||||
vector3 = -FishBehaviour.animator.transform.InverseTransformPoint(FishBehaviour.mouthPos.position);
|
||||
vector3.z = -vector3.z;
|
||||
FishBehaviour.animator.transform.localPosition = vector3;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (!string.IsNullOrEmpty(fishingData.curFishData.FxWaterDrop))
|
||||
{
|
||||
FxWaterDrop(fishingData.curFishData.FxWaterDrop);
|
||||
}
|
||||
|
||||
MaterialChange();
|
||||
}
|
||||
|
||||
|
||||
if (fishingData.IsEventGameFish())
|
||||
{
|
||||
StartCoroutine(HideLine());
|
||||
FishBehaviour.Pulling();
|
||||
}
|
||||
StartCoroutine(DeathTimeScale());
|
||||
StartCoroutine(ControlFishOutWater());
|
||||
StartCoroutine(ChangeSpline());
|
||||
StartCoroutine(PlayPullingSound());
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.SetActive(false);
|
||||
}
|
||||
LoadEffect("fx_fishing_splashpull");
|
||||
|
||||
rodHandleAni.SetTrigger("_piercingSp");
|
||||
_cameraAnimator.SetTrigger("_piercingSp");
|
||||
fishingRodAnimator.SetTrigger("_piercingSp");
|
||||
fishAnimator.SetTrigger("_pullingSp");
|
||||
FishingPanel_Advanced.Instance?.ShowRankInfo();
|
||||
if (!string.IsNullOrEmpty(fishingData.curFishData.FxWaterSplash))
|
||||
GContext.Publish(new PlayerRaindropEvent() { FxWaterSplash = fishingData.curFishData.FxWaterSplash });
|
||||
GContext.Publish(new VibrationData(21));
|
||||
}
|
||||
IEnumerator DeathTimeScale()
|
||||
{
|
||||
yield return new WaitForSeconds(fishingBehaviorConf.timeStartScale);
|
||||
DOTween.To(() => 0.01f, x => Time.timeScale = x, 1,
|
||||
fishingBehaviorConf.timeEndScale - fishingBehaviorConf.timeStartScale)
|
||||
.SetEase(fishingBehaviorConf.piercingSpTimeScaleCurve);
|
||||
yield return new WaitForSeconds(fishingBehaviorConf.timeEndScale);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
|
||||
IEnumerator ChangeSpline()
|
||||
{
|
||||
yield return new WaitForSeconds(fishingBehaviorConf.fishingRodDisappearsPullingSp);
|
||||
SetEffectActive("fx_fishing_splashloopreeling", false);
|
||||
ChangelineStartPos();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e3880afbe071694baae3e17b5891acf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
640
Assets/Scripts/GampPlay/FishingB/FishingBehavior_Move.cs
Normal file
640
Assets/Scripts/GampPlay/FishingB/FishingBehavior_Move.cs
Normal file
@@ -0,0 +1,640 @@
|
||||
using asap.core;
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using Game;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
using cfg;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.AddressableAssets;
|
||||
public partial class FishingBehaviorB : MonoBehaviour
|
||||
{
|
||||
|
||||
#region 进出水面
|
||||
float OldFishPos = -3f;
|
||||
float jumpoutMaxCD = 0.2f;
|
||||
float jumpoutCD = 0f;
|
||||
public void JumpWater()
|
||||
{
|
||||
if (jumpoutCD > jumpoutMaxCD)
|
||||
{
|
||||
jumpoutCD = 0;
|
||||
float newFishPos = GetFishPos().y;
|
||||
if ((newFishPos - _waterHeight) * (OldFishPos - _waterHeight) < 0)
|
||||
{
|
||||
//进出水面
|
||||
if (newFishPos > _waterHeight - 0.00001f)
|
||||
{
|
||||
Vector3 vector = _fish.transform.position;
|
||||
vector.y = _waterHeight;
|
||||
if (fx_fishing_water != null)
|
||||
{
|
||||
fx_fishing_water.transform.position = vector;
|
||||
fx_fishing_water.gameObject.SetActive(false);
|
||||
fx_fishing_water.gameObject.SetActive(true);
|
||||
}
|
||||
else if (fx_fishing_jumpout != null)
|
||||
{
|
||||
fx_fishing_jumpout.transform.position = vector;
|
||||
fx_fishing_jumpout.gameObject.SetActive(false);
|
||||
fx_fishing_jumpout.gameObject.SetActive(true);
|
||||
}
|
||||
//播音效
|
||||
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_jumpout));
|
||||
}
|
||||
else if (newFishPos < _waterHeight + 0.00001f)
|
||||
{
|
||||
Vector3 vector = _fish.transform.position;
|
||||
vector.y = _waterHeight;
|
||||
//进水面
|
||||
if (fx_fishing_water != null)
|
||||
{
|
||||
fx_fishing_water.transform.position = vector;
|
||||
fx_fishing_water.gameObject.SetActive(false);
|
||||
fx_fishing_water.gameObject.SetActive(true);
|
||||
}
|
||||
else if (fx_fishing_jumpinto != null)
|
||||
{
|
||||
fx_fishing_jumpinto.transform.position = vector;
|
||||
fx_fishing_jumpinto.gameObject.SetActive(false);
|
||||
fx_fishing_jumpinto.gameObject.SetActive(true);
|
||||
}
|
||||
//播音效
|
||||
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_jumpinto));
|
||||
|
||||
}
|
||||
}
|
||||
OldFishPos = newFishPos;
|
||||
}
|
||||
jumpoutCD += Time.deltaTime;
|
||||
}
|
||||
#endregion 进出水面
|
||||
|
||||
//跳跃相关
|
||||
bool isJumping = false;
|
||||
float JumpDistance = 1;
|
||||
GameObject fx_fishing_water;
|
||||
//GameObject fxWaterSplash;
|
||||
GameObject fxHeadFishSkill;
|
||||
GameObject fxFishJumpWaterSkill;
|
||||
GameObject fxFishStruggleSkill;
|
||||
GameObject fxAppendFishSkill;
|
||||
public async void PlayFxFishSkill(IFishSpSkillData fishSpSkillData)
|
||||
{
|
||||
string fxFish = "";
|
||||
string fxFishJumpWater = "";
|
||||
string fxFishStruggle = "";
|
||||
switch (fishSpSkillData.fishSkill.PerformanceType)
|
||||
{
|
||||
case FishPerformanceType.Jump:
|
||||
//技能表现
|
||||
fxFish = fishSpSkillData.FxFishJump();
|
||||
fxFishJumpWater = fishSpSkillData.FxFishJumpWater();
|
||||
break;
|
||||
//case FishPerformanceType.Dash:
|
||||
// break;
|
||||
case FishPerformanceType.Struggle:
|
||||
fxFishStruggle = fishSpSkillData.FxFishStruggle();
|
||||
break;
|
||||
}
|
||||
string rootFx = fishSpSkillData.FxFishSkillAppend();
|
||||
string fxWater = fishSpSkillData.FxWater();
|
||||
//string fxWaterSplashName = fishSpSkillData.FxWaterSplash();
|
||||
if (!string.IsNullOrEmpty(fxWater) && fx_fishing_water == null)
|
||||
{
|
||||
fx_fishing_water = await Addressables.InstantiateAsync(fxWater, transform, true).Task;
|
||||
fx_fishing_water?.SetActive(false);
|
||||
}
|
||||
//if (!string.IsNullOrEmpty(fxWaterSplashName) && fxWaterSplash == null)
|
||||
//{
|
||||
// fxWaterSplash = await Addressables.InstantiateAsync(fxWater, transform).Task;
|
||||
// fxWaterSplash?.SetActive(true);
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(fxFishJumpWater) && fxFishJumpWaterSkill == null)
|
||||
{
|
||||
fxFishJumpWaterSkill = await Addressables.InstantiateAsync(fxFishJumpWater, transform).Task;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(fxFishStruggle) && fxFishStruggleSkill == null && FishBehaviour != null)
|
||||
{
|
||||
fxFishStruggleSkill = await Addressables.InstantiateAsync(fxFishStruggle, FishBehaviour.transform).Task;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(fxFish) && fxHeadFishSkill == null && FishBehaviour != null && FishBehaviour.Head != null)
|
||||
{
|
||||
fxHeadFishSkill = await Addressables.InstantiateAsync(fxFish, FishBehaviour.Head).Task;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rootFx) && fxAppendFishSkill == null && FishBehaviour != null && FishBehaviour.Root != null)
|
||||
{
|
||||
fxAppendFishSkill = await Addressables.InstantiateAsync(rootFx, FishBehaviour.Head).Task;
|
||||
}
|
||||
fxHeadFishSkill?.SetActive(false);
|
||||
fxHeadFishSkill?.SetActive(true);
|
||||
fxAppendFishSkill?.SetActive(false);
|
||||
fxAppendFishSkill?.SetActive(true);
|
||||
fxFishStruggleSkill?.SetActive(false);
|
||||
fxFishStruggleSkill?.SetActive(true);
|
||||
fxFishJumpWaterSkill?.SetActive(true);
|
||||
}
|
||||
|
||||
public void StopFxFishSkill()
|
||||
{
|
||||
fxHeadFishSkill?.SetActive(false);
|
||||
}
|
||||
public void SkillRelease()
|
||||
{
|
||||
if (fxHeadFishSkill != null)
|
||||
{
|
||||
Addressables.ReleaseInstance(fxHeadFishSkill);
|
||||
fxHeadFishSkill = null;
|
||||
}
|
||||
|
||||
if (fxAppendFishSkill != null)
|
||||
{
|
||||
Addressables.ReleaseInstance(fxAppendFishSkill);
|
||||
fxAppendFishSkill = null;
|
||||
}
|
||||
if (fx_fishing_water != null)
|
||||
{
|
||||
Addressables.ReleaseInstance(fx_fishing_water);
|
||||
fx_fishing_water = null;
|
||||
}
|
||||
if (fxFishStruggleSkill != null)
|
||||
{
|
||||
Addressables.ReleaseInstance(fxFishStruggleSkill);
|
||||
fxFishStruggleSkill = null;
|
||||
}
|
||||
if (fxFishJumpWaterSkill != null)
|
||||
{
|
||||
Addressables.ReleaseInstance(fxFishJumpWaterSkill);
|
||||
fxFishJumpWaterSkill = null;
|
||||
}
|
||||
//if (fxWaterSplash != null)
|
||||
//{
|
||||
// Addressables.ReleaseInstance(fxWaterSplash);
|
||||
// fxWaterSplash = null;
|
||||
//}
|
||||
}
|
||||
public async void PlayJump()
|
||||
{
|
||||
FishData curFishData = fishingData.curFishData;
|
||||
isJumping = true;
|
||||
fishAnimator.SetTrigger($"_jumping0{fishingData.FishJump.AnimatorState}");
|
||||
fishAnimator.SetTrigger("_jumping");
|
||||
fishAnimator.SetTrigger($"_drawing0{curFishData.ShowAnimation}");
|
||||
if (FishBehaviour != null)
|
||||
{
|
||||
FishBehaviour.SetSkillInt(fishingData.FishJump.SkillIndex);
|
||||
FishBehaviour.SetTrigger("Skill");
|
||||
}
|
||||
FishJump fishJump = fishingData.FishJump;
|
||||
if (fishJump != null)
|
||||
{
|
||||
_ = StartCoroutine(PlayerJumpOutDelay(fishJump.FxJumpOutDelay, fishJump.JumpDistance));
|
||||
_ = StartCoroutine(PlayerJumpIntoDelay(fishJump.FxJumpIntoDelay));
|
||||
float jumpEndTime = fishJump.JumpEndTime;
|
||||
await Awaiters.Seconds(jumpEndTime);
|
||||
}
|
||||
isJumping = false;
|
||||
JumpDistance = 1;
|
||||
if (fxFishJumpWaterSkill != null)
|
||||
{
|
||||
fxFishJumpWaterSkill.SetActive(true);
|
||||
}
|
||||
//if (fxWaterSplash != null)
|
||||
//{
|
||||
// fxWaterSplash.transform.localScale = Vector3.one * fishingData.curFishData.SlashFxScale;
|
||||
// fxWaterSplash.SetActive(true);
|
||||
//}
|
||||
//else
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.transform.localScale = Vector3.one * fishingData.curFishData.SlashFxScale;
|
||||
fx_fishing_splashloop.SetActive(true);
|
||||
}
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.transform.localScale = Vector3.one * fishingData.curFishData.SlashFxScale;
|
||||
fx_fishing_splashwaveloop.SetActive(true);
|
||||
}
|
||||
}
|
||||
IEnumerator PlayerJumpOutDelay(float fxJumpOutDelay, float jumpDistance)
|
||||
{
|
||||
//if (fxWaterSplash != null)
|
||||
//{
|
||||
// fxWaterSplash.transform.DOScale(Vector3.zero, fxJumpOutDelay).SetEase(Ease.Linear);
|
||||
//}
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.transform.DOScale(Vector3.zero, fxJumpOutDelay).SetEase(Ease.Linear);
|
||||
}
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.transform.DOScale(Vector3.zero, fxJumpOutDelay).SetEase(Ease.Linear);
|
||||
}
|
||||
yield return new WaitForSeconds(fxJumpOutDelay);
|
||||
GContext.Publish(new EventFishingSound(SoundType.HPEvent));
|
||||
CloseBaitDoTween();
|
||||
JumpDistance = jumpDistance;
|
||||
//if (fx_fishing_splashpull != null)
|
||||
//{
|
||||
// Vector3 vector = _fish.transform.position;
|
||||
// vector.y = _waterHeight;
|
||||
// fx_fishing_splashpull.transform.position = vector;
|
||||
// fx_fishing_splashpull.SetActive(false);
|
||||
// fx_fishing_splashpull.SetActive(true);
|
||||
//}
|
||||
//if (fx_fishing_water != null)
|
||||
//{
|
||||
// fx_fishing_water.SetActive(false);
|
||||
//}
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.SetActive(false);
|
||||
}
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.SetActive(false);
|
||||
}
|
||||
|
||||
if (fxFishJumpWaterSkill != null)
|
||||
{
|
||||
fxFishJumpWaterSkill.SetActive(false);
|
||||
}
|
||||
}
|
||||
IEnumerator PlayerJumpIntoDelay(float fxJumpIntoDelay)
|
||||
{
|
||||
yield return new WaitForSeconds(fxJumpIntoDelay);
|
||||
GContext.Publish(new EventFishingSound(SoundType.HPEvent));
|
||||
CloseBaitDoTween();
|
||||
JumpDistance = 1;
|
||||
|
||||
//if (fx_fishing_splashpull != null)
|
||||
//{
|
||||
// Vector3 vector = _fish.transform.position;
|
||||
// vector.y = _waterHeight;
|
||||
// fx_fishing_splashpull.transform.position = vector;
|
||||
// fx_fishing_splashpull.SetActive(false);
|
||||
// fx_fishing_splashpull.SetActive(true);
|
||||
//}
|
||||
}
|
||||
public void StartSplashloopScale()
|
||||
{
|
||||
Vector3 localScale = Vector3.one * fishingData.curFishData.SlashFxScale * 1.5f;
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.transform.DOKill();
|
||||
fx_fishing_splashloop.transform.localScale = localScale;
|
||||
}
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.transform.DOKill();
|
||||
fx_fishing_splashwaveloop.transform.localScale = localScale;
|
||||
}
|
||||
}
|
||||
public void EndSplashloopScale()
|
||||
{
|
||||
Vector3 localScale = Vector3.one * fishingData.curFishData.SlashFxScale;
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.transform.DOKill();
|
||||
fx_fishing_splashloop.transform.DOScale(localScale, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.transform.DOKill();
|
||||
fx_fishing_splashwaveloop.transform.DOScale(localScale, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
}
|
||||
//====跳跃相关
|
||||
//=====================鱼移动算法挪位置
|
||||
private float timer = 1f;
|
||||
float dashTime = 0f;
|
||||
|
||||
private float moveTimer = 0f;
|
||||
private Vector3 _strugglePoint;
|
||||
|
||||
private Vector3 _startPos;
|
||||
private Vector3 _curStartPos;
|
||||
Tweener baitDoTween;
|
||||
//X轴偏移
|
||||
float _nearDistance = 1;
|
||||
float _farDistance = 1;
|
||||
float distance = 1;
|
||||
float fishSpeed = 1;
|
||||
public bool Far => _fish.transform.position.z >= _farDistance;
|
||||
void SetBaitStartPos()
|
||||
{
|
||||
_nearDistance = _fishSwimAreaZNear;
|
||||
_nearDistance = Mathf.Clamp(_nearDistance, _fishSwimAreaZNear, _fishSwimAreaZFar);
|
||||
_farDistance = _fishSwimAreaZFar;
|
||||
_farDistance = Mathf.Clamp(_farDistance, _fishSwimAreaZNear, _fishSwimAreaZFar);
|
||||
_startPos = _fish.transform.position;
|
||||
_curStartPos = _startPos;
|
||||
|
||||
float z = Random.Range(_nearDistance, _farDistance);
|
||||
_strugglePoint = GeneratePoint(z, 0) / 2;
|
||||
timer = 10;
|
||||
}
|
||||
public async void OnFail(float z, float speed)
|
||||
{
|
||||
EscapeFish(z);
|
||||
var targetPos = Vector3.Lerp(_curStartPos, _strugglePoint, fishSpeed / distance);
|
||||
_fish.transform.DOMove(targetPos, 1);
|
||||
await Awaiters.Seconds(1);
|
||||
GetFish.gameObject.SetActive(false);
|
||||
if (fx_fishing_splashloop != null)
|
||||
{
|
||||
fx_fishing_splashloop.SetActive(false);
|
||||
}
|
||||
if (fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fx_fishing_splashwaveloop.SetActive(false);
|
||||
}
|
||||
}
|
||||
//往安全区域外移动
|
||||
public void EscapeFish(float z)
|
||||
{
|
||||
moveTimer = 0;
|
||||
_strugglePoint.z = z;
|
||||
_strugglePoint.x = 0;
|
||||
_curStartPos = _fish.transform.position;
|
||||
distance = Vector3.Distance(_curStartPos, _strugglePoint);
|
||||
FishTurn();
|
||||
}
|
||||
void SimulateFishEscape(float fishSpeed)
|
||||
{
|
||||
moveTimer += Time.deltaTime * fishSpeed;
|
||||
|
||||
if (moveTimer / distance < 1)
|
||||
{
|
||||
_fish.transform.position = Vector3.Lerp(_curStartPos, _strugglePoint, moveTimer / distance);
|
||||
Debug.Log("moveTimer / distance:" + _strugglePoint);
|
||||
}
|
||||
}
|
||||
//停止正常的移动,贝塞尔DoTween
|
||||
public void CloseBaitDoTween()
|
||||
{
|
||||
if (baitDoTween != null)
|
||||
{
|
||||
baitDoTween.Kill();
|
||||
baitDoTween = null;
|
||||
timer = 10;
|
||||
}
|
||||
}
|
||||
public void DashStayTime()
|
||||
{
|
||||
SetFishDash();
|
||||
dashTime = fishingData.DashStayTime + 1;
|
||||
timer = 10;
|
||||
}
|
||||
void SetFishDash()
|
||||
{
|
||||
fishingData.DashStay = GetFishDash();
|
||||
if (FishBehaviour != null && fishingData.DashStay != null)
|
||||
{
|
||||
FishBehaviour.SetSkillInt(fishingData.DashStay.SkillIndex);
|
||||
}
|
||||
}
|
||||
public void SetStruggle()
|
||||
{
|
||||
if (FishBehaviour != null && fishingData.FishStruggle != null)
|
||||
{
|
||||
FishBehaviour.SetSkillInt(fishingData.FishStruggle.SkillIndex);
|
||||
FishBehaviour.SetTrigger("Skill");
|
||||
}
|
||||
}
|
||||
public void StartMoveFish()
|
||||
{
|
||||
timer = 10;
|
||||
}
|
||||
//能随时修改速度的移动轨迹
|
||||
void SimulateFish(float fishSpeed, float nearDistance, float farDistance)
|
||||
{
|
||||
this.fishSpeed = fishSpeed;
|
||||
if (NotMove)
|
||||
{
|
||||
CloseBaitDoTween();
|
||||
return;
|
||||
}
|
||||
_nearDistance = nearDistance * (_fishSwimAreaZFar - _fishSwimAreaZNear) + _fishSwimAreaZNear;
|
||||
_nearDistance = Mathf.Clamp(_nearDistance, _fishSwimAreaZNear, _fishSwimAreaZFar);
|
||||
_farDistance = farDistance * (_fishSwimAreaZFar - _fishSwimAreaZNear) + _fishSwimAreaZFar;
|
||||
_farDistance = Mathf.Clamp(_farDistance, _fishSwimAreaZNear, _fishSwimAreaZFar);
|
||||
timer += Time.deltaTime;
|
||||
moveTimer += Time.deltaTime * fishSpeed;
|
||||
|
||||
if (timer > Random.Range(5f, 10f) || Vector3.Distance(_fish.transform.position, _strugglePoint) < 1)
|
||||
{
|
||||
CloseBaitDoTween();
|
||||
float escapeDistanceMag = GContext.container.Resolve<PlayerData>().GrtEscapeDistanceMag();
|
||||
if (fishingData.DashStay != null)
|
||||
{
|
||||
if (!DashMove())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isDashMove = false;
|
||||
float z = Random.Range(_nearDistance, _farDistance);
|
||||
if (fishingData.MaxZEscape > 0.001f)
|
||||
{
|
||||
z = fishingData.MaxZEscape * escapeDistanceMag;
|
||||
}
|
||||
_strugglePoint = GeneratePoint(z, _fish.transform.position.x);
|
||||
}
|
||||
timer = 0;
|
||||
moveTimer = 0;
|
||||
_strugglePoint.y = GetFishUnderwaterOffset();
|
||||
if (fishingData.MaxYEscape > 0.001f)
|
||||
{
|
||||
_strugglePoint.y = fishingData.MaxYEscape * escapeDistanceMag;
|
||||
}
|
||||
if (fishingData.MaxZEscape > 0.001f)
|
||||
{
|
||||
_strugglePoint.z = fishingData.MaxZEscape * escapeDistanceMag;
|
||||
if (_strugglePoint.z < _fishSwimAreaZFar)
|
||||
{
|
||||
_strugglePoint.z = _fishSwimAreaZFar;
|
||||
}
|
||||
if (fishingData.DashStayTime <= 0 &&
|
||||
!isJumping &&
|
||||
_fish.transform.position.z < _strugglePoint.z - 5)
|
||||
{
|
||||
_strugglePoint.x = 0;
|
||||
}
|
||||
}
|
||||
_curStartPos = _fish.transform.position;
|
||||
_curStartPos.y = GetFishUnderwaterOffset();
|
||||
distance = Vector3.Distance(_curStartPos, _strugglePoint);
|
||||
//开始转向
|
||||
FishTurn();
|
||||
|
||||
Vector3 offset = _strugglePoint - _curStartPos;
|
||||
Vector3 mid = (_strugglePoint + _curStartPos) / 2;
|
||||
float x;
|
||||
if (Math.Abs(offset.x) > Math.Abs(offset.z))
|
||||
{
|
||||
x = offset.x * Random.Range(0, 0.25f);
|
||||
mid.z += offset.x * Random.Range(-0.25f, 0.25f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//z轴比较长
|
||||
x = offset.z * Random.Range(0, 0.25f);
|
||||
mid.z += offset.z * Random.Range(-0.25f, 0.25f);
|
||||
}
|
||||
if (mid.x * x > 0)
|
||||
{
|
||||
mid.x -= x;
|
||||
}
|
||||
else
|
||||
{
|
||||
mid.x += x;
|
||||
}
|
||||
float turnTime = 0;
|
||||
Vector3 fishPos = _fish.transform.position;
|
||||
Vector3[] path = new Vector3[] { _curStartPos, mid, _strugglePoint };// GetBezierCurvePoints(_curStartPos, mid, _strugglePoint, 10);
|
||||
baitDoTween = _fish.transform.DOPath(path, fishSpeed, PathType.CatmullRom).SetSpeedBased(true)
|
||||
.OnUpdate((() =>
|
||||
{
|
||||
if (turnTime > GetTurnTime() + 0.2)
|
||||
{
|
||||
Quaternion rotation = Quaternion.LookRotation(fishPos - _fish.transform.position);
|
||||
_fish.transform.rotation = rotation;
|
||||
}
|
||||
else if (turnTime > GetTurnTime())
|
||||
{
|
||||
Quaternion rotation = Quaternion.LookRotation(fishPos - _fish.transform.position);
|
||||
_fish.transform.rotation = Quaternion.Lerp(_fish.transform.rotation, rotation, (turnTime - GetTurnTime()) * 5);
|
||||
}
|
||||
fishPos = _fish.transform.position;
|
||||
turnTime += Time.deltaTime;
|
||||
}));
|
||||
if (fishingData.DashStayTime > 0.001f)
|
||||
{
|
||||
baitDoTween.SetEase(Ease.OutCubic);
|
||||
}
|
||||
else
|
||||
{
|
||||
baitDoTween.SetEase(Ease.Linear);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void FishTurn()
|
||||
{
|
||||
FishingPanel_Advanced.Instance?.SetFishIconDir(_fish.transform.position.x > _strugglePoint.x);
|
||||
|
||||
Quaternion rotation = Quaternion.LookRotation(_fish.transform.position - _strugglePoint);
|
||||
_fish.transform.DORotateQuaternion(rotation, GetTurnTime())/*.SetEase(Ease.InOutSine);*/;
|
||||
}
|
||||
Vector3 GeneratePoint(float z, float curX)
|
||||
{
|
||||
float x1 = (_fishSwimAreaXNear - _fishSwimAreaXFar) / (_fishSwimAreaZNear - _fishSwimAreaZFar) * (z - _fishSwimAreaZFar) + _fishSwimAreaXFar;
|
||||
//float x = Random.Range(_fishSwimAreaXNear, x1);
|
||||
float min = curX - (x1 * XAxisMaxProportion * 2);
|
||||
float max = curX + (x1 * XAxisMaxProportion * 2);
|
||||
if (min < -x1)
|
||||
{
|
||||
min = -x1;
|
||||
}
|
||||
if (max > x1)
|
||||
{
|
||||
max = x1;
|
||||
}
|
||||
float x = Random.Range(min, max);
|
||||
return new Vector3(x, 0, z);
|
||||
}
|
||||
bool isDashMove;
|
||||
bool DashMove()
|
||||
{
|
||||
fx_fishing_splashloopreeling.SetActive(false);
|
||||
if (!isDashMove)
|
||||
{
|
||||
isDashMove = true;
|
||||
StartSplashloopScale();
|
||||
FishBehaviour.SetTrigger("Skill");
|
||||
}
|
||||
dashTime += Time.deltaTime;
|
||||
if (dashTime < fishingData.DashStayTime)
|
||||
{
|
||||
fishingData.SetFishSkillPerformSpeed(dashTime / fishingData.DashStayTime);
|
||||
return false;
|
||||
}
|
||||
isDashMove = false;
|
||||
EndSplashloopScale();
|
||||
if (fishingData.DashStayTime < 0)
|
||||
{
|
||||
fishingData.DashStay = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFishDash();
|
||||
}
|
||||
if (FishBehaviour)
|
||||
{
|
||||
FishBehaviour.PlaySwim01();
|
||||
}
|
||||
fishingData.FishSkillPerformSpeed = 1 / fishingData.FishSkillIncPerform;
|
||||
DOTween.To(() => fishingData.FishSkillPerformSpeed,
|
||||
x => fishingData.FishSkillPerformSpeed = x, 1, Random.Range(5f, 10f)).SetId("FishSkillPerformSpeed");
|
||||
fishingData.FishSkillPerformBack = 1;
|
||||
dashTime = 0;
|
||||
_strugglePoint = DashPoint(_fish.transform.position.x);
|
||||
GContext.Publish(new EventFishingSound(SoundType.audio_fishing_dash));
|
||||
fx_fishing_splashloopreeling.SetActive(true);
|
||||
return true;
|
||||
}
|
||||
FishDash GetFishDash()
|
||||
{
|
||||
List<int> animationTypeList = fishingData.curFishData.AnimationTypeList;
|
||||
if (animationTypeList.Count <= 1)
|
||||
{
|
||||
return _tables.TbFishDash.GetOrDefault(animationTypeList[0]);
|
||||
}
|
||||
List<FishDash> fishDashes = new List<FishDash>();
|
||||
int weight = 0;
|
||||
foreach (var item in animationTypeList)
|
||||
{
|
||||
FishDash fishDash = _tables.TbFishDash.GetOrDefault(item);
|
||||
if (fishDash != null)
|
||||
{
|
||||
fishDashes.Add(fishDash);
|
||||
weight += fishDash.Weight;
|
||||
}
|
||||
}
|
||||
if (fishDashes.Count == 1)
|
||||
{
|
||||
return fishDashes[0];
|
||||
}
|
||||
int random = Random.Range(0, weight);
|
||||
foreach (var item in fishDashes)
|
||||
{
|
||||
random -= item.Weight;
|
||||
if (random <= 0)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
}
|
||||
Debug.LogError("Not FishDash FishDataID =" + fishingData.curFishData.ID);
|
||||
return null;
|
||||
}
|
||||
|
||||
Vector3 DashPoint(float curX)
|
||||
{
|
||||
float z = Random.Range(_nearDistance, _farDistance);
|
||||
float x1 = (_fishSwimAreaXNear - _fishSwimAreaXFar) / (_nearDistance - _farDistance) * (z - _farDistance) + _fishSwimAreaXFar;
|
||||
float point = Mathf.Abs(curX) + x1;
|
||||
float nextPointNear = point * fishingData.NextPointNearDistance;
|
||||
float nextPointFar = point * fishingData.NextPointFarDistance;
|
||||
point = Random.Range(nextPointNear, nextPointFar);
|
||||
float x = curX + point;
|
||||
if (curX > 0)
|
||||
{
|
||||
x = curX - point;
|
||||
}
|
||||
return new Vector3(x, 0, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82d230667422ded42864e06eb74e4319
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
258
Assets/Scripts/GampPlay/FishingB/FishingData.cs
Normal file
258
Assets/Scripts/GampPlay/FishingB/FishingData.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
public class FishingData
|
||||
{
|
||||
public FishingBehaviorConf fishingBehaviorConf { private set; get; }
|
||||
cfg.Tables _tables;
|
||||
// 是否正在遛鱼
|
||||
public bool IsDrawing;
|
||||
// 是否正在抓鱼
|
||||
public bool IsCatchingFish;
|
||||
|
||||
// 是否抓到鱼了
|
||||
public bool IsCaughtFish;
|
||||
|
||||
// 是否弹出奖励界面
|
||||
public bool IsShowRewardPanel;
|
||||
//public bool AutomaticFishing;
|
||||
|
||||
public MapData curMapData;
|
||||
public int MapId;
|
||||
public FishData curFishData;
|
||||
public FixedFishList fixedFishList;
|
||||
public FishData swimFishData;
|
||||
public int RodId;
|
||||
public RodData fishRodData;
|
||||
public Item fishItem;
|
||||
//吃鱼相关
|
||||
public Item swimItem;
|
||||
//吃鱼序列
|
||||
public List<FishData> fishEatDataList;
|
||||
public float fishWeight { get; set; }
|
||||
public float random { get; set; }
|
||||
public int CardLevel { get; set; }
|
||||
public float EventFishDamageMag { get; set; }
|
||||
public float CardDamageMag { get; set; }
|
||||
|
||||
public float WeightIncEvent { get; set; }
|
||||
public float StrugglingPower { get; set; }//鱼的力量
|
||||
public float FishingRetryPowerReduction { get; set; } = 1;
|
||||
public float FishingRetryEscapeReduction { get; set; } = 1;
|
||||
public float FishingRetryHPReduction { get; set; } = 1;
|
||||
public float Speed { get; set; }//鱼的速度
|
||||
|
||||
public float Vigilance { get; set; }//鱼的警惕性
|
||||
public float MaxLinelength;
|
||||
public float MaxZEscape;
|
||||
public float MaxYEscape;
|
||||
public float DashStayTime;
|
||||
public FishDash DashStay;
|
||||
public FishStruggle FishStruggle;
|
||||
public FishJump FishJump;
|
||||
public float NextPointNearDistance;
|
||||
public float NextPointFarDistance;
|
||||
//等鱼上钩
|
||||
public float EnhancedWaitingTime;
|
||||
public float ExtraUnderwaterOffset;
|
||||
public bool isWeather = false;
|
||||
|
||||
public int NewItemID = 0;
|
||||
public int NewIndex = 0;
|
||||
//public float ClickFishFlapping = 1f;
|
||||
//public float BottleOpenDelay = 1.95f;
|
||||
//public float FishFlapping = 3.05f;
|
||||
//钓鱼结果
|
||||
public FishingResult fishingResult = FishingResult.Success;
|
||||
public float FishSpeed; //鱼的速度对移动速度的影响
|
||||
public List<float> StrengthToScale { get; set; }
|
||||
public float FishVigilanceToTime { get; set; }
|
||||
public float RodVigilanceToTime { get; set; }
|
||||
//目标奖励活动相关
|
||||
public Vector3 image_extra_pos { set; get; }
|
||||
public int addCollecting { set; get; }
|
||||
//目标奖励活动相关
|
||||
public Transform mainCamera;
|
||||
public Quaternion startEuler;
|
||||
|
||||
|
||||
public float startTimer;
|
||||
public float endTimer;
|
||||
|
||||
//ui吃鱼的血量比
|
||||
public float UIEatHpPercent = -1;
|
||||
|
||||
//目标奖励活动Buff相关
|
||||
public bool isMapBuff = false;
|
||||
public bool isAddTargetBuff;
|
||||
public bool isAddPiggyBank;
|
||||
public bool isAddBarginPack;
|
||||
public SupplyDropCtrl supplyDropCtrl;
|
||||
public bool IsHideRod => supplyDropCtrl != null || isAddTargetBuff || isAddPiggyBank || isAddBarginPack;
|
||||
public bool isAwaitTargetBuff;
|
||||
public bool isShowTargetPanel;
|
||||
public int jerking_count = 0;
|
||||
public int stickle_state = 0;
|
||||
|
||||
public float FishAnimSpeed = 1;
|
||||
public bool IsFree = false;
|
||||
public bool IsDuel = false;
|
||||
public bool IsRetry = false;
|
||||
public int retry_ways = 0;
|
||||
//特殊技能结算音效
|
||||
public string AudioRewardFish;
|
||||
public DateTime LastCastingTime;
|
||||
public int rodType;
|
||||
public async System.Threading.Tasks.Task Init()
|
||||
{
|
||||
fishingBehaviorConf = (FishingBehaviorConf)(await Addressables.LoadAssetAsync<object>("FishingBehaviorConf").Task);
|
||||
_tables = GContext.container.Resolve<cfg.Tables>();
|
||||
}
|
||||
public void SetRodData(RodData fishRodData)
|
||||
{
|
||||
this.fishRodData = fishRodData;
|
||||
RodId = fishRodData.ID;
|
||||
}
|
||||
public void ChangeFishData(FishData curFishData)
|
||||
{
|
||||
this.curFishData = curFishData;
|
||||
}
|
||||
|
||||
public float HoldThreshold()
|
||||
{
|
||||
if (fishRodData != null)
|
||||
{
|
||||
return fishRodData.HoldThreshold;
|
||||
}
|
||||
if (fishRodData != null)
|
||||
{
|
||||
return fishRodData.HoldThreshold;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public bool IsNewItemFish()
|
||||
{
|
||||
//return NewItemID == fishItem.ID;
|
||||
return fishItem.Quality > 5;
|
||||
}
|
||||
public bool IsEventGameFish()
|
||||
{
|
||||
return fishItem.SubType == 11 || fishItem.SubType == 12;
|
||||
}
|
||||
public bool IsGeneralFish()
|
||||
{
|
||||
return fishItem.SubType == 1;
|
||||
}
|
||||
public bool IsKeepsakeFish()
|
||||
{
|
||||
return fishItem.SubType == 4;
|
||||
}
|
||||
public bool IsPiggyBankFish()
|
||||
{
|
||||
return fishItem.SubType == 22;
|
||||
}
|
||||
public bool IsBarginPackFish()
|
||||
{
|
||||
return fishItem.SubType == 21;
|
||||
}
|
||||
public bool IsPackItemFish()
|
||||
{
|
||||
return fishItem.SubType == 21 || fishItem.SubType == 22;
|
||||
}
|
||||
public List<float> SwimmingAreaX()
|
||||
{
|
||||
return curMapData.SwimmingAreaX;
|
||||
}
|
||||
public List<float> SwimmingAreaZ()
|
||||
{
|
||||
return curMapData.SwimmingAreaZ;
|
||||
}
|
||||
public float CameraMaxAngle()
|
||||
{
|
||||
return curMapData.CameraMaxAngle;
|
||||
}
|
||||
public float FishMaxAngle()
|
||||
{
|
||||
return curMapData.FishMaxAngle;
|
||||
}
|
||||
|
||||
public bool IsEact()
|
||||
{
|
||||
return fishEatDataList.Count > 0;
|
||||
}
|
||||
|
||||
//相机相关 SetCamera
|
||||
public void SetCamera(Transform camera)
|
||||
{
|
||||
mainCamera = camera;
|
||||
camera.localEulerAngles = new Vector3(0, 0, 0);
|
||||
startEuler = camera.localRotation;
|
||||
}
|
||||
|
||||
public float GetFishingTimer()
|
||||
{
|
||||
return endTimer - startTimer;
|
||||
}
|
||||
public void StopAuto()
|
||||
{
|
||||
GContext.Publish(new StopAutoEvent() { IsDrawing = IsDrawing });
|
||||
}
|
||||
|
||||
public void InitEatHp()
|
||||
{
|
||||
UIEatHpPercent = -1;
|
||||
var fixedFishList = _tables.TbFixedFishList.GetOrDefault(GContext.container.Resolve<PlayerFishData>().GetAnglingCount() + 1);
|
||||
if (fixedFishList != null && fixedFishList.EatFishType != 0)
|
||||
{
|
||||
if (fixedFishList.EatFishType == 1)
|
||||
{
|
||||
UIEatHpPercent = fixedFishList.UIEatHpPercent;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var EatFishData = _tables.TbFishEatFish.GetOrDefault(swimFishData.EatFishID);
|
||||
UIEatHpPercent = UnityEngine.Random.Range(0, 1f);
|
||||
if (EatFishData != null && EatFishData.EatWeight > 0)
|
||||
{
|
||||
int weight = EatFishData.UIEatWeight + EatFishData.EatWeight;
|
||||
int w = UnityEngine.Random.Range(0, weight);
|
||||
if (w < EatFishData.UIEatWeight)
|
||||
{
|
||||
UIEatHpPercent = UnityEngine.Random.Range(EatFishData.UIEatHpPercent[0], EatFishData.UIEatHpPercent[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIEatHpPercent = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float FishSkillIncPerform;
|
||||
public float FishSkillDecPerform;
|
||||
public float FishSkillPerformSpeed;//鱼技能表现张力系数
|
||||
public float FishSkillPerformBack;//鱼技能表现张力系数
|
||||
public void SetFishSkillPerformSpeed(float p)
|
||||
{
|
||||
FishSkillPerformSpeed = FishSkillIncPerform + (1 - FishSkillIncPerform) * p;
|
||||
FishSkillPerformBack = FishSkillDecPerform + (1 - FishSkillDecPerform) * p;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
FishingRetryPowerReduction = 1;
|
||||
FishingRetryEscapeReduction = 1;
|
||||
FishingRetryHPReduction = 1;
|
||||
fishItem = null;
|
||||
NewItemID = 0;
|
||||
fixedFishList = null;
|
||||
IsRetry = false;
|
||||
AudioRewardFish = null;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GampPlay/FishingB/FishingData.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/FishingData.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee10b0b1e3933224db89304597960212
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
117
Assets/Scripts/GampPlay/FishingB/FishingStateMaxCombo.cs
Normal file
117
Assets/Scripts/GampPlay/FishingB/FishingStateMaxCombo.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using MoreMountains.NiceVibrations;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingStateMaxCombo : IFishingState
|
||||
{
|
||||
Vector3 scale;
|
||||
public FishingStateName fishingState { get { return FishingStateName.MaxCombo; } }
|
||||
public FishingBehaviorB fishingBehavior { get; set; }
|
||||
public float fishMoveSpeed { get; set; }
|
||||
FishingData fishingData;
|
||||
public void InState(FishingBehaviorB fishingBehavior, FishingData fishingData)
|
||||
{
|
||||
GContext.Publish(ERightState.MaxCombo);
|
||||
this.fishingData = fishingData;
|
||||
GContext.Publish(new VibrationData(HapticTypes.HeavyImpact));
|
||||
this.fishingBehavior = fishingBehavior;
|
||||
scale = Vector3.one * fishingData.curFishData.SlashFxScale;
|
||||
if (fishingBehavior.fx_fishing_splashloop != null)
|
||||
{
|
||||
fishingBehavior.fx_fishing_splashloop.transform.localScale = scale * 1.35f;
|
||||
}
|
||||
if (fishingBehavior.fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fishingBehavior.fx_fishing_splashwaveloop.transform.localScale = scale * 1.35f;
|
||||
}
|
||||
fishMoveSpeed = 0.5f;
|
||||
fishingBehavior.cameraAnimator.SetTrigger("_maxcombo");
|
||||
fishingBehavior.fishingRodAnimator.SetTrigger("_maxcombo");
|
||||
if (fishingBehavior.Far)
|
||||
{
|
||||
StatrMoveByEscape();
|
||||
}
|
||||
else
|
||||
{
|
||||
StatrMove();
|
||||
}
|
||||
}
|
||||
//逃跑回拉
|
||||
void StatrMoveByEscape()
|
||||
{
|
||||
var FishBackFarRangeParam = GContext.container.Resolve<Tables>().TbFishStatsConfig.FishBackFarRangeParam;
|
||||
//位移距离的占比 = 参数1 + 鱼的力量 * 参数2
|
||||
float distance = FishBackFarRangeParam[2] + fishingData.StrugglingPower * FishBackFarRangeParam[3];
|
||||
distance = Mathf.Clamp(distance, FishBackFarRangeParam[0], FishBackFarRangeParam[1]);
|
||||
Vector3 endPoint = fishingBehavior.GetFish.transform.position;
|
||||
if (endPoint.z > fishingData.MaxLinelength)
|
||||
{
|
||||
endPoint.z = fishingData.MaxLinelength;
|
||||
}
|
||||
endPoint.z -= distance;
|
||||
endPoint.x = 0;
|
||||
fishingBehavior.GetFish.transform.DOKill();
|
||||
Quaternion rotation = Quaternion.LookRotation(fishingBehavior.GetFish.transform.position - endPoint);
|
||||
fishingBehavior.GetFish.transform.DORotateQuaternion(rotation, fishingBehavior.GetTurnTime());
|
||||
float time = fishingData.fishRodData.ComboTime;
|
||||
fishingBehavior.GetFish.transform.DOMove(endPoint, time).SetEase(Ease.Linear);
|
||||
}
|
||||
// 像自己做曲线运动
|
||||
void StatrMove()
|
||||
{
|
||||
Vector3 controlPoint = new Vector3(0, fishingBehavior.GetFish.transform.position.y, 0);
|
||||
controlPoint.x = Mathf.Lerp(0, fishingBehavior.GetFish.transform.position.x, 1.0f / 3.0f);
|
||||
controlPoint.z = Mathf.Lerp(0, fishingBehavior.GetFish.transform.position.z, 2.0f / 3.0f);
|
||||
Vector3 endPoint = fishingBehavior.GetFish.transform.position;
|
||||
endPoint.x = 0;
|
||||
endPoint.z = fishingBehavior.RodBehaviour.TopLine.position.z + fishingData.fishingBehaviorConf.reelingToPullLength;
|
||||
fishingBehavior.GetFish.transform.DOKill();
|
||||
Quaternion rotation = Quaternion.LookRotation(fishingBehavior.GetFish.transform.position - controlPoint);
|
||||
fishingBehavior.GetFish.transform.DORotateQuaternion(rotation, fishingBehavior.GetTurnTime());
|
||||
Vector3[] path = new Vector3[] { fishingBehavior.GetFish.transform.position, controlPoint, endPoint };
|
||||
var FishBackNearRangeParam = GContext.container.Resolve<Tables>().TbFishStatsConfig.FishBackNearRangeParam;
|
||||
//位移距离的占比 = 参数1 + 鱼的力量 * 参数2
|
||||
float distance = FishBackNearRangeParam[2] + fishingData.StrugglingPower * FishBackNearRangeParam[3];
|
||||
distance = Mathf.Clamp(distance, FishBackNearRangeParam[0], FishBackNearRangeParam[1]);
|
||||
float turnTime = 0;
|
||||
Vector3 fishPos = fishingBehavior.GetFish.transform.position;
|
||||
float time = fishingData.fishRodData.ComboTime / distance;
|
||||
fishingBehavior.GetFish.transform.DOPath(path, time, PathType.CatmullRom)/*.SetDelay(GetTurnTime())*/
|
||||
.OnUpdate(
|
||||
(() =>
|
||||
{
|
||||
turnTime += Time.deltaTime;
|
||||
if (turnTime > fishingBehavior.GetTurnTime())
|
||||
{
|
||||
Quaternion rotation = Quaternion.LookRotation(fishPos - fishingBehavior.GetFish.transform.position);
|
||||
fishingBehavior.GetFish.transform.rotation = rotation;
|
||||
}
|
||||
fishPos = fishingBehavior.GetFish.transform.position;
|
||||
})).SetEase(Ease.Linear);
|
||||
}
|
||||
public void UpdateState()
|
||||
{
|
||||
|
||||
}
|
||||
public void OutState()
|
||||
{
|
||||
GContext.Publish(ERightState.Drawing);
|
||||
fishingBehavior.GetFish.transform.DOKill();
|
||||
fishingBehavior.cameraAnimator.SetTrigger("_maxcomboExit");
|
||||
//cameraAnimator.SetBool("_maxcombo", false);
|
||||
fishingBehavior.fishingRodAnimator.SetTrigger("_maxcomboExit");
|
||||
if (fishingBehavior.fx_fishing_splashloop != null)
|
||||
{
|
||||
fishingBehavior.fx_fishing_splashloop.transform.localScale = scale;
|
||||
}
|
||||
if (fishingBehavior.fx_fishing_splashwaveloop != null)
|
||||
{
|
||||
fishingBehavior.fx_fishing_splashwaveloop.transform.localScale = scale;
|
||||
}
|
||||
fishMoveSpeed = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3c4c1bf8e96e1541a364094ccb375de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/Scripts/GampPlay/FishingB/FishingStateMove.cs
Normal file
24
Assets/Scripts/GampPlay/FishingB/FishingStateMove.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingStateMove : IFishingState
|
||||
{
|
||||
public FishingStateName fishingState => FishingStateName.Move;
|
||||
|
||||
public FishingBehaviorB fishingBehavior { get; set; }
|
||||
float speed = 1;
|
||||
public float fishMoveSpeed { get => speed; set => speed = value; }
|
||||
|
||||
public void InState(FishingBehaviorB fishingBehavior, FishingData fishingData)
|
||||
{
|
||||
}
|
||||
|
||||
public void OutState()
|
||||
{
|
||||
}
|
||||
|
||||
public void UpdateState()
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GampPlay/FishingB/FishingStateMove.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/FishingStateMove.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d3cb293c1fb29744a590ab96b9cd632
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2802
Assets/Scripts/GampPlay/FishingB/FishingUpdateSys.cs
Normal file
2802
Assets/Scripts/GampPlay/FishingB/FishingUpdateSys.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/Scripts/GampPlay/FishingB/FishingUpdateSys.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/FishingUpdateSys.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce84c0eb9d20a454f8c6f702ecfc4747
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/GampPlay/FishingB/FlyingFish.meta
Normal file
8
Assets/Scripts/GampPlay/FishingB/FlyingFish.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 809e6ea11db3c994a8dac9eb2df60dd6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class FishingFlyingFish : MonoBehaviour
|
||||
{
|
||||
protected FishingBehaviorB fishingBehavior;
|
||||
protected FishingData fishingData;
|
||||
public abstract void StartFlying(FishingBehaviorB fishingBehavior, FishingData fishingData);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2e37ed40f6b14946b7154452c493fba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,137 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using DG.Tweening;
|
||||
using Game;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingFlyingWhale : FishingFlyingFish
|
||||
{
|
||||
public float enterDelayTime = 1f;
|
||||
public float rodInactiveDelay = 1.1f;
|
||||
public float rodAppearDelay = 2.83f;
|
||||
public float drawingDelay = 3f;//结束
|
||||
public float fishSpSwimmingToMapTime = 1f;
|
||||
public float spExitDelay = 4;
|
||||
public float spDamageProtectionTime = 0.2f;
|
||||
public Vector3 fishSpEatPoint = new Vector3(0, -3, 35);
|
||||
public Vector3 fishToMouthPos = new Vector3(-1.5f, 0, -0.1f);
|
||||
public Vector3 fishToMouthRot = new Vector3(0, 86, 0);
|
||||
public override void StartFlying(FishingBehaviorB fishingBehavior, FishingData fishingData)
|
||||
{
|
||||
this.fishingBehavior = fishingBehavior;
|
||||
this.fishingData = fishingData;
|
||||
FishMove();
|
||||
}
|
||||
|
||||
async void FishMove()
|
||||
{
|
||||
//转弯
|
||||
var _fish = fishingBehavior.GetFish;
|
||||
var _strugglePoint = fishSpEatPoint;
|
||||
//_strugglePoint.y = _fish.transform.position.y;
|
||||
Quaternion rotation = Quaternion.LookRotation(_fish.transform.position - _strugglePoint);
|
||||
_fish.transform.DORotateQuaternion(rotation, 0.1f);
|
||||
_fish.transform.DOMove(_strugglePoint, enterDelayTime);
|
||||
await Awaiters.Seconds(enterDelayTime);
|
||||
fishingBehavior.CameraToFish = false;
|
||||
fishingData.mainCamera.DOLocalRotateQuaternion(Quaternion.identity, 0.5f);
|
||||
fishingBehavior.FishBehaviour.transform.parent = fishingBehavior.FishComeAnimationRoot.transform;
|
||||
fishingBehavior.FishBehaviour.transform.localPosition = fishToMouthPos;
|
||||
fishingBehavior.FishBehaviour.transform.localEulerAngles = fishToMouthRot;
|
||||
FishingPanel_Advanced.Instance?.ShowState(3);
|
||||
EatFishAction();
|
||||
RodMove();
|
||||
//开始timeScale缩放
|
||||
AniEatTimeScale();
|
||||
DarknessTimeDelay();
|
||||
AniExitTime();
|
||||
await Awaiters.Seconds(drawingDelay);
|
||||
fishingBehavior.DestroySwimFish();
|
||||
fishingBehavior.RodDrawing();
|
||||
fishingBehavior.SetDrawingForce(1);
|
||||
GContext.Publish(new LoadFishListEvent() { isShow = true });
|
||||
fishingBehavior.CameraToFish = true;
|
||||
FishSwimming();
|
||||
}
|
||||
async void RodMove()
|
||||
{
|
||||
fishingBehavior.fishingRodAnimator.SetTrigger("_pulling");
|
||||
GContext.Publish(ERightState.Pulling);
|
||||
|
||||
await Awaiters.Seconds(rodInactiveDelay);
|
||||
float delay = rodAppearDelay - rodInactiveDelay;
|
||||
fishingBehavior.ChangelineStartPos();
|
||||
GContext.Publish(ERightState.Preparing);
|
||||
await Awaiters.Seconds(delay);
|
||||
fishingBehavior.IsChangelineStartPos = false;
|
||||
fishingBehavior.ShowRod(true);
|
||||
}
|
||||
async void AniEatTimeScale()
|
||||
{
|
||||
var fishingBehaviorConf = fishingData.fishingBehaviorConf;
|
||||
await Awaiters.Seconds(fishingBehaviorConf.timeEatStartScale);
|
||||
float time = fishingBehaviorConf.timeEatEndScale - fishingBehaviorConf.timeEatStartScale;
|
||||
DOTween.To(() => fishingBehaviorConf.timeEatMinScale, x => Time.timeScale = x, 1, time)
|
||||
.SetEase(fishingBehaviorConf.timeEatScaleCurve);
|
||||
await Awaiters.Seconds(fishingBehaviorConf.timeEatEndScale);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
void EatFishAction()
|
||||
{
|
||||
fishingBehavior.FishSwimBehaviour.gameObject.SetActive(false);
|
||||
fishingBehavior.fx_fishbosscome.SetActive(false);
|
||||
//await Awaiters.Seconds(eatFishActionDelay);
|
||||
//大鱼停止游弋
|
||||
fishingBehavior.fishCome.FishComeStop();
|
||||
var _strugglePoint = fishSpEatPoint;
|
||||
//_strugglePoint.y = _fish.transform.position.y;
|
||||
fishingBehavior.fishCome.transform.localPosition = _strugglePoint;
|
||||
fishingBehavior.FishSwimBehaviour.gameObject.SetActive(true);
|
||||
fishingBehavior.fishCome.animator.Play("FishBossPullingBiteSp");
|
||||
fishingBehavior.FishSwimBehaviour.PlayBite();
|
||||
fishingBehavior.cameraAnimator.Play("CameraAnimationWhaleSp");
|
||||
}
|
||||
|
||||
void FishSwimming()
|
||||
{
|
||||
var ver = new Vector3();
|
||||
ver.y = fishingBehavior.GetFishUnderwaterOffset();
|
||||
ver.z = fishingBehavior.WaitingZ();
|
||||
fishingBehavior.GetFish.transform.position = fishingBehavior.FishComeAnimationRoot.transform.position;
|
||||
var _strugglePoint = new Vector3(0, ver.y, ver.z);
|
||||
//fishingBehavior.GetBait.transform.position = ver;
|
||||
fishingBehavior.GetFish.transform.DOMove(_strugglePoint, fishSpSwimmingToMapTime).OnUpdate(
|
||||
(() =>
|
||||
{
|
||||
fishingBehavior.SetCurFishEffectPos();
|
||||
}));
|
||||
fishingBehavior.FishTurn();
|
||||
}
|
||||
void DarknessTimeDelay()
|
||||
{
|
||||
//天气压黑
|
||||
var _fishEatfish = GContext.container.Resolve<Tables>().TbFishEatFish.GetOrDefault(fishingData.swimFishData.EatFishID);
|
||||
if (_fishEatfish != null)
|
||||
{
|
||||
if (_fishEatfish.IsDarkness)
|
||||
{
|
||||
WeatherEvent weatherEvent = new WeatherEvent() { State = 1 };
|
||||
GContext.Publish(weatherEvent);
|
||||
fishingData.isWeather = true;
|
||||
if (weatherEvent.IsPlay)
|
||||
{
|
||||
GContext.Publish(new EventBGMSound("BGM_WeatherChange"));
|
||||
}
|
||||
}
|
||||
FishingPanel_Advanced.Instance?.ShowWarning(_fishEatfish.WarningAfterEat);
|
||||
}
|
||||
}
|
||||
async void AniExitTime()
|
||||
{
|
||||
await Awaiters.Seconds(spExitDelay);
|
||||
fishingBehavior.StartMoveFish();
|
||||
fishingBehavior.cameraAnimator.Play("Drawing01");
|
||||
fishingBehavior.fishCome.animator.Play("Idle01");
|
||||
GContext.Publish(new OnEatEndEvent());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a0639b793c76594e80ea693ff7d73a6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/Scripts/GampPlay/FishingB/IFishingState.cs
Normal file
22
Assets/Scripts/GampPlay/FishingB/IFishingState.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
public enum FishingStateName
|
||||
{
|
||||
Idle,
|
||||
Move,
|
||||
Jump,
|
||||
UIEating,
|
||||
SpEating,
|
||||
MaxCombo,
|
||||
Escape
|
||||
}
|
||||
public interface IFishingState
|
||||
{
|
||||
public FishingStateName fishingState { get; }
|
||||
FishingBehaviorB fishingBehavior { get; set; }
|
||||
float fishMoveSpeed { get; set; }
|
||||
void InState(FishingBehaviorB fishingBehavior, FishingData fishingData);
|
||||
void UpdateState();
|
||||
void OutState();
|
||||
}
|
||||
11
Assets/Scripts/GampPlay/FishingB/IFishingState.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/IFishingState.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9aaf29a45125e364c98a30fe2dffd8c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ParabolaHarmonicSimulation
|
||||
{
|
||||
public float allTime = 0;
|
||||
public float starTime = 0;
|
||||
public float curTime = 0;
|
||||
public Vector3 startPos = Vector3.zero;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f59617c719f201d4eb02975a4003e94f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Assets/Scripts/GampPlay/FishingB/Weather.cs
Normal file
78
Assets/Scripts/GampPlay/FishingB/Weather.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using asap.core;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UniRx;
|
||||
public class WeatherEvent
|
||||
{
|
||||
public int State;
|
||||
public bool IsPlay;
|
||||
}
|
||||
public class Weather : MonoBehaviour
|
||||
{
|
||||
public PlayableDirector director;
|
||||
IDisposable disposable;
|
||||
private void Start()
|
||||
{
|
||||
director = GetComponent<PlayableDirector>();
|
||||
if (director != null)
|
||||
{
|
||||
director.playOnAwake = false;
|
||||
director.extrapolationMode = DirectorWrapMode.Hold;
|
||||
director.Stop();
|
||||
director.initialTime = 0; // Start at the end of the timeline
|
||||
director.Evaluate();
|
||||
disposable = GContext.OnEvent<WeatherEvent>().Subscribe(OnWeatherEvent);
|
||||
}
|
||||
}
|
||||
void OnWeatherEvent(WeatherEvent e)
|
||||
{
|
||||
e.IsPlay = true;
|
||||
StopAllCoroutines();
|
||||
if (e.State == 1)
|
||||
{
|
||||
//timeline正着播
|
||||
director.initialTime = 0; // Start at the end of the timeline
|
||||
director.Evaluate();
|
||||
director.playableGraph.GetRootPlayable(0).SetSpeed(1); // Set playback speed to forward
|
||||
director.Play();
|
||||
}
|
||||
else if (e.State == 2)
|
||||
{
|
||||
if (director.time > director.duration / 3)
|
||||
{
|
||||
//director.Evaluate();
|
||||
//director.playableGraph.GetRootPlayable(0).SetSpeed(-1); // Set playback speed to reverse
|
||||
//director.Play();
|
||||
StartCoroutine(PlayBackwards());
|
||||
}
|
||||
else
|
||||
{
|
||||
director.initialTime = 0; // Start at the end of the timeline
|
||||
director.Evaluate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
director.initialTime = 0;
|
||||
}
|
||||
}
|
||||
IEnumerator PlayBackwards()
|
||||
{
|
||||
// Play the timeline backwards
|
||||
while (director.time > 0)
|
||||
{
|
||||
director.time -= Time.deltaTime;
|
||||
//director.Evaluate();
|
||||
yield return null;
|
||||
}
|
||||
director.Stop();
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
disposable?.Dispose();
|
||||
disposable = null;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/GampPlay/FishingB/Weather.cs.meta
Normal file
11
Assets/Scripts/GampPlay/FishingB/Weather.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3efec9c3a5ecb940bcae25a7e94cd9b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user