dd
This commit is contained in:
@@ -9,6 +9,7 @@ import { ecs } from 'db://oops-framework/libs/ecs/ECS';
|
||||
import { Skill } from '../skills/Skill';
|
||||
import { MasterModelComp } from '../hero/MasterModel';
|
||||
import { HeroViewComp } from '../hero/HeroViewComp';
|
||||
import { MonModelComp } from '../hero/MonModelComp';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('FightConComp')
|
||||
@@ -45,7 +46,7 @@ export class FightConComp extends Component {
|
||||
|
||||
aoe_queues:any[]=[] // 范围伤害技能执行队列
|
||||
private aoe_timer: number = 0; // 技能执行计时器
|
||||
private readonly AOE_INTERVAL: number = 0.3; // 执行间隔,单位秒
|
||||
private readonly AOE_INTERVAL: number = 0.4; // 执行间隔,单位秒
|
||||
|
||||
aoe_pos:Vec3=new Vec3(-280,300,0)
|
||||
aoe_target_pos:Vec3=new Vec3(180,0,0)
|
||||
@@ -175,19 +176,34 @@ export class FightConComp extends Component {
|
||||
console.error("[FightConComp] 主角视图组件获取失败");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let angle=0
|
||||
let targets = this.pickRandomTarget(data.count)
|
||||
let target_pos= new Vec3(0,0,0)
|
||||
if(targets.length==0){
|
||||
target_pos=this.aoe_target_pos
|
||||
}else{
|
||||
target_pos= new Vec3(targets[0].get(HeroViewComp).node.position.x,targets[0].get(HeroViewComp).node.position.y,0)
|
||||
}
|
||||
|
||||
skill.load(
|
||||
this.aoe_target_pos,
|
||||
this.aoe_pos,
|
||||
this.node,
|
||||
data.s_uuid,
|
||||
this.aoe_target_pos,
|
||||
target_pos,
|
||||
masterView,
|
||||
angle,
|
||||
data.damage
|
||||
);
|
||||
}
|
||||
|
||||
/** 随机选择目标 */
|
||||
private pickRandomTarget(count: number=1): ecs.Entity[] {
|
||||
let entities = ecs.query(ecs.allOf(MonModelComp))
|
||||
const shuffled = [...entities].sort(() => 0.5 - Math.random());
|
||||
return shuffled.slice(0, count);
|
||||
}
|
||||
|
||||
private clearAlls() {
|
||||
this.hero_buff=getBuffNum()
|
||||
this.friend_buff=getBuffNum()
|
||||
|
||||
Reference in New Issue
Block a user