diff --git a/assets/script/Main.ts b/assets/script/Main.ts index e2ecf0ed..b582c586 100644 --- a/assets/script/Main.ts +++ b/assets/script/Main.ts @@ -14,7 +14,11 @@ const { ccclass, property } = _decorator; @ccclass('Main') export class Main extends Root { start() { - // PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb + // PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb | + // EPhysics2DDrawFlags.Pair | + // EPhysics2DDrawFlags.CenterOfMass | + // EPhysics2DDrawFlags.Joint | + // EPhysics2DDrawFlags.Shape; } protected async run() { smc.initialize = ecs.getEntity(Initialize); diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index e930ccfe..17b522dc 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -1,4 +1,4 @@ -import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween, Color} from "cc"; +import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween, Color, BoxCollider2D} from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { HeroSpine } from "./HeroSpine"; @@ -121,6 +121,10 @@ export class HeroViewComp extends CCComp { this.on(GameEvent.UpdateHP,this.update_hp,this) this.on(GameEvent.EXPUP,this.exp_up,this) this.on(GameEvent.UseEnhancement,this.use_enhancement,this) + const collider = this.node.getComponent(BoxCollider2D); + this.scheduleOnce(()=>{ + if (collider) collider.enabled = true; // 先禁用 + },2) // let anm = this.node.getChildByName("anm") // anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8); } diff --git a/assets/script/game/hero/Mon.ts b/assets/script/game/hero/Mon.ts index 37fd6663..062280e5 100644 --- a/assets/script/game/hero/Mon.ts +++ b/assets/script/game/hero/Mon.ts @@ -1,4 +1,4 @@ -import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,SpriteAtlas} from "cc"; +import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,SpriteAtlas, BoxCollider2D} from "cc"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { smc } from "../common/SingletonModuleComp"; @@ -40,7 +40,8 @@ export class Monster extends ecs.Entity { var node = instantiate(prefab); var scene = smc.map.MapView.scene; node.parent = scene.entityLayer!.node! - + const collider = node.getComponent(BoxCollider2D); + if (collider) collider.enabled = false; // 先禁用 // 延迟一帧启用碰撞体 node.setPosition(pos) this.hero_init(uuid,node,scale,box_group,is_boss,is_call,lv,rogueBuffData) oops.message.dispatchEvent("monster_load",this) diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index 6fc33555..c5a681f8 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -193,11 +193,12 @@ export class SkillCom extends CCComp { } onBeginContact (seCol: Collider2D, oCol: Collider2D) { - // //console.log(this.scale+"碰撞开始 ",seCol,oCol); + console.log(this.scale+"碰撞开始 ",seCol,oCol); + if(seCol.node.position.x-oCol.node.position.x > 100 ) return let target = oCol.getComponent(HeroViewComp) if(oCol.group!=this.group){ if(target == null) return; - console.log("[SkillCom]:onBeginContact oCol||seCol",oCol.node.position,seCol.node.position) + // console.log("[SkillCom]:onBeginContact oCol||seCol",oCol.node.position,seCol.node.position) this.single_damage(target) // this.ent.destroy() }