开始制作召唤技能

This commit is contained in:
2025-01-16 09:44:28 +08:00
parent 27603e2434
commit 30c908ee78
9 changed files with 457 additions and 14 deletions

View File

@@ -182,7 +182,7 @@
"defaultSkin": "default", "defaultSkin": "default",
"defaultAnimation": "show", "defaultAnimation": "show",
"_premultipliedAlpha": true, "_premultipliedAlpha": true,
"_timeScale": 1, "_timeScale": 0.9,
"_preCacheMode": 0, "_preCacheMode": 0,
"_cacheMode": 0, "_cacheMode": 0,
"_sockets": [], "_sockets": [],

View File

@@ -0,0 +1,339 @@
[
{
"__type__": "cc.Prefab",
"_name": "zhaohuan",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "zhaohuan",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 6
},
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 12
},
{
"__id__": 14
},
{
"__id__": 16
}
],
"_prefab": {
"__id__": 18
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "skill",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 5
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 48,
"height": 48
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b4sNQPJWFKha7x75SWXmRj"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "7a5LvbdlxEc6FKa7cun2oB",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.49664333316829656,
"y": 0.5156666649712457
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "63NP9yq3hEUKD/OZZZ5t7x"
},
{
"__type__": "cc.RigidBody2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 9
},
"enabledContactListener": true,
"bullet": true,
"awakeOnLoad": true,
"_group": 4,
"_type": 2,
"_allowSleep": false,
"_gravityScale": 0,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f1VxV09PdOkofzgGv1tsZE"
},
{
"__type__": "cc.BoxCollider2D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"tag": 8,
"_group": 4,
"_density": 1,
"_sensor": true,
"_friction": 0.2,
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0.4,
"y": -0.7
},
"_size": {
"__type__": "cc.Size",
"width": 11.6,
"height": 12.3
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "23eik112JPZYGiI8mJalTK"
},
{
"__type__": "45646oIyIdA24W+0c5rdELD",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8ahZv91itPcYJm8S0veHYl"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"playOnLoad": true,
"_clips": [
{
"__uuid__": "2202bddf-38fc-4b0e-a004-ef962f61f49d",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "2202bddf-38fc-4b0e-a004-ef962f61f49d",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "7cJdSTCj5Eu4vDiD6FPj8P"
},
{
"__type__": "9e0d3yayihFMKm6st+kCG3D",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d9m8Z9r0FAn79RIXwYOlkG"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": null,
"targetOverrides": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "b211fa96-126c-442c-9a8d-0b9c5a8efec4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "zhaohuan"
}
}

View File

@@ -36,18 +36,9 @@ export class Hero extends ecs.Entity {
/** 加载角色 */ /** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_hero:boolean=true) { load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_hero:boolean=true) {
let box_group= 0 scale = 1
let box_group=BoxSet.HERO
if (is_hero) { this.addComponents<ecs.Comp>( HeroModelComp);
scale = 1
box_group=BoxSet.HERO
this.addComponents<ecs.Comp>( HeroModelComp);
}else{
scale=-1
box_group=BoxSet.MONSTER
this.addComponents<ecs.Comp>( MonModelComp);
}
var path = "game/heros/"+HeroInfo[uuid].path; var path = "game/heros/"+HeroInfo[uuid].path;
var prefab: Prefab = oops.res.get(path, Prefab)!; var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab); var node = instantiate(prefab);

View File

@@ -170,6 +170,7 @@ export class HeroViewComp extends CCComp {
let skill = oCol.node.getComponent(SkillCom)!; let skill = oCol.node.getComponent(SkillCom)!;
// console.log(Date.now()+this.hero_name+":"+this.uuid+' onBeginContact: '+skill.s_name+skill.uuid); // console.log(Date.now()+this.hero_name+":"+this.uuid+' onBeginContact: '+skill.s_name+skill.uuid);
if(this.hp <= 0 ) return if(this.hp <= 0 ) return
if(skill.tg< 3) return
this.check_uatk(skill); this.check_uatk(skill);
} }
} }

View File

@@ -47,8 +47,10 @@ export class Skill extends ecs.Entity {
// sv.angle = angle; // sv.angle = angle;
// console.log(group+" "+SkillSet[uuid].name+"angle:"+angle) // console.log(group+" "+SkillSet[uuid].name+"angle:"+angle)
sv.s_uuid = uuid; sv.s_uuid = uuid;
sv.s_name = SkillSet[uuid].name; sv.s_name = SkillSet[uuid].name;
sv.hero = SkillSet[uuid].hero;
sv.ap = ap*SkillSet[uuid].ap/100; // 技能伤害 sv.ap = ap*SkillSet[uuid].ap/100; // 技能伤害
sv.def = ap*SkillSet[uuid].def/100; // 技能伤害
sv.apup = ap*SkillSet[uuid].apup/100; // 伤害增量 sv.apup = ap*SkillSet[uuid].apup/100; // 伤害增量
sv.hp = hp*SkillSet[uuid].hp/100; // 回复hp增量 sv.hp = hp*SkillSet[uuid].hp/100; // 回复hp增量
sv.mhp = SkillSet[uuid].mhp/100; // hpmax增量 % sv.mhp = SkillSet[uuid].mhp/100; // hpmax增量 %

View File

@@ -18,9 +18,11 @@ const { ccclass, property } = _decorator;
export class SkillCom extends CCComp { export class SkillCom extends CCComp {
s_uuid:number = 0; s_uuid:number = 0;
s_name:string = ""; s_name:string = "";
hero:number = 0;
speed:number = 200; speed:number = 200;
scale:number = 1; scale:number = 1;
ap:number = 10; ap:number = 10;
def:number = 10;
apup:number = 0;// apup:number = 0;//
mhp:number = 0; mhp:number = 0;
hp:number = 0; //治疗总量 hp:number = 0; //治疗总量

View File

@@ -0,0 +1,86 @@
import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
import { SkillCom } from './SkillCom';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
import { Hero } from '../hero/Hero';
import { BoxSet } from '../common/config/BoxSet';
import { Monster } from '../hero/Mon';
import { HeroViewComp } from '../hero/HeroViewComp';
import { smc } from '../common/SingletonModuleComp';
import { HeroInfo } from '../common/config/heroSet';
import { oops } from 'db://oops-framework/core/Oops';
const { ccclass, property } = _decorator;
@ccclass('ZhanCom')
export class ZhanCom extends Component {
base:SkillCom = null
start() {
this.base =this.node.getComponent(SkillCom)
let pos = this.node.position
let hero:any=null
if(this.base.box_group==BoxSet.HERO) {
hero = ecs.getEntity<Hero>(Hero);
let scale = 1
hero.load(pos,scale,this.base.hero);
}
if(this.base.box_group==BoxSet.MONSTER) hero = ecs.getEntity<Monster>(Monster);
}
update(deltaTime: number) {
}
call_hero() {
let scale = 1
let box_group=BoxSet.HERO
var path = "game/heros/"+HeroInfo[this.base.hero].path;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!
node.setPosition(this.node.position)
oops.message.dispatchEvent("hero_load",this)
var hv = node.getComponent(HeroViewComp)!;
// console.log("hero_init",buff)
let hero= HeroInfo[this.base.hero] // 共用英雄数据数据
hv.scale = scale;
hv.box_group = box_group;
hv.hero_uuid= this.base.hero;
hv.hero_name= hero.name;
hv.speed =hv.ospeed = hero.speed;
hv.dis = hero.dis;
hv.pw = hero.pw;
hv.pwm= hero.pwm;
hv.pws= hero.pws
hv.apw=hero.apw;
hv.uapw=hero.uapw;
hv.cpw=hero.cpw;
hv.dpw=hero.dpw;
hv.dopw=hero.dopw;
hv.type = hero.type;
let slv = hv.slv = 1;
hv.sk1 = hero.sk1[slv];
hv.sk2 = hero.sk2[slv];
hv.sk3 = hero.sk3[slv];
hv.akc = hero.akc[slv];
hv.uac = hero.uac[slv];
hv.crc = hero.crc[slv];
hv.dgc = hero.dgc[slv];
hv.akr = hero.akr[slv];
hv.uar = hero.uar[slv];
hv.crr = hero.crr[slv];
hv.dgr = hero.dgr[slv];
hv.rhp_max=this.base.hp
hv.ap = this.base.ap
hv.def=this.base.def
hv.cd = hero.a_cd
hv.crit = hero.crit; //暴击率
hv.crit_add = hero.crit_add;//暴击伤害加成
hv.dodge = hero.dodge; //闪避率
hv.aexp=hero.aexp;
hv.uaexp=hero.uaexp;
hv.cexp=hero.cexp
hv.doexp=hero.doexp
hv.dexp=hero.dexp;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "eb0df9e9-d129-4d4b-b5ef-e63d068942e6",
"files": [],
"subMetas": {},
"userData": {}
}