This commit is contained in:
pan@work
2024-09-29 09:49:35 +08:00
parent 331b22da07
commit 81639781f9
7 changed files with 100 additions and 82 deletions

View File

@@ -377,7 +377,7 @@
"defaultSkin": "default", "defaultSkin": "default",
"defaultAnimation": "idle", "defaultAnimation": "idle",
"_premultipliedAlpha": true, "_premultipliedAlpha": true,
"_timeScale": 2, "_timeScale": 1,
"_preCacheMode": 2, "_preCacheMode": 2,
"_cacheMode": 2, "_cacheMode": 2,
"_sockets": [], "_sockets": [],
@@ -704,7 +704,7 @@
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 72.084, "y": 89.897,
"z": 0 "z": 0
} }
}, },
@@ -749,8 +749,8 @@
], ],
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.2, "x": 1.5,
"y": 1.2, "y": 1,
"z": 1 "z": 1
} }
}, },
@@ -762,7 +762,7 @@
"propertyPath": [ "propertyPath": [
"_active" "_active"
], ],
"value": false "value": true
}, },
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",
@@ -1194,6 +1194,7 @@
}, },
"fileId": "fdklpBwCBM/qJ4WFlQF3kT", "fileId": "fdklpBwCBM/qJ4WFlQF3kT",
"instance": null, "instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 54 "__id__": 54

View File

@@ -43,13 +43,13 @@
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0, "z": -0.49999999999999994,
"w": 1 "w": 0.8660254037844387
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.5, "x": 0.2,
"y": 1.5, "y": 1,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -58,7 +58,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0 "z": -60
}, },
"_id": "" "_id": ""
}, },
@@ -120,8 +120,8 @@
"defaultAnimation": "animation", "defaultAnimation": "animation",
"_premultipliedAlpha": true, "_premultipliedAlpha": true,
"_timeScale": 1, "_timeScale": 1,
"_preCacheMode": 0, "_preCacheMode": 1,
"_cacheMode": 0, "_cacheMode": 1,
"_sockets": [], "_sockets": [],
"_useTint": false, "_useTint": false,
"_debugMesh": false, "_debugMesh": false,

View File

@@ -85,7 +85,7 @@
"__id__": 9 "__id__": 9
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 15 "__id__": 15
@@ -97,7 +97,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 20,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -187,7 +187,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 26.24609375, "width": 31.8076171875,
"height": 54.4 "height": 54.4
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -226,7 +226,7 @@
"_string": "10", "_string": "10",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 20, "_actualFontSize": 25,
"_fontSize": 25, "_fontSize": 25,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,

View File

