dd
This commit is contained in:
@@ -31,6 +31,11 @@ export class MonsterViewComp extends CCComp {
|
||||
speed: number = 100;
|
||||
/** 角色初始速度 */
|
||||
ospeed: number = 100;
|
||||
/**攻击速度 */
|
||||
atk_speed: number = 2;
|
||||
atk_cd: number = 0;
|
||||
/** 状态 1:move ,2: act 3: stop */
|
||||
state: number = 1;
|
||||
|
||||
Tpos: Vec3 = v3(0,-60,0);
|
||||
timer: number = 0;
|
||||
@@ -52,9 +57,10 @@ export class MonsterViewComp extends CCComp {
|
||||
case BoxSet.MONSTER:
|
||||
switch (otherCollider.tag){
|
||||
case BoxSet.HERO:
|
||||
this.state = 2;
|
||||
// console.log("im monster other is hero");
|
||||
this.speed = 0;
|
||||
this.timer = 1;
|
||||
// this.speed = 0;
|
||||
// this.timer = 1;
|
||||
// console.log("speed:"+this.speed+" | timer:"+this.timer);
|
||||
break;
|
||||
case BoxSet.HERO_SKILL:
|
||||
@@ -67,7 +73,7 @@ export class MonsterViewComp extends CCComp {
|
||||
case BoxSet.HERO:
|
||||
switch (otherCollider.tag){
|
||||
case BoxSet.MONSTER:
|
||||
|
||||
this.state = 2;
|
||||
break;
|
||||
case BoxSet.HERO_SKILL:
|
||||
|
||||
@@ -119,7 +125,7 @@ export class MonsterViewComp extends CCComp {
|
||||
|
||||
this.in_destroy();
|
||||
this.in_stop(dt);
|
||||
|
||||
this.in_act(dt);
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.as.walk();
|
||||
@@ -133,9 +139,19 @@ export class MonsterViewComp extends CCComp {
|
||||
this.update_pos();
|
||||
|
||||
}
|
||||
|
||||
move(dt: number){
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.camp, this.node.position.y, this.node.position.z);
|
||||
}
|
||||
in_act(dt: number) {
|
||||
if(this.atk_cd >= this.atk_speed){
|
||||
this.atk_cd = 0;
|
||||
this.as.atk();
|
||||
}
|
||||
if(this.state == 2){
|
||||
this.atk_cd += dt;
|
||||
}
|
||||
}
|
||||
/** 静止时间 */
|
||||
in_stop (dt: number) {
|
||||
if(this.timer > 0){
|
||||
|
||||
Reference in New Issue
Block a user