// 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) {}
}