cc
This commit is contained in:
@@ -52,9 +52,9 @@ export class MonsterViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
switch (selfCollider.tag) {
|
||||
switch (selfCollider.group) {
|
||||
case BoxSet.MONSTER:
|
||||
switch (otherCollider.tag){
|
||||
switch (otherCollider.group){
|
||||
case BoxSet.HERO:
|
||||
this.state = 2;
|
||||
console.log('onBeginContact',selfCollider,otherCollider);
|
||||
@@ -70,7 +70,7 @@ export class MonsterViewComp extends CCComp {
|
||||
}
|
||||
break;
|
||||
case BoxSet.HERO:
|
||||
switch (otherCollider.tag){
|
||||
switch (otherCollider.group){
|
||||
case BoxSet.MONSTER:
|
||||
this.state = 2;
|
||||
break;
|
||||
@@ -90,8 +90,8 @@ export class MonsterViewComp extends CCComp {
|
||||
// console.log('onPreSolve');
|
||||
// }
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if (otherCollider.tag === BoxSet.HERO && selfCollider.tag === BoxSet.MONSTER) {
|
||||
// console.log('onPostSolve otherCollider.tag :'+otherCollider.tag);
|
||||
if (otherCollider.group === BoxSet.HERO && selfCollider.group === BoxSet.MONSTER) {
|
||||
// console.log('onPostSolve otherCollider.group :'+otherCollider.group);
|
||||
// this.speed = 0;
|
||||
// this.timer = 1;
|
||||
}
|
||||
@@ -114,9 +114,9 @@ export class MonsterViewComp extends CCComp {
|
||||
label.getComponent(Label)!.string = hero_name;
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if(camp==1){
|
||||
collider.tag=BoxSet.HERO;
|
||||
collider.group=BoxSet.HERO;
|
||||
}else{
|
||||
collider.tag=BoxSet.MONSTER;
|
||||
collider.group=BoxSet.MONSTER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user