WaterControl/assets/Script/Block.ts
2024-07-10 18:35:07 +08:00

52 lines
1.1 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;
export enum BlockType{
/*起点地块 */
Start = 0,
/*普通地块 */
Nomal = 1,
/*湿地 */
Nunja = 2,
/*山峰 */
Peak = 3,
/*息壤 */
Xi_Soil = 4,
/*息壤 */
Construct = 5,
/*终点地块 */
End = 5
}
@ccclass
export default class NewClass extends cc.Component {
// LIFE-CYCLE CALLBACKS:
block_type:number;
finishi:boolean
onLoad () {
this.finishi = false;
}
start () {
}
initData(type){
this.block_type = type;
if(type == cc.Enum(BlockType).Start){
this.node.color = cc.color(245,70,70);
}
else if(type == cc.Enum(BlockType).End){
this.node.color = cc.color(20,255,0);
}
}
// update (dt) {}
}