继续新技能系统

This commit is contained in:
2025-10-15 08:01:11 +08:00
parent 070346fbe4
commit 2e2c9d82f9
10 changed files with 186 additions and 345 deletions

View File

@@ -1,7 +1,7 @@
[ [
{ {
"__type__": "cc.Prefab", "__type__": "cc.Prefab",
"_name": "atk_fire", "_name": "atk_fires",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_native": "", "_native": "",
@@ -13,32 +13,26 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "atk_fire", "_name": "atk_fires",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": null, "_parent": null,
"_children": [ "_children": [
{ {
"__id__": 2 "__id__": 2
},
{
"__id__": 11
},
{
"__id__": 19
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 28 "__id__": 16
}, },
{ {
"__id__": 30 "__id__": 18
} }
], ],
"_prefab": { "_prefab": {
"__id__": 32 "__id__": 20
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -86,7 +80,7 @@
"__id__": 2 "__id__": 2
}, },
"asset": { "asset": {
"__uuid__": "dc4cc0a7-a040-4e87-9f75-0f20e3e25db9", "__uuid__": "43a67d73-b426-4f20-9a1f-1aaae1c82bd0",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"fileId": "cfqCWnxbFLNoQMedQXsav3", "fileId": "cfqCWnxbFLNoQMedQXsav3",
@@ -97,7 +91,7 @@
}, },
{ {
"__type__": "cc.PrefabInstance", "__type__": "cc.PrefabInstance",
"fileId": "52XpOnmEdOq4GXBa8gYxcr", "fileId": "51heDVa6dNC5JOz0aq5R7A",
"prefabRootNode": { "prefabRootNode": {
"__id__": 1 "__id__": 1
}, },
@@ -118,128 +112,18 @@
}, },
{ {
"__id__": 10 "__id__": 10
} },
], {
"removedComponents": [] "__id__": 12
}, },
{ {
"__type__": "CCPropertyOverrideInfo", "__id__": 13
"targetInfo": { },
"__id__": 6
},
"propertyPath": [
"_name"
],
"value": "boom"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"cfqCWnxbFLNoQMedQXsav3"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 6.112,
"y": 45.573,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_active"
],
"value": false
},
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_prefab": {
"__id__": 12
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 11
},
"asset": {
"__uuid__": "43a67d73-b426-4f20-9a1f-1aaae1c82bd0",
"__expectedType__": "cc.Prefab"
},
"fileId": "cfqCWnxbFLNoQMedQXsav3",
"instance": {
"__id__": 13
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "51heDVa6dNC5JOz0aq5R7A",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{ {
"__id__": 14 "__id__": 14
}, },
{ {
"__id__": 16 "__id__": 15
},
{
"__id__": 17
},
{
"__id__": 18
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -247,7 +131,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 15 "__id__": 6
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -263,7 +147,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 15 "__id__": 6
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -278,7 +162,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 15 "__id__": 6
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -294,7 +178,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 15 "__id__": 6
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -306,110 +190,32 @@
"z": 0 "z": 0
} }
}, },
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_prefab": {
"__id__": 20
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 19
},
"asset": {
"__uuid__": "26ff5f8c-e160-4977-bf1b-0b6153052bef",
"__expectedType__": "cc.Prefab"
},
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": {
"__id__": 21
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "76H0s8dtJM9pTFpU3wvET0",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [],
"propertyOverrides": [
{
"__id__": 22
},
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
},
{
"__id__": 27
}
],
"removedComponents": []
},
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 23 "__id__": 11
}, },
"propertyPath": [ "propertyPath": [
"_name" "_lrot"
], ],
"value": "atk" "value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": -0.7071067811865475,
"w": 0.7071067811865476
}
}, },
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",
"localID": [ "localID": [
"c46/YsCPVOJYA4mWEpNYRx" "feOW1uSctLKYCw3esMiuox"
] ]
}, },
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 23 "__id__": 11
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 23
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 23
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -418,19 +224,49 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0 "z": -90
} }
}, },
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 23 "__id__": 11
},
"propertyPath": [
"_lscale"
],
"value": {
"__type__": "cc.Vec3",
"x": 0.8,
"y": 1.2,
"z": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
], ],
"value": false "value": false
}, },
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 6
},
"propertyPath": [
"_lscale"
],
"value": {
"__type__": "cc.Vec3",
"x": 2,
"y": 2,
"z": 1
}
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -441,7 +277,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 29 "__id__": 17
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -469,10 +305,15 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 31 "__id__": 19
}, },
"hasReady": true, "atkPrefab": {
"ReadyTime": 0, "__uuid__": "26ff5f8c-e160-4977-bf1b-0b6153052bef",
"__expectedType__": "cc.Prefab"
},
"runType": 0,
"hasReady": false,
"ReadyTime": 0.5,
"postion_y": 0, "postion_y": 0,
"_id": "" "_id": ""
}, },
@@ -492,12 +333,6 @@
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{
"__id__": 19
},
{
"__id__": 11
},
{ {
"__id__": 2 "__id__": 2
} }

