假期修改

This commit is contained in:
2024-09-18 12:45:05 +08:00
parent 2095393757
commit cd0dc9fe7c
79 changed files with 7383 additions and 1449 deletions

View File

@@ -26,10 +26,10 @@ export class BoxRangComp extends CCComp {
this.MonViewComp=this.Hero_node.getComponent(MonViewComp);
// console.log("range box",this.MonViewComp);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, 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) {
@@ -59,7 +59,6 @@ export class BoxRangComp extends CCComp {
// console.log("onPreSolve b:"+selfCollider.node.parent.getSiblingIndex()+"/"+otherCollider.node.parent.getSiblingIndex());
// }
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
let scene =smc.map.MapView.scene.mapLayer!.node!
let other_pos = otherCollider.node.getWorldPosition() ;
let self_pos = this.node.getWorldPosition();
// console.log("onPreSolve:",self_pos,other_pos);

View File

@@ -58,7 +58,7 @@ export class MonViewComp extends CCComp {
skill_name: string = "base"; //技能名称
max_skill_name: string = "base"; //大技能名称
skill_uuid:number = 9001;
max_skill_uuid:number = 1001;
max_skill_uuid:number = 0;
atk: number = 10; /**攻击力 */
// atk_speed: number = 1;
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
@@ -114,9 +114,9 @@ export class MonViewComp extends CCComp {
collider.group = this.box_group;
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
// this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = this.level.toString();
@@ -149,7 +149,7 @@ export class MonViewComp extends CCComp {
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
}
@@ -162,12 +162,19 @@ export class MonViewComp extends CCComp {
this.in_shield(dt);
this.in_stop(dt);
this.in_atk(dt);
this.hp_show()
this.move(dt);
// if(this.m_timer.update(dt)){
// this.move_to()
// }
}
hp_show(){
if(this.hp == this.hp_max){
this.node.getChildByName("top").getChildByName("hp").active = false;
} else{
this.node.getChildByName("top").getChildByName("hp").active = true;
}
}
move(dt: number){
if(this.stop_cd > 0){
return
@@ -188,6 +195,9 @@ export class MonViewComp extends CCComp {
move.speed = this.ospeed;
}
power_change(power: number){
if(this.max_skill_uuid == 0){
return
}
this.power += power;
if(this.power >= this.power_max&&this.check_enemy_alive()){
this.as.atk()
@@ -212,9 +222,7 @@ export class MonViewComp extends CCComp {
}
//使用max_skill
do_max_skill(){
for(let i=0;i<smc.skills[this.max_skill_uuid].count;i++){
this.shoot(this.max_skill_uuid)
}
this.shoot(this.max_skill_uuid)
}
to_speek(words:string,time:number=0.5){
this.speek_time=0.5