fix:调整鱼大小,解决鲨鱼bug

This commit is contained in:
bzx
2026-02-25 12:02:33 +08:00
parent 99ca869d6a
commit 534579b84e
14 changed files with 205 additions and 38 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8772ec13368d14a49bd9c0049f471f1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -64,7 +64,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 2800000, guid: c88baba1495e5c9448d16dc7ccf81deb, type: 3}
m_Texture: {fileID: 2800000, guid: aec0a772008970b41bc1356106d6c28e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:

View File

@@ -1 +1 @@
Build from CHINAMI-UKDLSK3 at 2026/2/25 11:21:15
Build from CHINAMI-UKDLSK3 at 2026/2/25 11:58:14

View File

@@ -27,8 +27,8 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 3157516016738350543}
m_Father: {fileID: 0}
@@ -46,10 +46,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
collider: {fileID: 1224008834675967378}
patrolRadius: 8
patrolSpeed: 2
attackSpeed: 8
attackInterval: 10
state: 0
attackDistance: 1.5
retreatDistance: 5
animator: {fileID: 2851859296670674972}

View File

@@ -28,8 +28,8 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.0083636865, y: 1.2380555, z: -0.15538137}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 4966174012836270495}
m_Father: {fileID: 0}
@@ -47,6 +47,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
collider: {fileID: 3896826800926328867}
state: 0
--- !u!114 &7294992014246510670
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@@ -6511,6 +6511,11 @@ MonoBehaviour:
soundPlayedCustomEvent:
willCleanUpDelegatesAfterStop: 1
frames: 189
--- !u!1 &588926464 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4632873817411938695, guid: e9fd5f881c8abe246996598c82545bec, type: 3}
m_PrefabInstance: {fileID: 240617581}
m_PrefabAsset: {fileID: 0}
--- !u!1 &600627742
GameObject:
m_ObjectHideFlags: 0
@@ -8162,8 +8167,8 @@ MonoBehaviour:
grayMaterial: {fileID: 2100000, guid: eefafe40ae00e874bab991a949828623, type: 2}
colorMaterial: {fileID: 2100000, guid: de8326ac2e7f57a41ba72f5cd865d5bb, type: 2}
materialTransitionDuration: 1
completeEffect: {fileID: 1660849837}
glowEffect: {fileID: 1735433961}
completeEffect: {fileID: 1433620590}
glowEffect: {fileID: 588926464}
completeLight: {fileID: 0}
lightIntensity: 2
fragmentAppearDelay: 0.1
@@ -14763,6 +14768,11 @@ MonoBehaviour:
m_ConnectionSyncPosition: 0
m_ConnectionSyncRotation: 0
m_Connection: {fileID: 0}
--- !u!198 &1433620590 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 5612248305845655610, guid: 92205bf74da620446bd8278d4715b45f, type: 3}
m_PrefabInstance: {fileID: 1408689045}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1437568239
GameObject:
m_ObjectHideFlags: 0
@@ -14892,14 +14902,14 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1459559881}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.26, y: 0, z: 2.18}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: -2.72, y: 0, z: 1.01}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1974582646}
m_Father: {fileID: 196331409}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1 &1465974123
GameObject:
m_ObjectHideFlags: 0
@@ -16936,14 +16946,14 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1653463848}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.46, y: 0, z: 2.13}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: -7.01, y: 0, z: 1.29}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1860279446}
m_Father: {fileID: 196331409}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1 &1657300545
GameObject:
m_ObjectHideFlags: 0
@@ -18456,7 +18466,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1860279445}
serializedVersion: 2
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.0783, y: 2.0783, z: 2.0783}
m_ConstrainProportionsScale: 0
@@ -18474,7 +18484,7 @@ Transform:
- {fileID: 1735433960}
- {fileID: 1660849836}
m_Father: {fileID: 1653463849}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1860279447
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -20207,7 +20217,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1974582645}
serializedVersion: 2
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.0783, y: 2.0783, z: 2.0783}
m_ConstrainProportionsScale: 0
@@ -20225,7 +20235,7 @@ Transform:
- {fileID: 1358637241}
- {fileID: 462494229}
m_Father: {fileID: 1459559882}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1974582647
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@@ -63,6 +63,10 @@ public class Fish : MonoBehaviour
controller = GetComponent<SplineController>();
if(controller==null)
return;
// 确保控制器已启用(从对象池取出时可能被禁用)
controller.enabled = true;
controller.Spline = spline;
if (Data.FishId == 12)
{

View File

@@ -71,6 +71,14 @@ public class FishObjectPool : MonoBehaviour
for (int i = 0; i < size; i++)
{
GameObject fish = Instantiate(prefab, transform);
// 禁用 SplineController防止在隐藏状态下运行并报错
var splineController = fish.GetComponent<FluffyUnderware.Curvy.Controllers.SplineController>();
if (splineController != null)
{
splineController.enabled = false;
}
fish.SetActive(false);
fishPools[fishType].Enqueue(fish);
}

View File

@@ -165,27 +165,36 @@ public class FishTideController : MonoBehaviour
}
/// <summary>
/// 获取随机中价值鱼数据
/// 获取鱼潮随机鱼数据 - 低价值鱼 + 除海龟外的中价值鱼
/// </summary>
FishData GetRandomMiddleValueFish()
FishData GetRandomFishTideFish()
{
List<FishData> middleFishes = new List<FishData>();
List<FishData> validFishes = new List<FishData>();
foreach (var item in GameManager.Ins.FishDataDic)
{
FishData data = item.Value;
if (FishValueHelper.GetValueLevel(data) == FishValueLevel.Middle)
FishType fishType = (FishType)data.FishId;
FishValueLevel level = FishValueHelper.GetValueLevel(data);
// 低价值鱼全部加入
if (level == FishValueLevel.Low)
{
middleFishes.Add(data);
validFishes.Add(data);
}
// 中价值鱼但排除海龟
else if (level == FishValueLevel.Middle && fishType != FishType.Turtle)
{
validFishes.Add(data);
}
}
if (middleFishes.Count > 0)
if (validFishes.Count > 0)
{
return middleFishes[Random.Range(0, middleFishes.Count)];
return validFishes[Random.Range(0, validFishes.Count)];
}
// 如果没有中价值鱼,返回任意鱼
// 如果没有符合条件的鱼,返回任意鱼
foreach (var item in GameManager.Ins.FishDataDic)
{
return item.Value;
@@ -196,8 +205,8 @@ public class FishTideController : MonoBehaviour
void SpawnOneFish()
{
// 随机获取一条中价值鱼
FishData fishData = GetRandomMiddleValueFish();
// 随机获取一条鱼(低价值鱼 + 除海龟外的中价值鱼
FishData fishData = GetRandomFishTideFish();
if (fishData == null)
{
Debug.LogError("[FishTide] 无法获取鱼数据!");

View File

@@ -40,6 +40,8 @@ public class SharkFish : Fish
{
player = GameManager.Ins.player.transform;
currentState = SharkState.Patrolling;
// 攻击间隔改为20-30秒随机
attackInterval = UnityEngine.Random.Range(20f, 30f);
attackTimer = attackInterval;
circleCenter = player.position;
showTime = 60;
@@ -48,7 +50,8 @@ public class SharkFish : Fish
IEnumerator SharkAI()
{
while (curShowTime <= showTime|| state !=FishState.Alive)
// 鲨鱼存活且显示时间未到1分钟时继续循环
while (curShowTime <= showTime && state == FishState.Alive)
{
switch (currentState)
{
@@ -112,7 +115,9 @@ public class SharkFish : Fish
if (attackTimer <= 0)
{
currentState = SharkState.Attacking;
attackTimer = attackInterval; // 重置计时器
// 重置计时器为20-30秒随机
attackInterval = UnityEngine.Random.Range(20f, 30f);
attackTimer = attackInterval;
}
}

View File

@@ -92,7 +92,7 @@ public class ShopItem : MonoBehaviour
GameInit.Ins.self.Upgrade(5);
shop.CheckGunBtn(_data.Id);
break;
case 5:
case 6:
if (GameManager.Ins.fishSpawner.GetFishCount(FishType.Shark) > 0)
{
Debug.LogError("空中已经有一条鲨鱼,请先消灭它");
@@ -101,9 +101,8 @@ public class ShopItem : MonoBehaviour
{
GameManager.Ins.fishSpawner.CreateTypeFish(FishType.Shark);
}
break;
case 6:
case 5:
if (GameManager.Ins.fishSpawner.GetFishCount(FishType.AngelHorse) > 0)
{
Debug.LogError("空中已经有一只金马,请先消灭它");

View File

@@ -549,7 +549,6 @@ public class GameManager : MonoBehaviour
if (Input.GetKeyDown(KeyCode.Space))
{
GameInit.Ins.self.AddCoin(5000);
Debug.LogError("加钱");
//GameInit.Ins.self.AddScore(10000);
//WinEndGame();
//StartFishTideEvent();

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: aec0a772008970b41bc1356106d6c28e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: