aoe ++
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { _decorator, Component, Node, Vec3 } from 'cc';
|
||||
import { oops } from 'db://oops-framework/core/Oops';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
import { geDebuffNum, getBuffNum, BuffAttr, DebuffAttr } from '../common/config/SkillSet';
|
||||
import { Timer } from 'db://oops-framework/core/common/timer/Timer';
|
||||
import { FightSet } from '../common/config/Mission';
|
||||
import { SuperCards, SuperCardsType } from '../common/config/CardSet';
|
||||
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
|
||||
import { Skill } from '../skills/Skill';
|
||||
import { MasterModelComp } from '../hero/MasterModel';
|
||||
import { HeroViewComp } from '../hero/HeroViewComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('FightConComp')
|
||||
@@ -38,6 +42,16 @@ export class FightConComp extends Component {
|
||||
card_atk_add:number=0 //卡牌特效 攻击提高攻击力效果 额外添加值
|
||||
card_hp_add:number=0 //卡牌特效 攻击提高生命值效果 额外添加值
|
||||
|
||||
|
||||
aoe_queues:any[]=[] // 范围伤害技能执行队列
|
||||
private aoe_timer: number = 0; // 技能执行计时器
|
||||
private readonly AOE_INTERVAL: number = 0.3; // 执行间隔,单位秒
|
||||
|
||||
aoe_pos:Vec3=new Vec3(-280,300,0)
|
||||
aoe_target_pos:Vec3=new Vec3(180,0,0)
|
||||
buff_pos:Vec3=new Vec3(-280,100,0)
|
||||
debuff_pos:Vec3=new Vec3(-280,100,0)
|
||||
|
||||
onLoad(){
|
||||
// console.log("fight con start")
|
||||
oops.message.on(GameEvent.EquipChange,this.equip_change,this)
|
||||
@@ -133,7 +147,10 @@ export class FightConComp extends Component {
|
||||
}
|
||||
break
|
||||
case SuperCardsType.AOE:
|
||||
|
||||
this.aoe_queues.push({
|
||||
s_uuid:SuperCards[data.uuid].value1,
|
||||
count:SuperCards[data.uuid].value2,
|
||||
damage:SuperCards[data.uuid].value3})
|
||||
break
|
||||
case SuperCardsType.BUFF:
|
||||
|
||||
@@ -143,6 +160,33 @@ export class FightConComp extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
private aoe_skill_execute(data:any){
|
||||
let skill=ecs.getEntity<Skill>(Skill)
|
||||
let master = ecs.query(ecs.allOf(MasterModelComp))
|
||||
|
||||
// 检查必要参数
|
||||
if (!master || master.length === 0) {
|
||||
console.error("[FightConComp] 未找到主角实体");
|
||||
return;
|
||||
}
|
||||
|
||||
let masterView = master[0].get(HeroViewComp);
|
||||
if (!masterView) {
|
||||
console.error("[FightConComp] 主角视图组件获取失败");
|
||||
return;
|
||||
}
|
||||
|
||||
let angle=0
|
||||
skill.load(
|
||||
this.aoe_target_pos,
|
||||
this.node,
|
||||
data.s_uuid,
|
||||
this.aoe_target_pos,
|
||||
masterView,
|
||||
angle,
|
||||
data.damage
|
||||
);
|
||||
}
|
||||
|
||||
private clearAlls() {
|
||||
this.hero_buff=getBuffNum()
|
||||
@@ -168,10 +212,24 @@ export class FightConComp extends Component {
|
||||
this.atk_add_master_hp=0
|
||||
this.card_atk_add=0
|
||||
this.card_hp_add=0
|
||||
this.aoe_queues = [] // 清空技能队列
|
||||
this.aoe_timer = 0 // 重置计时器
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
// 更新技能执行计时器
|
||||
if (this.aoe_queues.length > 0) {
|
||||
this.aoe_timer += deltaTime;
|
||||
if (this.aoe_timer >= this.AOE_INTERVAL) {
|
||||
this.aoe_timer = 0;
|
||||
let skill = this.aoe_queues[0];
|
||||
this.aoe_skill_execute(skill);
|
||||
skill.count--;
|
||||
if (skill.count <= 0) {
|
||||
this.aoe_queues.shift(); // 移除已完成的技能
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user