
import { _decorator, Component, Node, TiledLayer, TiledMap } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('TestTiledMap')
export class TestTiledMap extends Component {
    // [1]
    // dummy = '';
    @property(TiledLayer)
    tiledLayer!:TiledLayer;
    @property(TiledMap)
    tiledMap!:TiledMap;
    // [2]
    // @property
    // serializableDummy = 0;

    start () {
        // [3]
        let mapSize = this.tiledMap.getMapSize();
        for(let i = 0;i<mapSize.width;i++){
            for(let j = 0;j<mapSize.height;j++){
                let tiledGid = this.tiledLayer.getTileGIDAt(i,j);
                let tiledTile = this.tiledLayer.getTiledTileAt(i,j,true);
            }
        }
    }

    // update (deltaTime: number) {
    //     // [4]
    // }
}

/**
 * [1] Class member could be defined like this.
 * [2] Use `property` decorator if your want the member to be serializable.
 * [3] Your initialization goes here.
 * [4] Your update function goes here.
 *
 * Learn more about scripting: https://docs.cocos.com/creator/3.0/manual/en/scripting/
 * Learn more about CCClass: https://docs.cocos.com/creator/3.0/manual/en/scripting/ccclass.html
 * Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.0/manual/en/scripting/life-cycle-callbacks.html
 */
