import { _decorator, Component, Node } from 'cc'; import { ChapterNewPlayTypeEnum } from '../../../game/ChapterPlayTypes'; import { SdfHoleController } from './SdfHoleController'; import { GEvent } from 'db://assets/mx/module/event/GEvent'; import { ObstacleType } from '../MapObstacle'; import { chuifengjiSchedule } from './chuifengjiSchedule'; const { ccclass, property } = _decorator; /* //需要shader 1、每过两波,浓雾会向下蔓延一段,最终蔓延到离玩家2-3格区域 2、浓雾覆盖区域,怪物看不见,可被击中 3、可摆放吹风机障碍物,吹散障碍物为中心的一片圆形区域一定时间,冷却一段时间再释放 4、美女以及下方默认驱散自身周围一片区域 5、浓雾不会覆盖编辑状态下的可编辑提示,以及怪物行进路线 */ // //新机制大雾 // export class IFogAndWindProperty { // //时间间隔 // limitNum: number = 0 //限制次数 // timeInterval: number = 0 //时间间隔 // //大雾下降的距离 // fogDownDistance: number = 0 // } @ccclass('newMechanismFog') export class newMechanismFog extends Component { @property(Node) fogNode: Node = null limitNum: number=0; timeInterval: number=0; fogDownDistance: number=0; limitNumFix: number=0; statrTime = 0 fixedPoints: Node[] = [] fogController: SdfHoleController = null isCanMove: boolean = true fixPosi = 1000 fixPosi2 = 800 fixPosi3 = 200 onEnable(){ GEvent.Ins.on(GEvent.ChuifengjiEvent, this.moveToOriginalPosition, this) } onDisable(){ GEvent.Ins.off(GEvent.ChuifengjiEvent, this.moveToOriginalPosition, this) } moveToOriginalPosition(isCanMove: boolean){ this.isCanMove = false if(!isCanMove){ this.stratWuqiAnim(this.fixPosi) this.node.getChildByName('风扇').active = true this.scheduleOnce(() => { this.node.getChildByName('风扇').active = false }, 3) }else{ this.node.getChildByName('风扇').active = false } } // setPoints(node: Node[]){ // this.fixedPoints.push(...node) // } start() { this.fogController = this.fogNode.getComponent(SdfHoleController); let children = gg.game.CurentBattle.Map.mapTargetParent.children for(let child of children){ //创建effectNode let meinv = child.getChildByName('美女') if(meinv){ this.fixedPoints.push(meinv) }else{ let obsSpr = child.getChildByName('obsSpr') if(obsSpr){ this.fixedPoints.push(obsSpr) } } } let IFogAndWindPropertyData = gg.data.project.getChapterNewPlayInfo(ChapterNewPlayTypeEnum.FogAndWind) // console.log('IFogAndWindPropertyData',IFogAndWindPropertyData) this.limitNum = 0 this.limitNumFix = IFogAndWindPropertyData.limitNum this.timeInterval = IFogAndWindPropertyData.timeInterval this.fogDownDistance = IFogAndWindPropertyData.fogDownDistance this.stratWuqiAnim() this.schedule(this.updateTemperature, 1) } updateTemperature(dt: number) { //检测是不是可以移动 if (!gg.game.CurentBattle.canUpdateFrame()) return; //检测有没有障碍物 // let arr = gg.game.CurentBattle.getObstaclesByType(ObstacleType.吹风机) // if(arr.length>0 && !this.isCanMove){ // let isCanMove = true // for(let item of arr){ // if(item.ObstacleNode){ // let chuifengji = item.ObstacleNode // if(chuifengji && chuifengji.getComponent(chuifengjiSchedule)){ // isCanMove = chuifengji.getComponent(chuifengjiSchedule).getIsCanMove() // if(!isCanMove){ // isCanMove = false // break // } // } // } // } // if(!isCanMove){ // this.isCanMove = false // }else{ // if(this.limitNum=this.timeInterval && this.limitNum