44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class NewClass extends cc.Component {
|
|
|
|
@property(cc.Label)
|
|
label: cc.Label = null;
|
|
|
|
@property
|
|
block_Id: string = '';
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
posX: number = 0; //地图块的X坐标
|
|
posY: number = 0; //地图块的Y坐标
|
|
direction: string = ""; //地图块的方向
|
|
// onLoad () {}
|
|
|
|
start () {
|
|
this.direction = "";
|
|
this.block_Id = "";
|
|
// this.node.getChildByName("num").getComponent(cc.Label).string = this.direction;
|
|
}
|
|
|
|
setDiraction(direction){
|
|
this.direction = direction;
|
|
// this.node.getChildByName("num").getComponent(cc.Label).string = this.direction;
|
|
}
|
|
|
|
init(posX,posY){
|
|
this.posX = posX;
|
|
this.posY = posY;
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|