MapSpawner.ts 550 B

123456789101112131415161718192021
  1. const {ccclass, property} = cc._decorator;
  2. @ccclass
  3. export class MapSpawner extends cc.Component {
  4. onLoad():void{
  5. let prefabInfos:PrefabInfo[] = [];
  6. for (let i = 0; i < this.node.children.length; i++) {
  7. let child = this.node.children[i];
  8. prefabInfos[i] = {
  9. name: child.name,
  10. position: child.getPosition(),
  11. angle: child.angle,
  12. size: child.getContentSize()
  13. };
  14. }
  15. console.log(JSON.stringify(prefabInfos))
  16. }
  17. }