This commit is contained in:
2025-01-08 23:59:41 +08:00
parent aa2d915bb3
commit 52cc268368
9 changed files with 213 additions and 142 deletions

View File

@@ -95,6 +95,10 @@ export class SingletonModuleComp extends ecs.Comp {
heros_dead:any = []
hero_pos:any=[]
enemy_pos:any =[]
hero_front_x:number = 0;
hero_back_x:number = 0;
mon_front_x:number = 0;
mon_back_x:number = 0;
vmdata: any = {
name : "纸片精灵大乱斗",
game_over:false,

View File

@@ -1,19 +1,16 @@
/*
type
1 远距离攻击,碰撞后 结束
11远距离攻击从天降下
12远距离攻击目标点显现
2 远距离攻击,碰撞后 持续,直到技能结束
3 远距离攻击,碰撞后 持续,带击退功能
4 双技能技能1技能结束后触发2技能
5: 特殊技能,触发特殊弹窗选项
6: 近距离攻击,碰撞后
9 buff物品
91: 单体buff加最少血临时
92单体buff随机或自己临时
93: 群体buff物品
94role buff
1最前排
2最后排
3: 最少血
4最高血
5近战
6远程
7: 辅助
8: 随机
tg: 对象0 自己1同伴 2 自己和同伴3敌人4自己和对人
dis: 是否移动 1 移动 0 原地
sd 卡片技能图标持续时间
cd 卡片技能释放本技能cd
@@ -24,56 +21,79 @@ sk_uuid:子技能id
sk_count:子技能个数
sp_name : 预制体名称
path: 图片地址
run:number = 0; // 0有目标 带方向1贝塞尔曲线 2 不动 ,3 直线
run:number = 0;0碰撞不消亡 1:碰撞即消亡
debuff: 0depb:50,:无12灼烧3眩晕4降低攻击5降低hp6降低防御7吸血8击退
*/
export enum SkTG {
self = 0,
friend= 1,
team= 2,
enemy= 3,
all= 4,
}
export enum SkType {
frontRow = 1,
backRow = 2,
leastHealth = 3,
highestHealth = 4,
melee = 5,
ranged = 6,
support = 7,
random = 8,
all = 9,
}
export enum skRun {
runing = 0,
dead = 1,
}
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:"释放一个火球术攻击敌人",
6001:{uuid: 6001,path: "6001",run:1,type:1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "寒冰弹",sp_name:"ball_blue",info:"释放一个火球术攻击敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, sonsk:0},
6002:{uuid: 6002,path: "6002",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "火焰弹",sp_name:"ball_red",info:"释放一个火球术攻击敌人",
6002:{uuid: 6002,path: "6002",run:1,type:1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "火焰弹",sp_name:"ball_red",info:"释放一个火球术攻击敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, sonsk:0},
6003:{uuid: 6003,path: "6003",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "魔法弹",sp_name:"ball_green",info:"释放一个火球术攻击敌人",
6003:{uuid: 6003,path: "6003",run:1,type:1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "魔法弹",sp_name:"ball_green",info:"释放一个火球术攻击敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, sonsk:0},
6004:{uuid: 6004,path: "6004",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "圣光弹",sp_name:"ball_yellow",info:"释放一个火球术攻击敌人",
6004:{uuid: 6004,path: "6004",run:1,type:1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "圣光弹",sp_name:"ball_yellow",info:"释放一个火球术攻击敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, sonsk:0},
6005:{uuid: 6005,path: "6005",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "无形剑气",sp_name:"patk",info:"释放无形剑气攻击前方直线100码的敌人",
6005:{uuid: 6005,path: "6005",run:1,type:1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "无形剑气",sp_name:"patk",info:"释放无形剑气攻击前方直线100码的敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,sonsk:0},
6006:{uuid: 6006,path: "6006",type: 1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "射击",sp_name:"arrow",info:"释放无形剑气攻击前方直线100码的敌人",
6006:{uuid: 6006,path: "6006",run:1,type:1,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "射击",sp_name:"arrow",info:"释放无形剑气攻击前方直线100码的敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,sonsk:0},
6011:{uuid: 6011,path: "6011",type: 2,tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "烈火呼吸",sp_name:"firequan",info:"释放烈火剑气攻击前方地方,对前方敌人造成3段伤害",
6011:{uuid: 6011,path: "6011",run:0,type:1, tg:3,debuff:0,depb:50,debtime:2,derate:1,name: "烈火呼吸",sp_name:"firequan",info:"释放烈火剑气攻击前方地方,对前方敌人造成3段伤害",
in:3,count:1,apup:0,ap:2,hp:0,cd:0.5,shield:0,speed:100,sonsk:0},
6012:{uuid: 6012,path: "6012",type: 2,tg:3,debuff:2,depb:50,debtime:6,derate:1,name: "大火球",sp_name:"fire",info:"释放有形剑气攻击前方直线300码的敌人",
6012:{uuid: 6012,path: "6012",run:0,type:1, tg:3,debuff:2,depb:50,debtime:6,derate:1,name: "大火球",sp_name:"fire",info:"释放有形剑气攻击前方直线300码的敌人",
in:1,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,sonsk:0},
6013:{uuid: 6013,path: "6013",type: 2,tg:3,debuff:7,depb:50,debtime:2,derate:0.01,name: "火墙",sp_name:"fires",info:"释放有形剑气攻击前方直线300码的敌人",
6013:{uuid: 6013,path: "6013",run:0,type:1, tg:3,debuff:7,depb:50,debtime:2,derate:0.01,name: "火墙",sp_name:"fires",info:"释放有形剑气攻击前方直线300码的敌人",
in:10,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450,sonsk:0},
6014:{uuid: 6014,path: "6014",type: 2,tg:3,debuff:1,depb:50,debtime:2,derate:1,name: "冰破术",sp_name:"ice",info:"释放有形剑气攻击前方直线300码的敌人",
6014:{uuid: 6014,path: "6014",run:0,type:1, 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,sonsk:0},
6015:{uuid: 6015,path: "6015",type: 2,tg:3,debuff:3,depb:50,debtime:6,derate:1,name: "火焰射击",sp_name:"arrow_yellow",info:"释放有形剑气攻击前方直线300码的敌人",
6015:{uuid: 6015,path: "6015",run:0,type:1, tg:3,debuff:3,depb:50,debtime:6,derate:1,name: "火焰射击",sp_name:"arrow_yellow",info:"释放有形剑气攻击前方直线300码的敌人",
in:1,count:1,apup:0,ap:2,hp:0,cd:1,shield:0,speed:450,sonsk:0},
6016:{uuid: 6016,path: "6016",type: 2,tg:3,debuff:8,depb:50,debtime:6,derate:1,name: "龙卷风",sp_name:"bwind",info:"释放有形剑气攻击前方直线300码的敌人",
6016:{uuid: 6016,path: "6016",run:0,type:1, tg:3,debuff:8,depb:50,debtime:6,derate:1,name: "龙卷风",sp_name:"bwind",info:"释放有形剑气攻击前方直线300码的敌人",
in:1,count:1,apup:0,ap:2,hp:0,cd:1,shield:0,speed:300,sonsk:0},
6017:{uuid: 6017,path: "6017",type: 91,tg:2,debuff:0,depb:50,debtime:2,derate:1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
6017:{uuid: 6017,path: "6017",run:0,type:1, tg:2,debuff:0,depb:50,debtime:2,derate:1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
in:10,count:1,apup:0,ap:1,hp:3,cd:1,shield:0,speed:450, sonsk:0},
6018:{uuid: 6018,path: "6018",type: 91,tg:0,debuff:0,depb:50,debtime:2,derate:1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
6018:{uuid: 6018,path: "6018",run:0,type:1, tg:0,debuff:0,depb:50,debtime:2,derate:1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:1,speed:450, sonsk:0},
6019:{uuid: 6019,path: "6019",type: 91,tg:0,debuff:0,depb:50,debtime:2,derate:1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
6019:{uuid: 6019,path: "6019",run:0,type:1, tg:0,debuff:0,depb:50,debtime:2,derate:1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
in:0.8,count:1,apup:0,ap:1,hp:0,cd:1,shield:0,speed:450, sonsk:0},
6020:{uuid: 6020,path: "6014",type: 81,tg:3,debuff:0,depb:50,debtime:0,derate:0,name: "阻击",sp_name:"okill",info:"释放有形剑气攻击前方直线300码的敌人",
6020:{uuid: 6020,path: "6014",run:2,type:2,tg:3,debuff:0,depb:50,debtime:0,derate:0,name: "阻击",sp_name:"okill",info:"释放有形剑气攻击前方直线300码的敌人",
in:1,count:1,apup:0,ap:2,hp:0,cd:1,shield:0,speed:450,sonsk:0},

View File

@@ -46,6 +46,16 @@ import { Talents } from "./TalentSet"
* lv : 1 精英 2史诗 3 传说
* kind 1 火 2 水 3 气
**/
export enum HeroKind {
fire = 1,
water = 2,
air = 3,
}
export enum HeroType {
fire = 1,
water = 2,
air = 3,
}
export const HeroInfo = {
//坦克, 高防 攻击时有可能冲击目标造成70% 攻击伤害
5001: {

View File

@@ -17,13 +17,15 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
import { Skill } from "../skills/Skill";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { SkillCom } from "../skills/SkillCom";
import { SkillSet } from "../common/config/SkillSet";
import { SkillSet, SkTG, SkType } from "../common/config/SkillSet";
import { Tooltip } from "../skills/Tooltip";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { TimerManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/TimerManager";
import { HeroSet } from "../common/config/heroSet";
import { BuffComp } from "./BuffComp";
import { BossList } from "../common/config/MissionSet";
import { Monster } from "./Mon";
import { MonModelComp } from "./MonModelComp";
const { ccclass, property } = _decorator;
/** 角色显示组件 */
@@ -272,28 +274,30 @@ export class HeroViewComp extends CCComp {
}
}
check_enemy_alive(){
let dir = 720
let enemys=smc.enemy_pos
this.enemy = v3(720,this.node.position.y)
// let dir = 720
// let enemys=smc.enemy_pos
// this.enemy = v3(720,this.node.position.y)
// if(this.box_group == BoxSet.MONSTER){
// enemys=smc.hero_pos
// // console.log("MONSTER enemys",enemys);
// this.enemy=v3(-720,this.node.position.y)
// }
// for (let i = 0; i < enemys.length; i++) {
// let ho:any = enemys[i];
// let x=Math.abs(ho.x-this.node.position.x)
// if(x < dir){
// dir = x
// this.enemy = ho
// }
// }
let dir = Math.abs(smc.mon_front_x-this.node.position.x)
if(this.box_group == BoxSet.MONSTER){
enemys=smc.hero_pos
// console.log("MONSTER enemys",enemys);
this.enemy=v3(-720,this.node.position.y)
dir = Math.abs(smc.hero_front_x-this.node.position.x)
}
for (let i = 0; i < enemys.length; i++) {
let ho:any = enemys[i];
let x=Math.abs(ho.x-this.node.position.x)
if(x < dir){
dir = x
this.enemy = ho
}
}
if(dir < this.dis){
this.is_atking=true
if(this.dis-dir > 80 &&this.type > 0 ) this.stop_cd = 0.1
if(dir < 65 &&this.type == 0 ) this.stop_cd = 0.1
}else{
this.is_atking=false
}
@@ -322,6 +326,14 @@ export class HeroViewComp extends CCComp {
console.log(this.hero_name+":"+this.uuid+"enemy ="+this.enemy.x+" x"+this.node.position.x+" t_pos"+t_pos);
return t_pos
}
get_back_enemy_pos(hero:any){
let t_pos:Vec3 = v3(720,0)
if(this.enemy){
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}
}
get_hero_pos(hero:any){
let t_pos:Vec3 = v3(-720,0)
if(!hero.node.isValid){
@@ -530,21 +542,20 @@ export class HeroViewComp extends CCComp {
this.as.max()
this.at = 0;
this.BUFFCOMP.tooltip(3,SkillSet[skill].name,skill);
switch (SkillSet[skill].tg) {
case 0: //自己
case SkTG.self: //自己
this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
break;
case 1: //伙伴
case SkTG.friend: //伙伴
this.check_other_buff(skill)
break;
case 2: //自己和伙伴
case SkTG.team: //自己和伙伴
this.do_all_buff(skill)
break;
case 3: //敌人
case SkTG.enemy: //敌人
this.shoot_enemy(skill)
break;
case 4: //敌人和自己
case SkTG.all: //敌人和自己
this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
this.shoot_enemy(skill)
break;
@@ -555,9 +566,15 @@ export class HeroViewComp extends CCComp {
check_other_buff(skill:number){
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let least_hp:number=0
let hight_hp:number=9999999999
let right_x:number=360
let left_x:number=-360
if(this.box_group==BoxSet.MONSTER){
heros=ecs.query(ecs.allOf(MonModelComp))
}
let t_hero:any= null
if (heros.length > 0) {
if(SkillSet[skill].type==92){ //随机添加buff
if(SkillSet[skill].type==SkType.random){ //随机添加buff
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
while(!heros[i].HeroView){
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
@@ -570,12 +587,68 @@ export class HeroViewComp extends CCComp {
for (let i = 0; i < heros.length; i++) {
if(!heros[i].HeroView) continue
let hero = heros[i].HeroView;
if(SkillSet[skill].type==91){ //血量最少单体
if((hero.rhp_max-hero.hp) > least_hp){
least_hp = (hero.rhp_max-hero.hp)
t_hero = hero
}
switch(SkillSet[skill].type){
case SkType.leastHealth: //血量最少单体
if((hero.rhp_max-hero.hp) > least_hp){
least_hp = (hero.rhp_max-hero.hp)
t_hero = hero
}
break;
case SkType.highestHealth: //血量最多单体
if((hero.rhp_max-hero.hp) < hight_hp){
hight_hp = (hero.rhp_max-hero.hp)
t_hero = hero
}
break;
case SkType.frontRow: //最前排
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
t_hero = hero
}
if(this.box_group==BoxSet.MONSTER){
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
t_hero = hero
}
}
break;
case SkType.backRow: //最后排
if(hero.node.position.x < right_x){
right_x = hero.node.position.x
t_hero = hero
}
if(this.box_group==BoxSet.MONSTER){
if(hero.node.position.x > left_x){
left_x = hero.node.position.x
t_hero = hero
}
}
break;
}
// if(SkillSet[skill].type==SkType.leastHealth){ //血量最少单体
// if((hero.rhp_max-hero.hp) > least_hp){
// least_hp = (hero.rhp_max-hero.hp)
// t_hero = hero
// }
// }
// if(SkillSet[skill].type==SkType.highestHealth){ //血量最多单体
// if((hero.rhp_max-hero.hp) < hight_hp){
// hight_hp = (hero.rhp_max-hero.hp)
// t_hero = hero
// }
// }
// if(SkillSet[skill].type==SkType.frontRow){ //最前排
// if(hero.node.position.x > left_x){
// left_x = hero.node.position.x
// t_hero = hero
// }
// }
// if(SkillSet[skill].type==SkType.backRow){ //最后排
// if(hero.node.position.x < right_x){
// right_x = hero.node.position.x
// t_hero = hero
// }
// }
//todo 最前排 最后排 远程 近战 辅助
}
if(t_hero){ //存在目标
@@ -585,7 +658,6 @@ export class HeroViewComp extends CCComp {
}
}
}
do_all_buff(sk:number){
let skill = ecs.getEntity<Skill>(Skill);
@@ -602,16 +674,30 @@ export class HeroViewComp extends CCComp {
shoot_enemy(sk:number,y:number=0,x:number=0){
// console.log("mon shoot_enemy");
let skill = ecs.getEntity<Skill>(Skill);
let t_pos=this.get_enemy_pos()
if(SkillSet[sk].type==81){
//获取最远敌军位置
let t_pos=v3(smc.mon_front_x,BoxSet.GAME_LINE)
if(this.box_group==BoxSet.MONSTER){
t_pos=v3(smc.hero_front_x,BoxSet.GAME_LINE)
}
switch(SkillSet[sk].type){
case SkType.leastHealth: //血量最少单体
break;
case SkType.highestHealth: //血量最多单体
break;
case SkType.backRow: //最后排
t_pos=v3(smc.mon_back_x,BoxSet.GAME_LINE)
if(this.box_group==BoxSet.MONSTER){
t_pos=v3(smc.hero_back_x,BoxSet.GAME_LINE)
}
break;
}
let pos =this.skill_pos()
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);
this.to_console(this.scale+this.hero_name+"使用技能:"+sk+" t_pos:"+t_pos+" box:"+this.box_group,);
this.to_console(this.scale+this.hero_name+"使用技能:"+sk+SkillSet[sk].name+" t_pos:"+t_pos+" box:"+this.box_group,);
}
do_add_buff(hero:any,sk:number){
let skill = ecs.getEntity<Skill>(Skill);
@@ -620,7 +706,7 @@ export class HeroViewComp extends CCComp {
this.to_console("do_add_buff:"+hero.hero_name+" "+sk);
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);
this.to_console(this.scale+this.hero_name+"使用buff:"+sk+" t_pos:"+t_pos+" box:"+this.box_group,);
this.to_console(this.scale+this.hero_name+"使用buff:"+sk+SkillSet[sk].name+" t_pos:"+t_pos+" box:"+this.box_group,);
}
exp_add(exp:number=0){
@@ -720,8 +806,8 @@ export class HeroViewComp extends CCComp {
this.node.setPosition(pos)
}
to_console(value:any){
console.log("["+this.scale+this.hero_name+']'+value)
to_console(value:any,value2:any=null,value3:any=null){
console.log("["+this.scale+this.hero_name+']'+value,value2,value3)
}
reset() {
this.is_dead = false;

View File

@@ -234,20 +234,42 @@ export class MissionComp extends CCComp {
return ecs.query(ecs.allOf(HeroModelComp))
}
count_mon_pos(){
let right_x:number=360
let left_x:number=-360
let monsters:any= this.get_mons()
for(let i=0;i<monsters.length;i++){
if(monsters[i].HeroView == undefined) return
let mon:any = monsters[i].HeroView.node.position
smc.enemy_pos[i]= mon
if(monsters[i].HeroView.node.position.x > left_x){
left_x = monsters[i].HeroView.node.position.x
}
if(monsters[i].HeroView.node.position.x < right_x){
right_x = monsters[i].HeroView.node.position.x
}
}
smc.mon_front_x=right_x
smc.mon_back_x=left_x
// console.log("count_mon_pos",smc.mon_pos,smc.mon_front_x,smc.mon_back_x)
}
count_hero_pos(){
let right_x:number=360
let left_x:number=-360
let heros:any= this.get_heros()
for(let i=0;i<heros.length;i++){
if(heros[i].HeroView == undefined) return
let ho:any = heros[i].HeroView.node.position
smc.hero_pos[i]= ho
if(heros[i].HeroView.node.position.x > left_x){
left_x = heros[i].HeroView.node.position.x
}
if(heros[i].HeroView.node.position.x < right_x){
right_x = heros[i].HeroView.node.position.x
}
}
smc.hero_front_x=left_x
smc.hero_back_x=right_x
// console.log("count_hero_pos",smc.hero_pos,smc.hero_front_x,smc.mon_front_x)
}
mon_refresh(){

View File

@@ -51,6 +51,7 @@ export class Skill extends ecs.Entity {
sv.debuff = SkillSet[uuid].debuff;
sv.depb = SkillSet[uuid].depb;
sv.derate = SkillSet[uuid].derate;
sv.run = SkillSet[uuid].run;
sv.is_crit=is_crit
sv.crit_add=crit_add
// node.setScale(v3(node.scale.x*scale,node.scale.y))

View File

@@ -35,6 +35,7 @@ export class SkillCom extends CCComp {
box_group:number = 0;
box_tag:number=0;
type:number = 1;
run:number = 0;
tg:number = 3;
in_time:number = 0.3; // 不动技能持续时间
enemys:any = [];
@@ -65,13 +66,9 @@ export class SkillCom extends CCComp {
// }
if(this.type==1 ){
if(this.run==1 ){
this.is_destroy=true
}
// console.log("skill onBeginContact",seCol.group,otCol.group)
// if(this.type==1 ){
// this.is_destroy=true
// }
}
if(otCol.group == seCol.group&&otCol.tag ==0&&this.tg==2){
this.to_console("skill onBeginContact 是对自己人的buff",seCol,otCol)

View File

@@ -1,60 +0,0 @@
import { _decorator, Component, Node, tween ,Vec3,v3,Collider2D,Contact2DType} from 'cc';
import { BoxSet } from '../common/config/BoxSet';
import { Timer } from 'db://oops-framework/core/common/timer/Timer';
const { ccclass, property } = _decorator;
@ccclass('baseCom')
export class baseCom extends Component {
s_uuid:number = 0;
speed:number = 200;
y_speed:number = 0;
x_speed:number = 0;
dis:number = 80;
scale:number = 1;
ap:number = 10;
atk_count:number = 0;
is_crit:boolean = false;
crit_add: number = 0;//暴击伤害加成
angle:number = 0;
t_pos:Vec3 = v3(0,0,0); // 目标增量
is_destroy:boolean = false;
box_group:number = 0;
box_tag:number=0;
type:number = 1;
time:Timer = new Timer(0.01);
run_type:number = 0; // 0有目标 带方向1贝塞尔曲线 2 不动 ,3 直线
in_time:number = 0.3; // 不动技能持续时间
start() {
console.log("baseCom start")
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
collider.tag = this.box_tag;
collider.sensor = true;
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
}
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D) {
if(otherCollider.group != selfCollider.group&&otherCollider.tag ==0){
this.atk_count+=1
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
if(this.type==1 ){
this.is_destroy=true
}
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
}
reset() {
this.node.destroy();
}
update(deltaTime: number) {
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "89c1ceaf-2ca4-4954-88e7-542fae21fa14",
"files": [],
"subMetas": {},
"userData": {}
}