Commit 04e46b95 authored by Tt's avatar Tt

perf(play): 优化鱼的生成间隔和位置逻辑

parent 45810069
...@@ -968,7 +968,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -968,7 +968,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.clearFishes(); this.clearFishes();
// 修改鱼的生成逻辑,使用当前阶段的随机问题列表 // 修改鱼的生成逻辑,使用当前阶段的随机问题列表
this.m_fishInterval = 3000; // 设置鱼的生成间隔为3秒
const type = currentQuestion.questionRandomList.length > 3 ? 'small' : 'big';
this.m_fishInterval = type === 'big' ? 4700 : 3500;
this.m_lastFishTime = 0; // 重置上次生成鱼的时间,使下一帧立即生成鱼 this.m_lastFishTime = 0; // 重置上次生成鱼的时间,使下一帧立即生成鱼
// 每一个stage开始的时候播放一次正确问题的音频 // 每一个stage开始的时候播放一次正确问题的音频
...@@ -2818,7 +2820,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2818,7 +2820,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 设置鱼的初始位置在屏幕右侧外部 // 设置鱼的初始位置在屏幕右侧外部
fish.ref.x = this.g_canvasWidth + fish.ref.width * fish.ref.scaleX / 2; fish.ref.x = this.g_canvasWidth + fish.ref.width * fish.ref.scaleX / 2;
fish.ref.y = Math.random() * (this.g_canvasHeight * 0.35) + this.g_canvasHeight * 0.25; // 在屏幕中间区域随机高度 fish.ref.y = this.currentFishIndex % 2 == 0 ? 400 : 300; // Math.random() * (this.g_canvasHeight * 0.35) + this.g_canvasHeight * 0.25; // 在屏幕中间区域随机高度
// 设置鱼的游动速度 // 设置鱼的游动速度
fish.speed = 0.45; fish.speed = 0.45;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment