消消方块阵换皮表情
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.5 KiB

1 week ago
import { _decorator, Component, Node, Vec3 } from 'cc';
import BombSpine from './BombSpine';
import { BattleDataManager } from '../BattleDataManager';
import { Monster } from '../Monster';
const { ccclass, property } = _decorator;
@ccclass('ColaVortexAreaSchedule')
export class ColaVortexAreaSchedule 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;
// _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)//造成伤害次数
//爆炸范围内的怪物造成伤害
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);
const allBuff = monsterComp.getAllBuff()
const weaponPropertyData = BattleDataManager.getWeaponAddProperty(this._weaponid, allBuff)
monsterComp.subHP(this._weaponid, weaponPropertyData.allAtk * this._damageTimes, weaponPropertyData.isCrit, weaponPropertyData.addRateAtk)
}
if(this.curRepeatCount >= this._repeatCount){
//移除当前脚本
this.removeSelf()
this.node.getComponent(BombSpine).destoryNode()
}
}
}
resetColaVortexAreaEffe(bombPos,damageRadius,damageTimes,weaponid,damageInterval,repeatCount){
this._dt = 0
this._addBuffInterval = damageInterval
this._repeatCount = repeatCount
this._weaponid = weaponid
this._damageTimes = damageTimes
this._bombPos = bombPos
this._damageRadius = damageRadius
// this._isCrit = isCrit
// this._spineNode = spineNode
}
removeSelf() {
this.destroy()
}
onDestroy() {
// console.log('ColaVortexAreaSchedule组件已被移除');
}
}