@@ -9,7 +9,7 @@ import { Vec3, v3,_decorator ,Collider2D,Contact2DType,Label,Node,Prefab,instant
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 { RoleSpine } from "./RoleSpine"; import { RoleSpine } from "./RoleSpine";
import {BoxSet} from "../common/config/BoxSet" import {BoxSet, GameSet} from "../common/config/BoxSet"
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
import { SkillCom } from "../skills/SkillCom"; import { SkillCom } from "../skills/SkillCom";
import { Skill } from "../skills/Skill"; import { Skill } from "../skills/Skill";
@@ -185,7 +185,7 @@ export class RoleViewComp extends CCComp {
this.in_atk(); this.in_atk();
this.skill_cds(dt); this.skill_cds(dt);
this.move(dt); this.move(dt);
this.check_enemys() this.check_enemy_alive()
} }
skill_cds(dt:number){ skill_cds(dt:number){
if(this.skill1.alive) this.skill1.cd -= dt; if(this.skill1.alive) this.skill1.cd -= dt;
@@ -195,27 +195,27 @@ export class RoleViewComp extends CCComp {
if(this.skill5.alive) this.skill5.cd -= dt; if(this.skill5.alive) this.skill5.cd -= dt;
if(this.skill1.cd <= 0){ if(this.skill1.cd <= 0){
this.shoot(this.skill1.uuid); this.handle_skill(this.skill1.uuid);
this.skill1.cd=this.skill1.cd_max this.skill1.cd=this.skill1.cd_max
console.log("shoot uuid :"+this.skill1.uuid); console.log("shoot uuid :"+this.skill1.uuid);
} }
if(this.skill2.cd <= 0){ if(this.skill2.cd <= 0){
this.shoot(this.skill2.uuid); this.handle_skill(this.skill2.uuid);
this.skill2.cd=this.skill2.cd_max this.skill2.cd=this.skill2.cd_max
console.log("shoot uuid :"+this.skill2.uuid); console.log("shoot uuid :"+this.skill2.uuid);
} }
if(this.skill3.cd <= 0){ if(this.skill3.cd <= 0){
this.shoot(this.skill3.uuid); this.handle_skill(this.skill3.uuid);
this.skill3.cd=this.skill3.cd_max this.skill3.cd=this.skill3.cd_max
console.log("shoot uuid :"+this.skill3.uuid); console.log("shoot uuid :"+this.skill3.uuid);
} }
if(this.skill4.cd <= 0){ if(this.skill4.cd <= 0){
this.shoot(this.skill4.uuid); this.handle_skill(this.skill4.uuid);
this.skill4.cd=this.skill4.cd_max this.skill4.cd=this.skill4.cd_max
console.log("shoot uuid :"+this.skill4.uuid); console.log("shoot uuid :"+this.skill4.uuid);
} }
if(this.skill5.cd <= 0){ if(this.skill5.cd <= 0){
this.shoot(this.skill5.uuid); this.handle_skill(this.skill5.uuid);
this.skill5.cd=this.skill5.cd_max this.skill5.cd=this.skill5.cd_max
console.log("shoot uuid :"+this.skill5.uuid); console.log("shoot uuid :"+this.skill5.uuid);
} }
@@ -231,25 +231,32 @@ export class RoleViewComp extends CCComp {
// }); // });
// console.log(this.skills); // console.log(this.skills);
} }
check_enemys(){ handle_skill(uuid:number){
let enemys=ecs.query(ecs.allOf(MonViewComp)); // console.log("handle_skill uuid:"+uuid);
if(enemys.length > 0){ this.as.max();
let x= 720 this.scheduleOnce(()=>{
for (let i = 0; i < enemys.length; i++) { this.shoot(this.skill);
let enemy:any = enemys[i]; },0.3)
if(!enemy.MonView) continue
let node=enemy.MonView.node
if(node.isValid){
if(node.position.x < x){
x=node.position.x
this.enemy = node.position;
}
}
}
}else{
this.enemy = v3(720,this.node.position.y);
}
} }
// check_enemys(){
// let enemys=ecs.query(ecs.allOf(MonViewComp));
// if(enemys.length > 0){
// let x= 720
// for (let i = 0; i < enemys.length; i++) {
// let enemy:any = enemys[i];
// if(!enemy.MonView) continue
// let node=enemy.MonView.node
// if(node.isValid){
// if(node.position.x < x){
// x=node.position.x
// this.enemy = node.position;
// }
// }
// }
// }else{
// this.enemy = v3(720,this.node.position.y);
// }
// }
move(dt:number){ move(dt:number){
if(this.stop_cd > 0){ if(this.stop_cd > 0){
this.as.idle() this.as.idle()
@@ -287,30 +294,40 @@ export class RoleViewComp extends CCComp {
return {pos,t_pos} return {pos,t_pos}
} }
check_enemy_alive(){ check_enemy_alive(){
if(this.enemy){ let dir = 320
if(!this.enemy.isValid){ this.enemy = v3(720,this.node.position.y)
return false for (let i = 0; i < GameSet.ATK_LINES; i++) {
let mon:any = smc.enemy_pos[i];
let x=Math.abs(mon.x-this.node.position.x)
let y = Math.abs(mon.y-this.node.position.y)
let squaredDistance =x*x+y*y
let distance = Math.sqrt(squaredDistance);
if(distance < dir){
dir = distance
this.enemy = mon
} }
return true }
if(dir < this.atk_dis){
this.is_atking=true
}else{ }else{
return false this.is_atking=false
} }
} }
in_atk() { in_atk() {
if(this.atk_time >= this.atk_cd){ if(this.atk_time >= this.atk_cd){
// if(this.is_atking&&this.check_enemy_alive()){ if(this.is_atking){
// this.atk_time = 0; this.atk_time = 0;
// // console.log("atk_cd:"+this.atk_cd); // console.log("atk_cd:"+this.atk_cd);
// this.as.atk(); this.as.atk();
// this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
// this.shoot(this.skill,-30); this.shoot(this.skill,-30);
// },0.4) },0.4)
// } }
this.atk_time = 0; // this.atk_time = 0;
this.as.atk(); // this.as.atk();
this.scheduleOnce(()=>{ // this.scheduleOnce(()=>{
this.shoot(this.skill,-30,45); // this.shoot(this.skill,-30,45);
},0.3) // },0.3)
} }
} }
@@ -337,7 +354,7 @@ export class RoleViewComp extends CCComp {
return; return;
} }
this.hp += lhp; this.hp += lhp;
this.tooltip(1,hp.toString()); // this.tooltip(1,hp.toString());
if(this.hp > this.hp_max){ if(this.hp > this.hp_max){
this.hp = this.hp_max; this.hp = this.hp_max;
} }
@@ -485,12 +502,12 @@ export class RoleViewComp extends CCComp {
in_atked() { in_atked() {
var path = "game/skills/atked"; // var path = "game/skills/atked";
var prefab: Prefab = oops.res.get(path, Prefab)!; // var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab); // var node = instantiate(prefab);
let pos = v3(0,60) // let pos = v3(0,30)
node.setPosition(pos) // node.setPosition(pos)
node.parent = this.node; // node.parent = this.node;
// this.sprite.setSharedMaterial(this.hitFlashMaterial, 0); // this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);

View File

@@ -29,39 +29,38 @@ export const HeroSet = {
max_skill: "精准射击", skill_uuid: 9003, max_skill_uuid: 1003, word: "狂暴", info: "全体攻击", atktype: 2 max_skill: "精准射击", skill_uuid: 9003, max_skill_uuid: 1003, word: "狂暴", info: "全体攻击", atktype: 2
}, },
} }
export const MonSet = { export const MonSet = {
1011: { 1011: {
uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 10, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 5, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30,
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1012: { 1012: {
uuid: 1012, path: "orc2", type: 1, level: 1,cost:2, name: "荒野兽人", atk: 15, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, uuid: 1012, path: "orc2", type: 1, level: 1,cost:2, name: "荒野兽人", atk: 10, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30,
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1013: { 1013: {
uuid: 1013, path: "orc3", type: 1, level: 1,cost:2, name: "兽人战士", atk: 20, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, uuid: 1013, path: "orc3", type: 1, level: 1,cost:2, name: "兽人战士", atk: 15, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30,
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1031: { 1031: {
uuid: 1031, path: "du1", type: 1, level: 1,cost:2, name: "独眼巨人", atk: 10, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, uuid: 1031, path: "du1", type: 1, level: 1,cost:2, name: "独眼巨人", atk: 5, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30,
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1032: { 1032: {
uuid: 1032, path: "du2", type: 1, level: 1,cost:2, name: "狂暴独眼", atk: 15, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, uuid: 1032, path: "du2", type: 1, level: 1,cost:2, name: "狂暴独眼", atk: 10, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30,
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1033: { 1033: {
uuid: 1033, path: "du3", type: 1, level: 1,cost:2, name: "独眼首领", atk: 20, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, uuid: 1033, path: "du3", type: 1, level: 1,cost:2, name: "独眼首领", atk: 15, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30,
max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
5001: { 5001: {
uuid: 5001, path: "boss1", type: 1, level: 1,cost:2, name: "骷髅王", atk: 30, hp: 1000, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 7, uuid: 5001, path: "boss1", type: 1, level: 1,cost:2, name: "骷髅王", atk: 30, hp: 150, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 7,
max_skill: "精准打击", skill_uuid: 1001, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 1001, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1
}, },

View File

@@ -277,7 +277,6 @@ export class HeroViewComp extends CCComp {
get_hero_pos(hero:any){ get_hero_pos(hero:any){
let pos =this.skill_pos() let pos =this.skill_pos()
let t_pos:Vec3 = v3(720,0) let t_pos:Vec3 = v3(720,0)
console.log("hero.node.isValid",hero);
if(!hero.node.isValid){ if(!hero.node.isValid){
return return
}else{ }else{
@@ -347,10 +346,12 @@ export class HeroViewComp extends CCComp {
} }
if(t_hero){ //血量最少单体 if(t_hero){ //血量最少单体
let role_hp=smc.Role.RoleView.hp_max-smc.Role.RoleView.hp if(smc.Role.RoleView){
if(role_hp > least_hp){ let role_hp=smc.Role.RoleView.hp_max-smc.Role.RoleView.hp
least_hp = role_hp if(role_hp > least_hp){
t_hero = smc.Role.RoleView least_hp = role_hp
t_hero = smc.Role.RoleView
}
} }
this.to_add_buff(t_hero,skill) this.to_add_buff(t_hero,skill)
} }
@@ -451,7 +452,7 @@ export class HeroViewComp extends CCComp {
return; return;
} }
this.hp += lhp; this.hp += lhp;
this.tooltip(1,hp.toString()); // this.tooltip(1,hp.toString());
if(this.hp > this.hp_max){ if(this.hp > this.hp_max){
this.hp = this.hp_max; this.hp = this.hp_max;
} }

View File

@@ -33,7 +33,7 @@ export class TooltipCom extends CCComp {
this.node.getChildByName("loss_life").active=true; this.node.getChildByName("loss_life").active=true;
tween(this.node).to( tween(this.node).to(
this.alive_time, this.alive_time,
{position:v3(this.node.position.x,this.node.position.y+10), }, {position:v3(this.node.position.x+30,this.node.position.y+20), },
{ {
onComplete:()=>{ this.ent.destroy()}, onComplete:()=>{ this.ent.destroy()},
easing:"linear" easing:"linear"
@@ -45,7 +45,7 @@ export class TooltipCom extends CCComp {
this.node.getChildByName("add_life").active=true; this.node.getChildByName("add_life").active=true;
tween(this.node).to( tween(this.node).to(
this.alive_time, this.alive_time,
{position:v3(this.node.position.x,this.node.position.y+10), }, {position:v3(this.node.position.x-30,this.node.position.y+20), },
{ {
onComplete:()=>{ this.ent.destroy()}, onComplete:()=>{ this.ent.destroy()},
easing:"linear" easing:"linear"