You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class FollowHidden extends cc.Component {
|
|
|
|
@property(cc.Node)
|
|
node_Follow: cc.Node = null;
|
|
|
|
@property(cc.Boolean)
|
|
isReverseFollow: boolean = false;
|
|
|
|
@property(cc.Boolean)
|
|
useDisable: boolean = false;
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
// start() {}
|
|
|
|
protected onEnable(): void {
|
|
this.node_Follow.active = this.isReverseFollow ? !this.node.active : this.node.active;
|
|
}
|
|
|
|
protected onDisable(): void {
|
|
if (this.useDisable) {
|
|
this.node_Follow.active = this.isReverseFollow ? !this.node.active : this.node.active;
|
|
}
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|
|
|