You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.4 KiB
69 lines
2.4 KiB
import { _decorator, Component, Node, Vec3 } from 'cc';
|
|
import BombSpine from './BombSpine';
|
|
import { Monster } from '../Monster';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('MagmaBurnSchedule')
|
|
export class MagmaBurnSchedule extends Component {
|
|
_dt:number = 0;
|
|
_weaponid:number = 0;
|
|
_damageTimes:number = 0;
|
|
_addBuffInterval:number = 1;
|
|
_repeatCount:number = 1;
|
|
// _allDamage:number = 0;
|
|
_bombPos:Vec3 = null;
|
|
_damageRadius:number = 0;
|
|
_buffInterval:number = 0;
|
|
_buffTotalTime:number = 0;
|
|
// _isCrit:boolean = false;
|
|
// _spineNode:Node = null;
|
|
curRepeatCount:number = 0;
|
|
|
|
start() {
|
|
|
|
}
|
|
|
|
update(deltaTime: number) {
|
|
if (!gg.game.CurentBattle.canUpdateFrame()) return;
|
|
this._dt += deltaTime * gg.game.CurentBattle.TimeScale;
|
|
if(this._dt >= this._addBuffInterval){
|
|
this._dt = 0
|
|
this.curRepeatCount++
|
|
|
|
let damageCount = Math.ceil(this._buffTotalTime / this._buffInterval)//造成伤害次数
|
|
//爆炸范围内的怪物重置燃烧buff
|
|
const bombMonsters = gg.game.CurentBattle.MonsterSpawner.getMonstersInArea(this.node.worldPosition, this._damageRadius);
|
|
for (let i = 0; i < bombMonsters.length; i++) {
|
|
const monster = bombMonsters[i];
|
|
const monsterComp = monster.getComponent(Monster);
|
|
monsterComp.resetBurnBuff(this._weaponid, this._damageTimes, damageCount, this._buffInterval)
|
|
}
|
|
if(this.curRepeatCount >= this._repeatCount){
|
|
this.node.getComponent(BombSpine).destoryNode()
|
|
//移除当前脚本
|
|
this.removeSelf()
|
|
}
|
|
}
|
|
}
|
|
resetMagmaEffe(bombPos,damageRadius,damageTimes,weaponid,buffInterval,buffTotalTime,addBuffInterval,repeatCount){
|
|
this._dt = 0
|
|
this._addBuffInterval = addBuffInterval
|
|
this._repeatCount = repeatCount
|
|
this._weaponid = weaponid
|
|
this._damageTimes = damageTimes
|
|
this._bombPos = bombPos
|
|
this._damageRadius = damageRadius
|
|
this._buffInterval = buffInterval
|
|
this._buffTotalTime = buffTotalTime
|
|
// this._isCrit = isCrit
|
|
// this._spineNode = spineNode
|
|
}
|
|
removeSelf() {
|
|
this.destroy()
|
|
}
|
|
onDestroy() {
|
|
// console.log('MagmaBurnSchedule组件已被移除');
|
|
}
|
|
}
|
|
|
|
|
|
|