cb/assets/Script/MapBlock.ts
2026-04-28 15:29:06 +08:00

60 lines
1.4 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 = '';
@property(cc.SpriteAtlas)
riseFall: cc.SpriteAtlas = null;
@property(cc.SpriteAtlas)
buttonIcon: cc.SpriteAtlas = null;
// LIFE-CYCLE CALLBACKS:
posX: number = 0; //地图块的X坐标
posY: number = 0; //地图块的Y坐标
direction: string = ""; //地图块的方向
color: number = -2;
nowColor: number = -1;
onLoad() {
// this.direction = "";
// this.block_Id = "";
}
start() {
// 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;
}
setColor(color) {
this.color = color;
this.nowColor = -1;
}
// update (dt) {}
}