View File

@@ -8,6 +8,6 @@
], ],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {
"syncNodeName": "atk_fire" "syncNodeName": "atk_fires"
} }
} }

View File

@@ -130,8 +130,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 127, "width": 77,
"height": 127 "height": 77
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -166,7 +166,10 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": null, "_spriteFrame": {
"__uuid__": "56a24460-ef67-4aa0-a3f7-fad4007046dc@3e926",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 1, "_sizeMode": 1,
@@ -179,7 +182,10 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": {
"__uuid__": "56a24460-ef67-4aa0-a3f7-fad4007046dc",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": "" "_id": ""
}, },
{ {

View File

@@ -328,9 +328,9 @@ export const SkillSet: Record<number, SkillConfig> = {
buffs:[],debuffs:[],info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害" buffs:[],debuffs:[],info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害"
}, },
6005: { 6005: {
uuid:6005,name:"火球术",for_hero:true,sp_name:"atk_fire",AtkedType:AtkedType.fire,path:"3039",quality:QualitySet.BLUE,TType:TType.Frontline, uuid:6005,name:"火球术",for_hero:true,sp_name:"atk_fires",AtkedType:AtkedType.fire,path:"3039",quality:QualitySet.BLUE,TType:TType.Frontline,
TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,CdType:CdType.cd,AType:AType.linear,EType:EType.collision, TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,CdType:CdType.cd,AType:AType.linear,EType:EType.collision,
ap:100,cd:5,in:0,hit_num:1,hit:2,hited:0.3,speed:720,cost:10,fname:"max",flash:false,with:90,maxC:1, ap:100,cd:5,in:1,hit_num:1,hit:2,hited:0.3,speed:720,cost:10,fname:"max",flash:false,with:90,maxC:1,
buffs:[],debuffs:[{debuff:DebuffAttr.STUN,dev:0,deC:1,deR:50}],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧" buffs:[],debuffs:[{debuff:DebuffAttr.STUN,dev:0,deC:1,deR:50}],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧"
}, },
6006: { 6006: {
@@ -442,9 +442,9 @@ export const SkillSet: Record<number, SkillConfig> = {
// debuff:0,deV:0,deC:0,deR:100,in:0.8,ap:70,cd:60,in:0,hit_num:1,hit:1,hited:1,speed:720,hero:5221,cost:10,info:"召唤一个骷髅战士为我方而战"}, // debuff:0,deV:0,deC:0,deR:100,in:0.8,ap:70,cd:60,in:0,hit_num:1,hit:1,hited:1,speed:720,hero:5221,cost:10,info:"召唤一个骷髅战士为我方而战"},
// ========== 超必杀 ========== 6200-6299 // ========== 超必杀 ========== 6200-6299
6201: { 6201: {
uuid:6201,name:"陨石风暴",for_hero:true,sp_name:"fireys",AtkedType:AtkedType.atked,path:"3101",quality:QualitySet.ORANGE,TType:TType.Frontline, uuid:6201,name:"满天火雨",for_hero:true,sp_name:"atk_fires",AtkedType:AtkedType.atked,path:"3101",quality:QualitySet.ORANGE,TType:TType.Frontline,
TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd, TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,
ap:500,cd:5,in:0,hit_num:1,hit:1,hited:0.3,speed:720,cost:10,fname:"max",flash:false,with:90,maxC:5, ap:100,cd:5,in:2,hit_num:1,hit:5,hited:0.3,speed:720,cost:10,fname:"max",flash:false,with:90,maxC:5,
buffs:[],debuffs:[],info:"在最前方敌人位置,召唤陨石攻击敌人,造成500%攻击的伤害" buffs:[],debuffs:[],info:"在最前方敌人位置,召唤陨石攻击敌人,造成500%攻击的伤害"
}, },

View File

@@ -191,7 +191,7 @@ export const HeroInfo = {
buff:[],info:"普通怪物-战士型"}, buff:[],info:"普通怪物-战士型"},
5225:{uuid:5225,name:"精英独眼",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1, 5225:{uuid:5225,name:"精英独眼",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1,
type:HType.warrior,hp:45,mp:100,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6006], type:HType.warrior,hp:45,mp:100,def:5,ap:12,dis:300,cd:2,speed:100,skills:[6005],
buff:[],info:"精英怪物-战士型"}, buff:[],info:"精英怪物-战士型"},
5226:{uuid:5226,name:"精英牛头",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1, 5226:{uuid:5226,name:"精英牛头",path:"mo1", fac:FacSet.MON, quality:QualitySet.BLUE,lv:1,kind:1,

View File

@@ -12,7 +12,7 @@ import { MonModelComp } from './MonModelComp';
import { HeroModelComp } from './HeroModelComp'; import { HeroModelComp } from './HeroModelComp';
import { FightSet } from '../common/config/Mission'; import { FightSet } from '../common/config/Mission';
import { Timer } from 'db://oops-framework/core/common/timer/Timer'; import { Timer } from 'db://oops-framework/core/common/timer/Timer';
import { SkillCon } from '../skill/SkillCon'; import { SkillEnt } from '../skill/SkillEnt';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('SkillCon') @ccclass('SkillCon')
@@ -104,7 +104,7 @@ export class SkillConComp extends CCComp {
} }
this.HeroView.playSkillEffect(config.uuid) this.HeroView.playSkillEffect(config.uuid)
const skillEntity = ecs.getEntity<SkillCon>(SkillCon); const sEnt = ecs.getEntity<SkillEnt>(SkillEnt);
const timerId = setTimeout(() => { const timerId = setTimeout(() => {
@@ -112,17 +112,16 @@ export class SkillConComp extends CCComp {
if (!this.node || !this.node.isValid || !this.HeroView || !this.HeroView.node || !this.HeroView.node.isValid) { if (!this.node || !this.node.isValid || !this.HeroView || !this.HeroView.node || !this.HeroView.node.isValid) {
return; return;
} }
if(config.uuid==6001){ if(config.uuid==6021){
console.log("[SkillConComp] 技能起始坐标:",this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale,this.HeroView.node.position.y + BoxSet.ATK_Y,0) console.log("[SkillConComp] 技能起始坐标:",this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale,this.HeroView.node.position.y + BoxSet.ATK_Y,0)
} }
skillEntity.load( sEnt.load(
new Vec3(this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale, new Vec3(this.HeroView.node.position.x + BoxSet.ATK_X * this.HeroView.scale,
this.HeroView.node.position.y + BoxSet.ATK_Y, 0), this.HeroView.node.position.y + BoxSet.ATK_Y, 0),
this.node.parent, this.node.parent,
config.uuid, config.uuid,
new Vec3(target.x, target.y+BoxSet.ATK_Y, 0), [new Vec3(target.x, target.y+BoxSet.ATK_Y, 0)],
this.HeroView, this.HeroView,
0,
dmg dmg
); );
}, 300); }, 300);

View File

@@ -67,62 +67,15 @@ export class AtkConCom extends CCComp {
this.initializeSkillConfig(); this.initializeSkillConfig();
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this); // this.on(ModuleEvent.Cmd, this.onHandler, this);
this.node.setPosition(this.startPos.x,this.startPos.y,0)
this.anim=this.node.getComponent(Animation)
this.on(GameEvent.MissionEnd, this.doDestroy, this);
this.node.active = true;
let collider = this.getComponent(Collider2D);
if(collider) {
collider.group = this.group;
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
let bm=this.node.getComponent(BezierMove)
// //console.log(this.group +"技能 collider ",collider);
switch(this.skillConfig.AType){
case AType.parabolic:
this.node.angle +=10
// bm.speed=700
if(this.group==BoxSet.MONSTER) {bm.controlPointSide=-1 }
bm.rotationSmoothness=0.6
bm.moveTo(this.targetPos)
break;
case AType.linear:
let s_x=this.startPos.x
let s_y=this.startPos.y
let t_x=this.targetPos.x
let t_y=this.targetPos.y
// 设定目标x
this.targetPos.x = 400;
if(this.group == BoxSet.MONSTER) {
bm.controlPointSide = -1;
this.targetPos.x = -400;
}
// 计算斜率
const k = (t_y - s_y) / (t_x - s_x);
// 按直线公式计算新的y
this.targetPos.y = k * (this.targetPos.x - s_x) + s_y;
bm.controlPointOffset=0
bm.rotationSmoothness=0.6
bm.moveTo(this.targetPos);
break;
case AType.StartEnd:
// 2段位移先升高然后移到目的地
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
this.do_anim()
break;
case AType.fixedEnd:
this.node.setPosition(this.targetPos.x > 360?300:this.targetPos.x,0,0)
this.do_anim()
break;
case AType.fixedStart: //
if(this.s_uuid==6001){
console.log("skillcom startPos",this.startPos)
}
this.node.setPosition(this.startPos.x > 360?300:this.startPos.x,0,0)
this.do_anim()
break;
}
this.anim=this.node.getComponent(Animation)
this.on(GameEvent.MissionEnd, this.doDestroy, this);
this.node.active = true;
let collider = this.getComponent(Collider2D);
if(collider) {
collider.group = this.group;
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
}
} }
do_anim(){ do_anim(){
if(this.node.getComponent(Animation)){ if(this.node.getComponent(Animation)){

View File

@@ -6,12 +6,13 @@ import { smc } from "../common/SingletonModuleComp";
import { FacSet } from "../common/config/BoxSet"; import { FacSet } from "../common/config/BoxSet";
import { HType } from "../common/config/heroSet"; import { HType } from "../common/config/heroSet";
import { SkillViewCom } from "./SkillViewCom"; import { SkillViewCom } from "./SkillViewCom";
import { HeroViewComp } from "../hero/HeroViewComp";
/** SkillCon 模块 */ /** SkillCon 模块 */
@ecs.register(`SkillCon`) @ecs.register(`SkillEnt`)
export class SkillCon extends ecs.Entity { export class SkillEnt extends ecs.Entity {
load(startPos: Vec3, parent: Node, uuid: number, targetPos: Vec3, caster:any=null, angle:number=0,dmg:number=0) { load(startPos: Vec3, parent: Node, uuid: number, targetPos: any[], caster:HeroViewComp=null,dmg:number=0) {
const config = SkillSet[uuid]; const config = SkillSet[uuid];
if (!config) { if (!config) {
console.error("[Skill] 技能配置不存在:", uuid); console.error("[Skill] 技能配置不存在:", uuid);
@@ -45,10 +46,8 @@ load(startPos: Vec3, parent: Node, uuid: number, targetPos: Vec3, caster:any=n
} }
} }
} }
node.angle+=angle
// 添加技能组件 // 添加技能组件
const SComp = node.getComponent(SkillViewCom); // 初始化技能参数 const SComp = node.getComponent(SkillViewCom); // 初始化技能参数
// 只设置必要的运行时属性,配置信息通过 SkillSet[uuid] 访问 // 只设置必要的运行时属性,配置信息通过 SkillSet[uuid] 访问
Object.assign(SComp, { Object.assign(SComp, {
// 核心标识 // 核心标识
@@ -60,6 +59,7 @@ load(startPos: Vec3, parent: Node, uuid: number, targetPos: Vec3, caster:any=n
fac: caster.fac, fac: caster.fac,
// 技能数值 // 技能数值
ap: caster.Attrs[BuffAttr.AP], ap: caster.Attrs[BuffAttr.AP],
caster: caster,
caster_crit: caster.Attrs[BuffAttr.CRITICAL], caster_crit: caster.Attrs[BuffAttr.CRITICAL],
caster_crit_d: caster.Attrs[BuffAttr.CRITICAL_DMG], caster_crit_d: caster.Attrs[BuffAttr.CRITICAL_DMG],
puncture: caster.Attrs[BuffAttr.PUNCTURE], puncture: caster.Attrs[BuffAttr.PUNCTURE],
@@ -89,12 +89,3 @@ load(startPos: Vec3, parent: Node, uuid: number, targetPos: Vec3, caster:any=n
super.destroy(); super.destroy();
} }
} }
/** SkillCon 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
export class EcsSkillConSystem extends ecs.System {
constructor() {
super();
// this.add(new ecs.ComblockSystem());
}
}

View File

@@ -1,7 +1,9 @@
import { _decorator } from "cc"; import { _decorator, instantiate, Node, Prefab } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroViewComp } from "../hero/HeroViewComp"; import { HeroViewComp } from "../hero/HeroViewComp";
import { BuffAttr, RType, SkillSet } from "../common/config/SkillSet";
import { AtkConCom } from "./AtkConCom";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -10,18 +12,23 @@ const { ccclass, property } = _decorator;
@ecs.register('SkillView', false) @ecs.register('SkillView', false)
export class SkillViewCom extends CCComp { export class SkillViewCom extends CCComp {
/** 视图层逻辑代码分离演示 */ /** 视图层逻辑代码分离演示 */
@property({ type: Prefab })
atkPrefab: Prefab = null!
@property({ type: Number })
runType: number = 0;
@property({ type: Boolean }) @property({ type: Boolean })
hasReady: boolean = false; hasReady: boolean = false;
@property({ type: Number }) @property({ type: Number })
ReadyTime: number = 0; ReadyTime: number = 0;
@property({ type: Number }) @property({ type: Number })
postion_y: number = 0; postion_y: number = 0;
endTime: number = 0;
s_uuid:number=0; s_uuid:number=0;
s_count:number=1; s_count:number=1;
s_interval:number=0.2; s_interval:number=0.2;
s_cd:number=0; s_cd:number=0;
caster:HeroViewComp=null; caster:HeroViewComp=null;
cName:string="";
target:HeroViewComp=null; target:HeroViewComp=null;
parent:Node=null; parent:Node=null;
target_postions:any[]=null target_postions:any[]=null
@@ -43,54 +50,104 @@ export class SkillViewCom extends CCComp {
debuff_up:number=0; debuff_up:number=0;
debuff_value:number=0; debuff_value:number=0;
debuff_count:number=0; debuff_count:number=0;
targetPos:any[]=null
start() { start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this); this.cName = this.caster.hero_name
this.node.getChildByName("ready").active = this.hasReady
} }
protected update(dt: number): void { protected update(dt: number): void {
this.doTimer(dt)
this.move(dt)
this.doEnd(dt)
if(this.hasReady) { if(this.hasReady) {
this.doTimer(dt)
if(this.ReadyTime <= 0) { if(this.ReadyTime <= 0) {
this.doAtk(dt) this.doAtk(dt)
} }
}{ }{
this.doAtk(dt) this.doAtk(dt)
} }
this.move(dt) }
doEnd(dt: number) {
this.endTime += dt
if(this.endTime >= SkillSet[this.s_uuid].in) {
this.ent.destroy()
}
} }
doTimer(dt: number){ doTimer(dt: number){
if(this.ReadyTime <= 0) return if(this.ReadyTime > 0&&this.hasReady) this.ReadyTime -= dt
this.ReadyTime -= dt
} }
doAtk(dt:number): void { doAtk(dt:number): void {
// console.log(`${this.cName}_[SkillViewCom] doAtkC`)
if(this.s_cd <= 0&&this.s_count > 0) { if(this.s_cd <= 0&&this.s_count > 0) {
this.doSkill() this.doSkill()
this.s_count-- this.s_count--
this.s_cd = this.s_interval this.s_cd = this.s_interval
} }
this.s_cd -= dt if(this.s_cd > 0) this.s_cd -= dt
} }
doSkill(){ doSkill(){
console.log("doSkill") console.log(`${this.cName}_[SkillViewCom] doSkill`,this.atkPrefab)
if(this.atkPrefab!=null){
let atkNode:Node = instantiate(this.atkPrefab)
atkNode.parent = this.node.parent
atkNode.setPosition(this.node.position)
let atkCom=atkNode.getComponent(AtkConCom)
Object.assign(atkCom, {
// 核心标识
s_uuid: this.s_uuid,
// 位置和施法者信息
startPos: this.node.position,
targetPos: this.targetPos[0],
group: this.caster.box_group,
fac: this.caster.fac,
// 技能数值
ap: this.caster.Attrs[BuffAttr.AP],
caster: this.caster,
caster_crit: this.caster.Attrs[BuffAttr.CRITICAL],
caster_crit_d: this.caster.Attrs[BuffAttr.CRITICAL_DMG],
puncture: this.caster.Attrs[BuffAttr.PUNCTURE],
puncture_damage: this.caster.Attrs[BuffAttr.PUNCTURE_DMG],
burn_count: this.caster.Attrs[BuffAttr.BURN_COUNT],
burn_value: this.caster.Attrs[BuffAttr.BURN_VALUE],
stun_time: this.caster.Attrs[BuffAttr.STUN_TIME],
stun_ratio: this.caster.Attrs[BuffAttr.STUN_RATIO],
frost_time: this.caster.Attrs[BuffAttr.FROST_TIME],
frost_ratio: this.caster.Attrs[BuffAttr.FROST_RATIO],
debuff_up: this.caster.Attrs[BuffAttr.DEBUFF_UP],
debuff_value: this.caster.Attrs[BuffAttr.DEBUFF_VALUE],
debuff_count: this.caster.Attrs[BuffAttr.DEBUFF_COUNT],
});
switch(this.runType){
case RType.linear:
this.do_linear(atkNode)
break
case RType.bezier:
this.do_bezier(atkNode)
break
case RType.fixed:
this.do_fixed(atkNode)
break
}
}
} }
move(dt: number): void { do_linear(atkNode:any): void {
if(this.caster == null) return console.log(`${this.cName}_[SkillViewCom] skille run type: linear`)
if(this.caster.is_dead) return }
if(this.caster.node.isValid) return do_bezier(atkNode:any): void {
this.node.setPosition(this.caster.node.position.x,this.caster.node.position.y+this.postion_y) console.log(`${this.cName}_[SkillViewCom] skille run type: bezier`)
console.log("[skillview]move",this.caster.node.position,this.node.position) }
do_fixed(atkNode:any): void {
console.log(`${this.cName}_[SkillViewCom] skille run type: fixed`)
} }
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
move(dt: number): void {
// console.log(`${this.cName}_[SkillViewCom] move`)
if(this.caster != null&&this.caster.node!=null) this.node.setPosition(this.caster.node.position.x,this.caster.node.position.y+this.postion_y)
// console.log(`${this.cName}_[skillview]move`,this.caster.node.position,this.node.position)
}
reset() { reset() {
this.node.destroy(); this.node.destroy();
} }