// 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 import MapConroler from "../Map"; const { ccclass, property } = cc._decorator; @ccclass export default class Key extends cc.Component { static _instance: any; time: number = 60; // mapInfo: number[][] = []; onLoad() { } start() { } init(time) { if (time) this.time = time; this.node.getChildByName("time").active = true; this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString(); this.schedule(this.updateTime, 1); } updateTime() { this.time--; this.node.getChildByName("time").getComponent(cc.Label).string = this.time.toString(); cc.fx.GameTool.numberScaleAction(this.node.getChildByName("time")); if (this.time <= 0) { this.unschedule(this.updateTime); this.node.destroy(); MapConroler._instance.failLevel(); // this.node.destroy(); } } // update (dt) {} }