cc
This commit is contained in:
@@ -62,7 +62,7 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
|
||||
};
|
||||
vmAdd() {
|
||||
console.log("dataModelComp vmAdd");
|
||||
console.log("smc vm_data vmAdd");
|
||||
VM.add(this.vm_data, "data");
|
||||
}
|
||||
reset() {
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
/** 碰撞分组 */
|
||||
export enum BoxSet {
|
||||
//物理碰撞tag
|
||||
DEFAULT = 0,
|
||||
MONSTER = 90,
|
||||
HERO = 10,
|
||||
MONSTER_SKILL = 91,
|
||||
HERO_SKILL = 11,
|
||||
DEFAULT = 1,
|
||||
MONSTER = 2,
|
||||
HERO = 4,
|
||||
MONSTER_SKILL = 8,
|
||||
HERO_SKILL = 16,
|
||||
|
||||
BOX_WIDTH = 64,
|
||||
BOX_HEIGHT = 64,
|
||||
|
||||
@@ -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