import GameM, { Game_Quality } from "../manager/GameM"; /** 船上下浮动 */ const { ccclass, property } = cc._decorator; @ccclass export default class BoatWave extends cc.Component { @property(cc.Node) bowen: cc.Node = null @property(cc.Integer) startY = 0 @property(cc.Integer) toY = 0 private boatTween = null onEnable() { if (this.bowen) { this.bowen.active = true } if (GameM.commonData.quality <= Game_Quality.medium) { return } this.boatTween = cc.tween(this.node) .to(1, { y: this.startY }) .to(1, { y: this.toY }) .union() .repeatForever() .start() } onDisable() { if (this.boatTween) { this.boatTween.stop() this.boatTween = null } if (this.bowen) { this.bowen.active = false } } }