原来是全局碰撞惹的祸
This commit is contained in:
@@ -4,7 +4,9 @@ import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/m
|
||||
import { smc } from "../../common/SingletonModuleComp";
|
||||
import { Role } from "../../role/Role";
|
||||
import { Niu } from "../../monster/niu/Niu";
|
||||
import { BoxSet } from "../../common/config/BoxSet";
|
||||
import { Hero } from "../../heros/Hero";
|
||||
import { Monster } from "../../monster/Monster";
|
||||
// import MapRoadUtils from "./map/road/MapRoadUtils";
|
||||
import { MapViewScene } from "./MapViewScene";
|
||||
import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
@@ -15,8 +17,7 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('MapView', false)
|
||||
export class MapViewComp extends CCComp {
|
||||
scene: MapViewScene = null!;
|
||||
@property(Prefab)
|
||||
boss: Prefab = null!;
|
||||
|
||||
/** 是否正在转场 */
|
||||
|
||||
|
||||
@@ -55,17 +56,32 @@ export class MapViewComp extends CCComp {
|
||||
|
||||
/** 添加玩家 */
|
||||
private addHero() {
|
||||
|
||||
this.scene.node.active = true
|
||||
|
||||
|
||||
if (smc.monsters.length>0){
|
||||
let monster = ecs.getEntity<Niu>(Niu);
|
||||
monster.load(v3(360,-60),smc.monsters[0].speed);
|
||||
this.addMonster(smc.monsters[0].name,smc.monsters[0].speed)
|
||||
smc.monsters.splice(0,1)
|
||||
}
|
||||
|
||||
// if(smc.heros.length>0) {
|
||||
// this.addMonster(smc.heros[0].name,100)
|
||||
// }
|
||||
}
|
||||
|
||||
private addMonster(name:string = "niu",speed:number = 100) {
|
||||
let monster = null
|
||||
switch (name) {
|
||||
case "niu":
|
||||
monster = ecs.getEntity<Niu>(Niu);
|
||||
break;
|
||||
case "hero":
|
||||
monster = ecs.getEntity<Monster>(Monster);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
monster.load(v3(BoxSet.RIGHT_END,-60),speed);
|
||||
}
|
||||
|
||||
|
||||
private getRandomInt(min: number, max: number): number {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
|
||||
Reference in New Issue
Block a user