This commit is contained in:
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",
"defaultAnimation": "idle",
"_premultipliedAlpha": true,
"_timeScale": 2,
"_timeScale": 1,
"_preCacheMode": 2,
"_cacheMode": 2,
"_sockets": [],
@@ -704,7 +704,7 @@
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 72.084,
"y": 89.897,
"z": 0
}
},
@@ -749,8 +749,8 @@
],
"value": {
"__type__": "cc.Vec3",
"x": 1.2,
"y": 1.2,
"x": 1.5,
"y": 1,
"z": 1
}
},
@@ -762,7 +762,7 @@
"propertyPath": [
"_active"
],
"value": false
"value": true
},
{
"__type__": "cc.TargetInfo",
@@ -1194,6 +1194,7 @@
},
"fileId": "fdklpBwCBM/qJ4WFlQF3kT",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": [
{
"__id__": 54

View File

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

View File

@@ -85,7 +85,7 @@
"__id__": 9
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 15
@@ -97,7 +97,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 20,
"z": 0
},
"_lrot": {
@@ -187,7 +187,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 26.24609375,
"width": 31.8076171875,
"height": 54.4
},
"_anchorPoint": {
@@ -226,7 +226,7 @@
"_string": "10",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_actualFontSize": 25,
"_fontSize": 25,
"_fontFamily": "Arial",
"_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 { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { RoleSpine } from "./RoleSpine";
import {BoxSet} from "../common/config/BoxSet"
import {BoxSet, GameSet} from "../common/config/BoxSet"
import { smc } from "../common/SingletonModuleComp";
import { SkillCom } from "../skills/SkillCom";
import { Skill } from "../skills/Skill";
@@ -185,7 +185,7 @@ export class RoleViewComp extends CCComp {
this.in_atk();
this.skill_cds(dt);
this.move(dt);
this.check_enemys()
this.check_enemy_alive()
}
skill_cds(dt:number){
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.skill1.cd <= 0){
this.shoot(this.skill1.uuid);
this.handle_skill(this.skill1.uuid);
this.skill1.cd=this.skill1.cd_max
console.log("shoot uuid :"+this.skill1.uuid);
}
if(this.skill2.cd <= 0){
this.shoot(this.skill2.uuid);
this.handle_skill(this.skill2.uuid);
this.skill2.cd=this.skill2.cd_max
console.log("shoot uuid :"+this.skill2.uuid);
}
if(this.skill3.cd <= 0){
this.shoot(this.skill3.uuid);
this.handle_skill(this.skill3.uuid);
this.skill3.cd=this.skill3.cd_max
console.log("shoot uuid :"+this.skill3.uuid);
}
if(this.skill4.cd <= 0){
this.shoot(this.skill4.uuid);
this.handle_skill(this.skill4.uuid);
this.skill4.cd=this.skill4.cd_max
console.log("shoot uuid :"+this.skill4.uuid);
}
if(this.skill5.cd <= 0){
this.shoot(this.skill5.uuid);
this.handle_skill(this.skill5.uuid);
this.skill5.cd=this.skill5.cd_max
console.log("shoot uuid :"+this.skill5.uuid);
}
@@ -231,25 +231,32 @@ export class RoleViewComp extends CCComp {
// });
// console.log(this.skills);
}
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);
}
handle_skill(uuid:number){
// console.log("handle_skill uuid:"+uuid);
this.as.max();
this.scheduleOnce(()=>{
this.shoot(this.skill);
},0.3)
}
// 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){
if(this.stop_cd > 0){
this.as.idle()
@@ -287,30 +294,40 @@ export class RoleViewComp extends CCComp {
return {pos,t_pos}
}
check_enemy_alive(){
if(this.enemy){
if(!this.enemy.isValid){
return false
let dir = 320
this.enemy = v3(720,this.node.position.y)
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{
return false
this.is_atking=false
}
}
in_atk() {
if(this.atk_time >= this.atk_cd){
// if(this.is_atking&&this.check_enemy_alive()){
// this.atk_time = 0;
// // console.log("atk_cd:"+this.atk_cd);
// this.as.atk();
// this.scheduleOnce(()=>{
// this.shoot(this.skill,-30);
// },0.4)
// }
if(this.is_atking){
this.atk_time = 0;
// console.log("atk_cd:"+this.atk_cd);
this.as.atk();
this.scheduleOnce(()=>{
this.shoot(this.skill,-30,45);
},0.3)
this.shoot(this.skill,-30);
},0.4)
}
// this.atk_time = 0;
// this.as.atk();
// this.scheduleOnce(()=>{
// this.shoot(this.skill,-30,45);
// },0.3)
}
}
@@ -337,7 +354,7 @@ export class RoleViewComp extends CCComp {
return;
}
this.hp += lhp;
this.tooltip(1,hp.toString());
// this.tooltip(1,hp.toString());
if(this.hp > this.hp_max){
this.hp = this.hp_max;
}
@@ -485,12 +502,12 @@ export class RoleViewComp extends CCComp {
in_atked() {
var path = "game/skills/atked";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let pos = v3(0,60)
node.setPosition(pos)
node.parent = this.node;
// var path = "game/skills/atked";
// var prefab: Prefab = oops.res.get(path, Prefab)!;
// var node = instantiate(prefab);
// let pos = v3(0,30)
// node.setPosition(pos)
// node.parent = this.node;
// 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
},
}
export const MonSet = {
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
},
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
},
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
},
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
},
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
},
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
},
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
},

View File

@@ -277,7 +277,6 @@ export class HeroViewComp extends CCComp {
get_hero_pos(hero:any){
let pos =this.skill_pos()
let t_pos:Vec3 = v3(720,0)
console.log("hero.node.isValid",hero);
if(!hero.node.isValid){
return
}else{
@@ -347,11 +346,13 @@ export class HeroViewComp extends CCComp {
}
if(t_hero){ //血量最少单体
if(smc.Role.RoleView){
let role_hp=smc.Role.RoleView.hp_max-smc.Role.RoleView.hp
if(role_hp > least_hp){
least_hp = role_hp
t_hero = smc.Role.RoleView
}
}
this.to_add_buff(t_hero,skill)
}
@@ -451,7 +452,7 @@ export class HeroViewComp extends CCComp {
return;
}
this.hp += lhp;
this.tooltip(1,hp.toString());
// this.tooltip(1,hp.toString());
if(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;
tween(this.node).to(
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()},
easing:"linear"
@@ -45,7 +45,7 @@ export class TooltipCom extends CCComp {
this.node.getChildByName("add_life").active=true;
tween(this.node).to(
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()},
easing:"linear"