技能layer改变,位置信息修改

This commit is contained in:
2025-01-07 07:54:29 +08:00
parent a9a7f076f4
commit ca5adce589
16 changed files with 75 additions and 536 deletions

View File

@@ -12,4 +12,6 @@ export enum GameEvent {
/** 登陆成功 */
LoginSuccess = "LoginSuccess",
MSSelected = "MSSelected",
MissionStart = "MissionStart",
MissionEnd = "MissionEnd",
}

View File

@@ -29,22 +29,22 @@ debuff: 0depb:50,:无12灼烧3眩晕4降低攻击5
*/
export const SkillSet={
6001:{uuid: 6001,path: "6001",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "寒冰弹",sp_name:"ball_blue",info:"释放一个火球术攻击敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
6002:{uuid: 6002,path: "6002",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "火焰弹",sp_name:"ball_red",info:"释放一个火球术攻击敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
6003:{uuid: 6003,path: "6003",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "魔法弹",sp_name:"ball_green",info:"释放一个火球术攻击敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
6004:{uuid: 6004,path: "6004",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "圣光弹",sp_name:"ball_yellow",info:"释放一个火球术攻击敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
6005:{uuid: 6005,path: "6005",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "无形剑气",sp_name:"patk",info:"释放无形剑气攻击前方直线100码的敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,},
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,},
6006:{uuid: 6006,path: "6006",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "射击",sp_name:"arrow",info:"释放无形剑气攻击前方直线100码的敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,},
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,},
6011:{uuid: 6011,path: "6011",type: 2,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "有形剑气",sp_name:"dadao",info:"释放有形剑气攻击前方直线300码的敌人",
in:1,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,},
@@ -53,7 +53,7 @@ export const SkillSet={
in:1,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,},
6013:{uuid: 6013,path: "6013",type: 2,tg:3,debuff:7,depb:50,debtime:2,derate:0.01,name: "火墙",sp_name:"fires",info:"释放有形剑气攻击前方直线300码的敌人",
in:5,count:1,apup:0,ap:1,hp:0,cd:2,shield:0,speed:450,},
in:10,count:1,apup:0,ap:1,hp:0,cd:2,shield:0,speed:450,},
6014:{uuid: 6014,path: "6014",type: 2,tg:3,debuff:1,depb:50,debtime:2,derate:1,name: "冰破术",sp_name:"ice",info:"释放有形剑气攻击前方直线300码的敌人",
in:1,count:1,apup:0,ap:2,hp:0,cd:1,shield:0,speed:450,},
@@ -68,10 +68,10 @@ export const SkillSet={
in:0.5,count:1,apup:0,ap:1,hp:3,shield:0,speed:450, },
6018:{uuid: 6018,path: "6018",type: 91,tg:0,debuff:0,depb:50,debtime:2,derate:1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:1,speed:450, },
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:1,speed:450, },
6019:{uuid: 6019,path: "6019",type: 91,tg:0,debuff:0,depb:50,debtime:2,derate:1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
in:0.2,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, },
}

View File

@@ -4,6 +4,7 @@ import { oops } from 'db://oops-framework/core/Oops';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
import { Tooltip } from '../skills/Tooltip';
import { timedCom } from '../skills/timedCom';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('BuffComp')
@@ -40,6 +41,7 @@ export class BuffComp extends Component {
}
update(deltaTime: number) {
if(smc.mission.pause) return
if(this.ap_cd > 0 ) this.ap_cd -= deltaTime;
if(this.ap_cd <= 0 && this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active){
this.node.getChildByName("top").getChildByName("buff").getChildByName("ap").active = false;

View File

@@ -1,10 +1,4 @@
/*
* @Author: dgflash
* @Date: 2021-11-18 17:47:56
* @LastEditors: dgflash
* @LastEditTime: 2022-08-04 15:43:04
*/
import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,SpriteAtlas} from "cc";
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";

View File

@@ -312,13 +312,12 @@ export class HeroViewComp extends CCComp {
}
skill_pos(){
return v3(0,35)
return v3((this.node.position.x,this.node.position.y + 35))
}
get_enemy_pos(){
let t_pos:Vec3 = v3(720,0)
if(this.enemy){
t_pos = v3(this.enemy.x-this.node.position.x,this.enemy.y-this.node.position.y)
t_pos = v3(this.enemy.x,this.enemy.y)
}
console.log(this.hero_name+":"+this.uuid+"enemy ="+this.enemy.x+" x"+this.node.position.x+" t_pos"+t_pos);
return t_pos
@@ -328,7 +327,7 @@ export class HeroViewComp extends CCComp {
if(!hero.node.isValid){
return
}else{
t_pos = v3(hero.node.position.x-this.node.position.x,hero.node.position.y-this.node.position.y)
t_pos = v3(hero.node.position.x,hero.node.position.y)
}
return t_pos
@@ -555,8 +554,8 @@ export class HeroViewComp extends CCComp {
let skill = ecs.getEntity<Skill>(Skill);
let t_pos=this.get_enemy_pos()
let pos =this.skill_pos()
pos.y=pos.y + y
pos.x=pos.x + x
pos.y=this.node.position.y + y
pos.x=this.node.position.x + x
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
console.log(this.scale+this.hero_name+"使用技能:"+sk+" t_pos:"+t_pos+" box:"+this.box_group,);

View File

@@ -26,6 +26,7 @@ import { Monster } from "../hero/Mon";
import { UIID } from "../common/config/GameUIConfig";
import { CardControllerComp } from "./CardController";
import { MissionHomeComp } from "./MissionHomeComp";
import { GameEvent } from "../common/config/GameEvent";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -84,6 +85,7 @@ export class MissionComp extends CCComp {
}
mission_end(){
oops.message.dispatchEvent(GameEvent.MissionEnd)
smc.mission.play=false
smc.mission.pause=false
let heros:any= this.get_heros();;

View File

@@ -1,27 +1,28 @@
import { _decorator, Component, Node, tween, v3, Vec3 } from 'cc';
import { SkillCom } from './SkillCom';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('BezCom')
export class BezCom extends Component {
start() {
let base =this.node.getComponent(SkillCom)
if(this.node.parent.scale.x < 0){
base.t_pos.x=base.t_pos.x*-1
}
let s_pos = v3(this.node.position.x,this.node.position.y)
let c_pos = v3((base.t_pos.x+this.node.position.x)/2,this.node.position.y+100)
let e_pos = v3(this.node.position.x+base.t_pos.x,this.node.position.y+base.t_pos.y)
// if(this.node.parent.scale.x < 0){
// base.t_pos.x=base.t_pos.x*-1
// }
let s_pos = v3(this.node.position.x,this.node.position.y+35)
let c_pos = v3((base.t_pos.x+this.node.position.x)/2,this.node.position.y+200)
let e_pos = v3(base.t_pos.x,this.node.position.y+50)
let time =Math.abs(base.t_pos.x/base.speed)
BezCom.bezierTo(this.node,time,s_pos,c_pos,e_pos,{
BezCom.bezierTo(this.node,base.in_time,s_pos,c_pos,e_pos,{
onComplete: (target?: object) => {
base.is_destroy=true
},
},
}).start();
}
update(deltaTime: number) {
if(smc.mission.pause) return
}
public static bezierTo(target: any, duration: number, c1: Vec3, c2: Vec3, to: Vec3, opts: any) {

View File

@@ -1,5 +1,6 @@
import { _decorator, Component, Node, tween, v3, Vec3 } from 'cc';
import { SkillCom } from './SkillCom';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('LineCom')
@@ -11,6 +12,7 @@ export class LineCom extends Component {
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime,this.node.position.y,this.node.position.z)
if(this.node.position.x>1000||this.node.position.x<-1000){
this.base.is_destroy = true

View File

@@ -29,8 +29,9 @@ export class Skill extends ecs.Entity {
// console.log("load skill :",path,prefab)
var node = instantiate(prefab);
pos=v3(pos.x,pos.y)
node.parent = parent;
node.parent = parent.parent;
node.setPosition(pos)
if(group==BoxSet.MONSTER) node.setScale(v3(-1*node.scale.x,node.scale.y));
var sv = node.getComponent(SkillCom);
// let angle=0
// if(SkillSet[uuid].angle){
@@ -54,7 +55,7 @@ export class Skill extends ecs.Entity {
// node.setScale(v3(node.scale.x*scale,node.scale.y))
sv.speed=SkillSet[uuid].speed;
sv.in_time=SkillSet[uuid].in;
// if(group==BoxSet.MONSTER) t_pos.x=-1*t_pos.x
sv.t_pos = t_pos; // 目标增量
sv.type = SkillSet[uuid].type;
sv.box_tag= BoxSet.SKILL_TAG;

View File

@@ -5,6 +5,8 @@ import { BoxSet } from "../common/config/BoxSet";
import { smc } from "../common/SingletonModuleComp";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { HeroViewComp } from "../hero/HeroViewComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
const { ccclass, property } = _decorator;
@@ -35,6 +37,7 @@ export class SkillCom extends CCComp {
in_time:number = 0.3; // 不动技能持续时间
enemys:any = [];
start() {
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
this.node.active=true
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
@@ -73,7 +76,7 @@ export class SkillCom extends CCComp {
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.toDestroy()
}
@@ -82,6 +85,9 @@ export class SkillCom extends CCComp {
this.ent.destroy()
}
}
doDestroy(){
this.is_destroy=true
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.is_destroy=false

View File

@@ -1,6 +1,7 @@
import { _decorator, Component, Node, v3 } from 'cc';
import { SkillCom } from './SkillCom';
import { BoxSet } from '../common/config/BoxSet';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('TgCom')
@@ -10,13 +11,11 @@ export class TgCom extends Component {
base:SkillCom = null
start() {
this.base =this.node.getComponent(SkillCom)
if(this.base.box_group==BoxSet.MONSTER){
this.base.t_pos.x=-1*this.base.t_pos.x
}
this.node.setPosition(this.base.t_pos)
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd+=deltaTime
if(this.cd>=1){
// this.node.setPosition(v3(-1000,0,0))

View File

@@ -1,6 +1,7 @@
import { _decorator, Component, Node } from 'cc';
import { timedCom } from './timedCom';
import { HeroViewComp } from '../hero/HeroViewComp';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('debuff')
@@ -16,6 +17,7 @@ export class debuff extends Component {
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd += deltaTime
if(this.cd >=1){
// this.node.setPosition(v3(-1000,0,0))

View File

@@ -1,5 +1,6 @@
import { _decorator, Component, Node } from 'cc';
import { SkillSet } from '../common/config/SkillSet';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('timedCom')