|
@@ -6,6 +6,7 @@
|
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
|
|
import { LevelMgr } from "../../Script/levelMgr";
|
|
|
+import { GameLogic } from "./update/logic";
|
|
|
|
|
|
/**
|
|
|
* 怪物类型:
|
|
@@ -25,7 +26,7 @@ const {ccclass, property, executeInEditMode, playOnFocus} = cc._decorator;
|
|
|
@ccclass
|
|
|
@executeInEditMode
|
|
|
@playOnFocus
|
|
|
-export default class MonsterFactory extends cc.Component {
|
|
|
+export default class MonsterFactory extends GameLogic {
|
|
|
|
|
|
@property(cc.Prefab) monster: cc.Prefab = null;
|
|
|
@property(cc.AnimationClip) aniClip:cc.AnimationClip = null;
|
|
@@ -66,7 +67,7 @@ export default class MonsterFactory extends cc.Component {
|
|
|
timeArr = [];
|
|
|
monsterCnt: number;
|
|
|
|
|
|
- protected start(): void {
|
|
|
+ protected onLoad(): void {
|
|
|
this.play();
|
|
|
}
|
|
|
|
|
@@ -126,7 +127,7 @@ export default class MonsterFactory extends cc.Component {
|
|
|
ani.once(cc.Animation.EventType.FINISHED, ()=>{
|
|
|
let nodeBox = node.getBoundingBoxToWorld();
|
|
|
let viewBox = cc.view.getViewportRect();
|
|
|
- console.log(nodeBox, viewBox);
|
|
|
+
|
|
|
if(!viewBox.containsRect(nodeBox)) {
|
|
|
node.destroy();
|
|
|
}
|
|
@@ -137,7 +138,7 @@ export default class MonsterFactory extends cc.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected update(dt: number): void {
|
|
|
+ gameUpdate(dt: number): void {
|
|
|
if(CC_EDITOR) return;
|
|
|
if(this.monsterCnt < this.num) return;
|
|
|
if(this.node.childrenCount > 0) return;
|