// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html const {ccclass, property} = cc._decorator; @ccclass export default class NewClass extends cc.Component { // LIFE-CYCLE CALLBACKS: horizontal:number; //横向 vertical:number; //纵向 passTime:number; nowPos:cc.Vec2; onLoad () { } start () { this.initMap(); } initMap(){ this.setMapInfo(); } //根据关卡设置地图大小 setMapInfo(){ switch(cc.fx.GameConfig.custom){ case 0: this.vertical = 4; this.horizontal = 4; this.passTime = 0.3; break; case 1: this.vertical = 5; this.horizontal = 5; this.passTime = 0.25; break; case 2: this.vertical = 5; this.horizontal = 5; this.passTime = 0.2; break; case 3: this.vertical = 5; this.horizontal = 5; this.passTime = 0.18; break; case 4: this.vertical = 6; this.horizontal = 6; this.passTime = 0.16; break; case 5: this.vertical = 6; this.horizontal = 7; this.passTime = 0.14; break; case 6: this.vertical = 6; this.horizontal = 8; this.passTime = 0.12; break; case 7: this.vertical = 6; this.horizontal = 9; this.passTime = 0.1; break; } } // update (dt) {} }