技能修改

This commit is contained in:
pan@work
2024-08-23 17:18:04 +08:00
parent 85d7c7e063
commit 68d7077e56
13 changed files with 693 additions and 245 deletions

View File

@@ -34,10 +34,9 @@ export class Role extends ecs.Entity {
}
/** 加载角色 */
load(uuid:number=101) {
load(pos: Vec3 = Vec3.ZERO,uuid:number=101) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/role";
let pos: Vec3 = Vec3.ZERO
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;

View File

@@ -43,7 +43,8 @@ export class MapViewComp extends CCComp {
}
load_role(){
let role = ecs.getEntity<Role>(Role);
role.load(103)
let pos = v3(0,BoxSet.GAME_LINE)
role.load(pos,108)
}
load_data(){
// let heros = oops.res.get("config/game/heros")

View File

@@ -31,26 +31,35 @@ export class BoxRangComp extends CCComp {
}
}
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE&&otherCollider.tag != BoxSet.SKILL_TAG){
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
// console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
this.MonsterViewComp.is_atking = true;
if(Math.abs(otherCollider.node.position.x-selfCollider.node.position.x) < 120){
this.MonsterViewComp.stop_cd = 0.1
}
}
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE&&otherCollider.tag != BoxSet.SKILL_TAG){
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0 ){
// console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
this.MonsterViewComp.is_atking = false;
}
}
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
console.log("range box group: seft:"+selfCollider.group+"|other:"+otherCollider.group+"| tag: seft:"+selfCollider.tag+"|other:"+otherCollider.tag);
this.MonsterViewComp.is_atking = true;
if(Math.abs(otherCollider.node.position.x-selfCollider.node.position.x) < 120){
this.MonsterViewComp.stop_cd = 0.1
}
}
// }
// onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
// }
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();