制作了多个 近战技能

This commit is contained in:
2025-11-04 17:25:48 +08:00
parent 53cf25d7a5
commit afbaa13cb2
28 changed files with 2625 additions and 126 deletions

View File

@@ -1,6 +1,6 @@
import { instantiate, Node, Prefab, v3, Vec3 } from "cc";
import { BoxCollider2D, instantiate, Node, Prefab, v3, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { SkillSet } from "../common/config/SkillSet";
import { EType, SkillSet } from "../common/config/SkillSet";
import { oops } from "db://oops-framework/core/Oops";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
@@ -50,23 +50,30 @@ export class Skill extends ecs.Entity {
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!.getChildByName("SKILL")!;
// 设置节点属性
node.setPosition(startPos);
if(caster.node.scale.x < 0){
node.setScale(v3(node.scale.x*-1,node.scale.y,1))
}
let face=caster.node.scale.x < 0 ? -1 : 1
node.setScale(v3(node.scale.x*face,node.scale.y,1))
// 初始视图
const SView = node.getComponent(SkillView);
if(config.EType!=EType.collision){
const collider=node.getComponent(BoxCollider2D);
if(collider){
collider.enabled=false
}
}
// 只设置必要的运行时属性,配置信息通过 SkillSet[uuid] 访问
// 核心标识
SView.s_uuid= s_uuid
SView.group= caster.box_group
this.add(SView);
startPos.x=startPos.x+SView.atk_x
startPos.x=startPos.x+SView.atk_x*face
startPos.y=startPos.y+SView.atk_y
node.setPosition(startPos);
// 初始化移动组件 - 从SkillView获取移动参数
const sMoveCom = this.get(SMoveDataComp);
sMoveCom.startPos.set(startPos);
sMoveCom.targetPos.set(targetPos);