增加个人逻辑
This commit is contained in:
@@ -35,20 +35,20 @@ export class gameManager extends Component {
|
||||
|
||||
/**发射子弹的间隔*/
|
||||
@property
|
||||
public new_zd_time = 0.2;
|
||||
public new_zd_time = 0.1;
|
||||
|
||||
/**当前发射子弹的间隔*/
|
||||
public _new_zd_time = 0;
|
||||
|
||||
/**敌人生成的间隔时间 */
|
||||
@property
|
||||
public createDpTime = 2;
|
||||
public createDpTime = 3;
|
||||
|
||||
/**当前敌人生成的时间 */
|
||||
public _createDpTime = 0;
|
||||
|
||||
/**组合间隔状态 */
|
||||
public _createDpArr = dpImpl.dpArr.dps1;
|
||||
public _createDpArr = 0;
|
||||
|
||||
@property
|
||||
public dp1_speed:number = 0.05;
|
||||
@@ -58,6 +58,8 @@ export class gameManager extends Component {
|
||||
|
||||
private _isTouch:boolean = false;
|
||||
|
||||
private lasttype:number = 0;
|
||||
|
||||
start() {
|
||||
this._new_zd_time = this.new_zd_time;
|
||||
this.changeDpMode();
|
||||
@@ -71,21 +73,37 @@ export class gameManager extends Component {
|
||||
this._new_zd_time = 0;
|
||||
}
|
||||
|
||||
if(this._createDpArr === dpImpl.dpArr.dps1){
|
||||
this._createDpTime += deltaTime;
|
||||
if(this._createDpArr <= 2){
|
||||
|
||||
this._createDpTime += deltaTime;
|
||||
if(this._createDpTime > this.createDpTime){
|
||||
this.cerateDp();
|
||||
this.cerateDp(0);
|
||||
this._createDpTime = 0;
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if(this._createDpTime > this.createDpTime * 0.8){
|
||||
let rm = math.randomRangeInt(1,3);
|
||||
|
||||
if(rm == 2 && this.lasttype == 0){
|
||||
this.cerateDpArr(this._createDpArr > 2 && this._createDpArr <= 6 ? 1:2);
|
||||
this.lasttype=1;
|
||||
}
|
||||
else{
|
||||
this.cerateDp(this._createDpArr > 2 && this._createDpArr <= 6 ? 1:2);
|
||||
this.lasttype=0;
|
||||
}
|
||||
|
||||
this._createDpTime = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public cerateDp() {
|
||||
|
||||
public cerateDp(n:number) {
|
||||
|
||||
let randm = math.randomRangeInt(1,3);
|
||||
let p:Prefab = null;
|
||||
@@ -103,12 +121,26 @@ export class gameManager extends Component {
|
||||
const dp = instantiate(p);
|
||||
dp.setParent(this.node);
|
||||
const dpc = dp.getComponent(dpComponent);
|
||||
dpc._init(speed);
|
||||
dpc._init(speed,n,0);
|
||||
let loc = math.randomRange(-3.8,3.8);
|
||||
dp.setPosition(loc, 1, -dpc.dp_max);
|
||||
|
||||
}
|
||||
|
||||
public cerateDpArr(n:number) {
|
||||
|
||||
let parr = new Array<Node>(5);
|
||||
for (let i = 0; i < parr.length; i++) {
|
||||
let randm = math.randomRangeInt(1,3);
|
||||
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);
|
||||
parr[i].setPosition(i*1.8-3.6, 1, -dpc.dp_max);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public createZd(){
|
||||
const zd01 = instantiate(this.zd1);
|
||||
zd01.setParent(this.zdOut);
|
||||
|
||||
Reference in New Issue
Block a user