优化敌人动态逻辑

This commit is contained in:
admin
2023-04-28 14:54:01 +08:00
parent 5eecee380e
commit 3bfd42904c
2 changed files with 14 additions and 6 deletions

View File

@@ -72,7 +72,7 @@ export class gameManager extends Component {
this.createZd();
this._new_zd_time = 0;
}
this._createDpTime += deltaTime;
if(this._createDpArr <= 2){
@@ -111,11 +111,11 @@ export class gameManager extends Component {
let t = 1;
if(randm === dpImpl.dpType.TYPE1){
p = this.dp1;
speed = this.dp1_speed;
speed = this.dp1_speed+(math.randomRange(0.01,0.02)*(math.randomRangeInt(-1,2)));
t=1;
}else{
p = this.dp2;
speed = this.dp2_speed;
speed = this.dp2_speed+(math.randomRange(0.01,0.02)*(math.randomRangeInt(-1,2)));
t=2;
}
const dp = instantiate(p);
@@ -135,7 +135,7 @@ export class gameManager extends Component {
parr[i] = instantiate(randm==1?this.dp1:this.dp2);
parr[i].setParent(this.node);
const dpc = parr[i].getComponent(dpComponent);
dpc._init(randm==1?this.dp1_speed:this.dp2_speed,n,1);
dpc._init(randm==1?this.dp1_speed+(math.randomRange(0.01,0.02)*(math.randomRangeInt(-1,2))):this.dp2_speed+(math.randomRange(0.01,0.02)*(math.randomRangeInt(-1,2))),n,1);
parr[i].setPosition(i*1.8-3.6, 1, -dpc.dp_max);
}