mirror of
https://github.com/genxium/DelayNoMore
synced 2025-01-01 06:28:11 +00:00
32 lines
881 B
JavaScript
32 lines
881 B
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
|
|
properties: {
|
|
mapNode: {
|
|
type: cc.Node,
|
|
default: null
|
|
},
|
|
|
|
},
|
|
|
|
onLoad () {
|
|
this.mainCamera = this.mapNode.parent.getChildByName("Main Camera").getComponent(cc.Camera);
|
|
this.mapScriptIns = this.mapNode.getComponent("Map");
|
|
},
|
|
|
|
start() {},
|
|
|
|
update(dt) {
|
|
const self = this;
|
|
if (!self.mainCamera) return;
|
|
if (!self.mapScriptIns) return;
|
|
if (!self.mapScriptIns.selfPlayerInfo) return;
|
|
if (!self.mapScriptIns.playerRichInfoDict) return;
|
|
const selfPlayerRichInfo = self.mapScriptIns.playerRichInfoDict[self.mapScriptIns.selfPlayerInfo.id];
|
|
if (!selfPlayerRichInfo) return;
|
|
const selfPlayerNode = selfPlayerRichInfo.node;
|
|
if (!selfPlayerNode) return;
|
|
self.mainCamera.node.setPosition(selfPlayerNode.position);
|
|
}
|
|
});
|