ddd
This commit is contained in:
@@ -7,6 +7,7 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -34,6 +35,7 @@ export class SkillCom extends CCComp {
|
||||
box_group:number = 0;
|
||||
box_tag:number=0;
|
||||
type:number = 1;
|
||||
tg:number = 3;
|
||||
in_time:number = 0.3; // 不动技能持续时间
|
||||
enemys:any = [];
|
||||
start() {
|
||||
@@ -46,19 +48,19 @@ export class SkillCom extends CCComp {
|
||||
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);
|
||||
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
}
|
||||
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.group != selfCollider.group&&otherCollider.tag ==0){
|
||||
onBeginContact (seCol: Collider2D, otCol: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otCol.group != seCol.group&&otCol.tag ==0){
|
||||
this.atk_count+=1
|
||||
// console.log("skill onBeginContact",otherCollider.node.getComponent(HeroViewComp).uuid)
|
||||
// let uid=otherCollider.node.getComponent(HeroViewComp).uuid
|
||||
// console.log("skill onBeginContact",otCol.node.getComponent(HeroViewComp).uuid)
|
||||
// let uid=otCol.node.getComponent(HeroViewComp).uuid
|
||||
// const count = this.enemys.filter(enemy => enemy.uid === uid).length;
|
||||
// if(count==0){
|
||||
// // otherCollider.node.getComponent(HeroViewComp).check_uatk(this)
|
||||
// console.log("count==0",otherCollider.node.getComponent(HeroViewComp).uuid)
|
||||
// // otCol.node.getComponent(HeroViewComp).check_uatk(this)
|
||||
// console.log("count==0",otCol.node.getComponent(HeroViewComp).uuid)
|
||||
// this.enemys.push(uid)
|
||||
// }
|
||||
|
||||
@@ -66,13 +68,35 @@ export class SkillCom extends CCComp {
|
||||
if(this.type==1 ){
|
||||
this.is_destroy=true
|
||||
}
|
||||
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
|
||||
// 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)
|
||||
this.do_buff(otCol.node.getComponent(HeroViewComp))
|
||||
}
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
to_console(value:any,value2:any=null,value3:any=null){
|
||||
console.log("["+this.s_name+this.s_uuid+"]:",value,value2,value3)
|
||||
}
|
||||
|
||||
do_buff(hero:any){
|
||||
this.to_console(" do_buff hero: ",hero)
|
||||
if(SkillSet[this.s_uuid].hp > 0){ //buff加血
|
||||
let increase_hp=Math.floor(SkillSet[this.s_uuid].hp*this.ap/(this.in_time/this.cd))
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
|
||||
if(SkillSet[this.s_uuid].apup > 0){ //buff加攻击
|
||||
let increase_atk=Math.floor(SkillSet[this.s_uuid].apup*this.ap/(this.in_time/this.cd))
|
||||
hero.add_ap(increase_atk)
|
||||
}
|
||||
|
||||
if(SkillSet[this.s_uuid].shield > 0){ //buff护盾
|
||||
hero.add_shield(SkillSet[this.s_uuid].shield/(this.in_time/this.cd))
|
||||
}
|
||||
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
Reference in New Issue
Block a user