|
@@ -0,0 +1,47 @@
|
|
|
+import { assetManager, instantiate, Prefab, Node, UITransform, Vec3, Vec2, view, game, PhysicsSystem, geometry } from "cc";
|
|
|
+import { resLoader } from "db://assets/core_tgx/base/ResLoader";
|
|
|
+import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
|
|
|
+import { TornadoComponent } from "../Component/TornadoComponent";
|
|
|
+
|
|
|
+const propRes = [
|
|
|
+ "Prefabs/Props/altman",
|
|
|
+ "Prefabs/Props/aula",
|
|
|
+ "Prefabs/Props/clown",
|
|
|
+]
|
|
|
+
|
|
|
+/** 龙卷风管理器*/
|
|
|
+export class PlayerMgr {
|
|
|
+ private static _instance: PlayerMgr;
|
|
|
+ public static get Instance(): PlayerMgr {
|
|
|
+ if (this._instance == null) {
|
|
|
+ this._instance = new PlayerMgr();
|
|
|
+ }
|
|
|
+ return this._instance;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static get inst(): PlayerMgr {
|
|
|
+ return this.Instance;
|
|
|
+ }
|
|
|
+
|
|
|
+ public tornadoNode: Node = null;//玩家节点
|
|
|
+
|
|
|
+ public genaratorInitialData() {
|
|
|
+ //DOTO 取配置 先定义假数据
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取玩家龙卷风节点
|
|
|
+ async getTornadoNode(): Promise<Node> {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (this.tornadoNode) {
|
|
|
+ resolve(this.tornadoNode);
|
|
|
+ } else {
|
|
|
+ const playersUI = StormSunderGlobalInstance.instance.players!;
|
|
|
+ if (playersUI && playersUI.children.length > 0)
|
|
|
+ this.tornadoNode = playersUI.children.filter(child => child.getComponent(TornadoComponent))[0];
|
|
|
+
|
|
|
+ resolve(this.tornadoNode);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|