|
@@ -71,6 +71,14 @@ export class PlayerMgr {
|
|
tornado.active = visible;
|
|
tornado.active = visible;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //设置玩家出生位置
|
|
|
|
+ async setPlayerPosition() {
|
|
|
|
+ const mapNode = await this.getMapNode();
|
|
|
|
+ const bornPos = mapNode.children[0].getChildByName('bornPos')!;
|
|
|
|
+ const tornado = await this.getTornadoNode();
|
|
|
|
+ tornado.setPosition(bornPos.position);
|
|
|
|
+ }
|
|
|
|
+
|
|
async playerAddComponent(): Promise<void> {
|
|
async playerAddComponent(): Promise<void> {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
this.getTornadoNode().then(node => {
|
|
this.getTornadoNode().then(node => {
|
|
@@ -84,6 +92,15 @@ export class PlayerMgr {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async getMapNode(): Promise<Node> {
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ const map = StormSunderGlobalInstance.instance.map!;
|
|
|
|
+ if (map) {
|
|
|
|
+ resolve(map);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
/** 所有AI玩家配置数据*/
|
|
/** 所有AI玩家配置数据*/
|
|
addAIPlayers() {
|
|
addAIPlayers() {
|
|
for (let id = 1; id <= this.aiConfigCount; id++) {
|
|
for (let id = 1; id <= this.aiConfigCount; id++) {
|