技能重构开始
This commit is contained in:
@@ -22,20 +22,23 @@
|
|||||||
"__id__": 2
|
"__id__": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 10
|
"__id__": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 18
|
"__id__": 19
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 26
|
"__id__": 28
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 30
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 28
|
"__id__": 32
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -112,6 +115,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 9
|
"__id__": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 10
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"removedComponents": []
|
"removedComponents": []
|
||||||
@@ -178,6 +184,16 @@
|
|||||||
"z": 0
|
"z": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
|
"targetInfo": {
|
||||||
|
"__id__": 6
|
||||||
|
},
|
||||||
|
"propertyPath": [
|
||||||
|
"_active"
|
||||||
|
],
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
@@ -185,14 +201,14 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 11
|
"__id__": 12
|
||||||
},
|
},
|
||||||
"__editorExtras__": {}
|
"__editorExtras__": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
"__id__": 10
|
"__id__": 11
|
||||||
},
|
},
|
||||||
"asset": {
|
"asset": {
|
||||||
"__uuid__": "43a67d73-b426-4f20-9a1f-1aaae1c82bd0",
|
"__uuid__": "43a67d73-b426-4f20-9a1f-1aaae1c82bd0",
|
||||||
@@ -200,7 +216,7 @@
|
|||||||
},
|
},
|
||||||
"fileId": "cfqCWnxbFLNoQMedQXsav3",
|
"fileId": "cfqCWnxbFLNoQMedQXsav3",
|
||||||
"instance": {
|
"instance": {
|
||||||
"__id__": 12
|
"__id__": 13
|
||||||
},
|
},
|
||||||
"targetOverrides": null
|
"targetOverrides": null
|
||||||
},
|
},
|
||||||
@@ -214,16 +230,16 @@
|
|||||||
"mountedComponents": [],
|
"mountedComponents": [],
|
||||||
"propertyOverrides": [
|
"propertyOverrides": [
|
||||||
{
|
{
|
||||||
"__id__": 13
|
"__id__": 14
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 15
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 16
|
"__id__": 16
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 17
|
"__id__": 17
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 18
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"removedComponents": []
|
"removedComponents": []
|
||||||
@@ -231,7 +247,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 14
|
"__id__": 15
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_name"
|
"_name"
|
||||||
@@ -247,7 +263,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 14
|
"__id__": 15
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_lpos"
|
"_lpos"
|
||||||
@@ -262,7 +278,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 14
|
"__id__": 15
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_lrot"
|
"_lrot"
|
||||||
@@ -278,7 +294,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 14
|
"__id__": 15
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_euler"
|
"_euler"
|
||||||
@@ -297,14 +313,14 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 19
|
"__id__": 20
|
||||||
},
|
},
|
||||||
"__editorExtras__": {}
|
"__editorExtras__": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
"__id__": 18
|
"__id__": 19
|
||||||
},
|
},
|
||||||
"asset": {
|
"asset": {
|
||||||
"__uuid__": "26ff5f8c-e160-4977-bf1b-0b6153052bef",
|
"__uuid__": "26ff5f8c-e160-4977-bf1b-0b6153052bef",
|
||||||
@@ -312,7 +328,7 @@
|
|||||||
},
|
},
|
||||||
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
|
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
|
||||||
"instance": {
|
"instance": {
|
||||||
"__id__": 20
|
"__id__": 21
|
||||||
},
|
},
|
||||||
"targetOverrides": null
|
"targetOverrides": null
|
||||||
},
|
},
|
||||||
@@ -326,16 +342,19 @@
|
|||||||
"mountedComponents": [],
|
"mountedComponents": [],
|
||||||
"propertyOverrides": [
|
"propertyOverrides": [
|
||||||
{
|
{
|
||||||
"__id__": 21
|
"__id__": 22
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 23
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 24
|
"__id__": 24
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 25
|
"__id__": 25
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 26
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 27
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"removedComponents": []
|
"removedComponents": []
|
||||||
@@ -343,12 +362,12 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 22
|
"__id__": 23
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_name"
|
"_name"
|
||||||
],
|
],
|
||||||
"value": "atk_fire"
|
"value": "atk"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.TargetInfo",
|
"__type__": "cc.TargetInfo",
|
||||||
@@ -359,7 +378,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 22
|
"__id__": 23
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_lpos"
|
"_lpos"
|
||||||
@@ -374,7 +393,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 22
|
"__id__": 23
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_lrot"
|
"_lrot"
|
||||||
@@ -390,7 +409,7 @@
|
|||||||
{
|
{
|
||||||
"__type__": "CCPropertyOverrideInfo",
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
"targetInfo": {
|
"targetInfo": {
|
||||||
"__id__": 22
|
"__id__": 23
|
||||||
},
|
},
|
||||||
"propertyPath": [
|
"propertyPath": [
|
||||||
"_euler"
|
"_euler"
|
||||||
@@ -402,6 +421,16 @@
|
|||||||
"z": 0
|
"z": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "CCPropertyOverrideInfo",
|
||||||
|
"targetInfo": {
|
||||||
|
"__id__": 23
|
||||||
|
},
|
||||||
|
"propertyPath": [
|
||||||
|
"_active"
|
||||||
|
],
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.UITransform",
|
"__type__": "cc.UITransform",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
@@ -412,7 +441,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 27
|
"__id__": 29
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -430,6 +459,27 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "63NP9yq3hEUKD/OZZZ5t7x"
|
"fileId": "63NP9yq3hEUKD/OZZZ5t7x"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "fa24e/W24dKOpV/zeDMOkBU",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 31
|
||||||
|
},
|
||||||
|
"hasReady": true,
|
||||||
|
"ReadyTime": 0,
|
||||||
|
"postion_y": 0,
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "71M8fD8N5EuYBVRGv+zaXd"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
@@ -443,10 +493,10 @@
|
|||||||
"targetOverrides": null,
|
"targetOverrides": null,
|
||||||
"nestedPrefabInstanceRoots": [
|
"nestedPrefabInstanceRoots": [
|
||||||
{
|
{
|
||||||
"__id__": 18
|
"__id__": 19
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 10
|
"__id__": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 2
|
"__id__": 2
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
"fileId": "63z5ZyjTNKYbn+kEVB1s3W"
|
"fileId": "63z5ZyjTNKYbn+kEVB1s3W"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "0f3c4JhFbFO2rEFqBJJ7hFv",
|
"__type__": "be4ce0BvYZAT7jwDh/8uEKc",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
@@ -272,7 +272,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "32SLcINL1JHZ+vIyextzaC"
|
"fileId": "43LhUxREVP5o28vKbBCWcd"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ export const SkillSet: Record<number, SkillConfig> = {
|
|||||||
buffs:[],debuffs:[],info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害"
|
buffs:[],debuffs:[],info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害"
|
||||||
},
|
},
|
||||||
6005: {
|
6005: {
|
||||||
uuid:6005,name:"火球术",for_hero:true,sp_name:"am_fire",AtkedType:AtkedType.fire,path:"3039",quality:QualitySet.BLUE,TType:TType.Frontline,
|
uuid:6005,name:"火球术",for_hero:true,sp_name:"atk_fire",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:0,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%攻击的伤害,有一定几率施加灼烧"
|
||||||
|
|||||||
@@ -12,6 +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';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('SkillCon')
|
@ccclass('SkillCon')
|
||||||
@@ -103,7 +104,7 @@ export class SkillConComp extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.HeroView.playSkillEffect(config.uuid)
|
this.HeroView.playSkillEffect(config.uuid)
|
||||||
const skillEntity = ecs.getEntity<Skill>(Skill);
|
const skillEntity = ecs.getEntity<SkillCon>(SkillCon);
|
||||||
|
|
||||||
|
|
||||||
const timerId = setTimeout(() => {
|
const timerId = setTimeout(() => {
|
||||||
|
|||||||
29
assets/script/game/skill/ReadyCom.ts
Normal file
29
assets/script/game/skill/ReadyCom.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { _decorator } from "cc";
|
||||||
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
|
|
||||||
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
/** 视图层对象 */
|
||||||
|
@ccclass('ReadyComComp')
|
||||||
|
@ecs.register('ReadyCom', false)
|
||||||
|
export class ReadyComComp extends CCComp {
|
||||||
|
/** 视图层逻辑代码分离演示 */
|
||||||
|
start() {
|
||||||
|
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||||
|
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 全局消息逻辑处理 */
|
||||||
|
// private onHandler(event: string, args: any) {
|
||||||
|
// switch (event) {
|
||||||
|
// case ModuleEvent.Cmd:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
|
reset() {
|
||||||
|
this.node.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
9
assets/script/game/skill/ReadyCom.ts.meta
Normal file
9
assets/script/game/skill/ReadyCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.24",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "be4ced01-bd86-404f-b8f0-0e1ffcb8429c",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
||||||
100
assets/script/game/skill/SkillCon.ts
Normal file
100
assets/script/game/skill/SkillCon.ts
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
import { instantiate, Node, Prefab, v3, Vec3 } from "cc";
|
||||||
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
|
import { BuffAttr, SkillSet } from "../common/config/SkillSet";
|
||||||
|
import { oops } from "db://oops-framework/core/Oops";
|
||||||
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
import { FacSet } from "../common/config/BoxSet";
|
||||||
|
import { HType } from "../common/config/heroSet";
|
||||||
|
import { SkillViewCom } from "./SkillViewCom";
|
||||||
|
|
||||||
|
/** SkillCon 模块 */
|
||||||
|
@ecs.register(`SkillCon`)
|
||||||
|
export class SkillCon extends ecs.Entity {
|
||||||
|
|
||||||
|
load(startPos: Vec3, parent: Node, uuid: number, targetPos: Vec3, caster:any=null, angle:number=0,dmg:number=0) {
|
||||||
|
const config = SkillSet[uuid];
|
||||||
|
if (!config) {
|
||||||
|
console.error("[Skill] 技能配置不存在:", uuid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 检查施法者
|
||||||
|
if (!caster) {
|
||||||
|
console.error("[Skill] 施法者为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 加载预制体
|
||||||
|
const path = `game/skill/atk/${config.sp_name}`;
|
||||||
|
const prefab:Prefab = oops.res.get(path, Prefab);
|
||||||
|
if (!prefab) {
|
||||||
|
console.error("[Skill] 预制体加载失败:", path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(uuid==6001){
|
||||||
|
console.log("load skill startPos",startPos)
|
||||||
|
}
|
||||||
|
const node: Node = instantiate(prefab);
|
||||||
|
node.parent = parent;
|
||||||
|
// 设置节点属性
|
||||||
|
node.setPosition(startPos);
|
||||||
|
if(caster.fac==FacSet.MON){
|
||||||
|
node.scale=v3(node.scale.x*-1,1,1)
|
||||||
|
}else{
|
||||||
|
if(caster.type==HType.warrior){
|
||||||
|
if(caster.node.scale.x<0){
|
||||||
|
node.scale=v3(node.scale.x*-1,node.scale.y,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.angle+=angle
|
||||||
|
// 添加技能组件
|
||||||
|
const SComp = node.getComponent(SkillViewCom); // 初始化技能参数
|
||||||
|
|
||||||
|
// 只设置必要的运行时属性,配置信息通过 SkillSet[uuid] 访问
|
||||||
|
Object.assign(SComp, {
|
||||||
|
// 核心标识
|
||||||
|
s_uuid: uuid,
|
||||||
|
// 位置和施法者信息
|
||||||
|
startPos: startPos,
|
||||||
|
targetPos: targetPos,
|
||||||
|
group: caster.box_group,
|
||||||
|
fac: caster.fac,
|
||||||
|
// 技能数值
|
||||||
|
ap: caster.Attrs[BuffAttr.AP],
|
||||||
|
caster_crit: caster.Attrs[BuffAttr.CRITICAL],
|
||||||
|
caster_crit_d: caster.Attrs[BuffAttr.CRITICAL_DMG],
|
||||||
|
puncture: caster.Attrs[BuffAttr.PUNCTURE],
|
||||||
|
puncture_damage: caster.Attrs[BuffAttr.PUNCTURE_DMG],
|
||||||
|
burn_count: caster.Attrs[BuffAttr.BURN_COUNT],
|
||||||
|
burn_value: caster.Attrs[BuffAttr.BURN_VALUE],
|
||||||
|
stun_time: caster.Attrs[BuffAttr.STUN_TIME],
|
||||||
|
stun_ratio: caster.Attrs[BuffAttr.STUN_RATIO],
|
||||||
|
frost_time: caster.Attrs[BuffAttr.FROST_TIME],
|
||||||
|
frost_ratio: caster.Attrs[BuffAttr.FROST_RATIO],
|
||||||
|
debuff_up: caster.Attrs[BuffAttr.DEBUFF_UP],
|
||||||
|
debuff_value: caster.Attrs[BuffAttr.DEBUFF_VALUE],
|
||||||
|
debuff_count: caster.Attrs[BuffAttr.DEBUFF_COUNT],
|
||||||
|
});
|
||||||
|
this.add(SComp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 实始添加的数据层组件 */
|
||||||
|
protected init() {
|
||||||
|
// this.addComponents<ecs.Comp>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 模块资源释放 */
|
||||||
|
destroy() {
|
||||||
|
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
||||||
|
this.remove(SkillViewCom);
|
||||||
|
super.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** SkillCon 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */
|
||||||
|
export class EcsSkillConSystem extends ecs.System {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
// this.add(new ecs.ComblockSystem());
|
||||||
|
}
|
||||||
|
}
|
||||||
9
assets/script/game/skill/SkillCon.ts.meta
Normal file
9
assets/script/game/skill/SkillCon.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.24",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "65a6cf41-5233-445e-b656-1fcf0e37d53d",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
||||||
97
assets/script/game/skill/SkillViewCom.ts
Normal file
97
assets/script/game/skill/SkillViewCom.ts
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import { _decorator } from "cc";
|
||||||
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
|
|
||||||
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
/** 视图层对象 */
|
||||||
|
@ccclass('SkillViewCom')
|
||||||
|
@ecs.register('SkillView', false)
|
||||||
|
export class SkillViewCom extends CCComp {
|
||||||
|
/** 视图层逻辑代码分离演示 */
|
||||||
|
@property({ type: Boolean })
|
||||||
|
hasReady: boolean = false;
|
||||||
|
@property({ type: Number })
|
||||||
|
ReadyTime: number = 0;
|
||||||
|
@property({ type: Number })
|
||||||
|
postion_y: number = 0;
|
||||||
|
|
||||||
|
s_uuid:number=0;
|
||||||
|
s_count:number=1;
|
||||||
|
s_interval:number=0.2;
|
||||||
|
s_cd:number=0;
|
||||||
|
caster:HeroViewComp=null;
|
||||||
|
target:HeroViewComp=null;
|
||||||
|
parent:Node=null;
|
||||||
|
target_postions:any[]=null
|
||||||
|
// 战斗相关运行时数据
|
||||||
|
ap:number=0;
|
||||||
|
burn_count:number=0;
|
||||||
|
burn_value:number=0;
|
||||||
|
stun_time:number=0;
|
||||||
|
stun_ratio:number=0;
|
||||||
|
frost_ratio:number=0;
|
||||||
|
frost_time:number=0;
|
||||||
|
run_time:number=0;
|
||||||
|
hited_time:number=0;
|
||||||
|
hit_count:number=0;
|
||||||
|
caster_crit:number=0;
|
||||||
|
caster_crit_d:number=0;
|
||||||
|
puncture:number=0;
|
||||||
|
puncture_damage:number=0;
|
||||||
|
debuff_up:number=0;
|
||||||
|
debuff_value:number=0;
|
||||||
|
debuff_count:number=0;
|
||||||
|
|
||||||
|
start() {
|
||||||
|
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||||
|
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||||
|
}
|
||||||
|
protected update(dt: number): void {
|
||||||
|
if(this.hasReady) {
|
||||||
|
this.doTimer(dt)
|
||||||
|
if(this.ReadyTime <= 0) {
|
||||||
|
this.doAtk(dt)
|
||||||
|
}
|
||||||
|
}{
|
||||||
|
this.doAtk(dt)
|
||||||
|
}
|
||||||
|
this.move(dt)
|
||||||
|
}
|
||||||
|
|
||||||
|
doTimer(dt: number){
|
||||||
|
if(this.ReadyTime <= 0) return
|
||||||
|
this.ReadyTime -= dt
|
||||||
|
}
|
||||||
|
doAtk(dt:number): void {
|
||||||
|
if(this.s_cd <= 0&&this.s_count > 0) {
|
||||||
|
this.doSkill()
|
||||||
|
this.s_count--
|
||||||
|
this.s_cd = this.s_interval
|
||||||
|
}
|
||||||
|
this.s_cd -= dt
|
||||||
|
}
|
||||||
|
doSkill(){
|
||||||
|
console.log("doSkill")
|
||||||
|
}
|
||||||
|
move(dt: number): void {
|
||||||
|
if(this.caster == null) return
|
||||||
|
if(this.caster.is_dead) return
|
||||||
|
if(this.caster.node.isValid) return
|
||||||
|
this.node.setPosition(this.caster.node.position.x,this.caster.node.position.y+this.postion_y)
|
||||||
|
console.log("[skillview]move",this.caster.node.position,this.node.position)
|
||||||
|
}
|
||||||
|
/** 全局消息逻辑处理 */
|
||||||
|
// private onHandler(event: string, args: any) {
|
||||||
|
// switch (event) {
|
||||||
|
// case ModuleEvent.Cmd:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
|
reset() {
|
||||||
|
this.node.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
9
assets/script/game/skill/SkillViewCom.ts.meta
Normal file
9
assets/script/game/skill/SkillViewCom.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.24",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "fa24efd6-db87-4a3a-957f-cde0cc3a4054",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user