
                (function() {
                    var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
                    var __module = nodeEnv ? module : {exports:{}};
                    var __filename = 'preview-scripts/assets/Script/prop/Adhesive.js';
                    var __require = nodeEnv ? function (request) {
                        return cc.require(request);
                    } : function (request) {
                        return __quick_compile_project__.require(request, __filename);
                    };
                    function __define (exports, require, module) {
                        if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, '5fc5bz1aV5PKIBJQh99jpm2', 'Adhesive');
// Script/prop/Adhesive.ts

"use strict";
// 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
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var Adhesive = /** @class */ (function (_super) {
    __extends(Adhesive, _super);
    function Adhesive() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.time = 60;
        _this.pos = { x: 0, y: 0 };
        return _this;
    }
    Adhesive.prototype.onLoad = function () {
        this.pos.x = this.pos.y = 0;
        this.target = null;
    };
    Adhesive.prototype.start = function () {
    };
    Adhesive.prototype.init = function (node) {
        this.pos.x = node.x - this.node.x;
        this.pos.y = node.y - this.node.y;
        this.target = node;
    };
    Adhesive.prototype.remove = function () {
        var _this = this;
        this.target = null;
        for (var j = 0; j < this.node.children.length; j++) {
            if (this.node.children[j].active == true) {
                this.node.children[j].getComponent(sp.Skeleton).setAnimation(0, "animation", false);
            }
        }
        setTimeout(function () {
            _this.node.active = false;
        }, 2000);
    };
    Adhesive.prototype.update = function (dt) {
        if (this.target != null) {
            this.node.x = this.target.x - this.pos.x;
            this.node.y = this.target.y - this.pos.y;
        }
    };
    Adhesive = __decorate([
        ccclass
    ], Adhesive);
    return Adhesive;
}(cc.Component));
exports.default = Adhesive;

cc._RF.pop();
                    }
                    if (nodeEnv) {
                        __define(__module.exports, __require, __module);
                    }
                    else {
                        __quick_compile_project__.registerModuleFunc(__filename, function () {
                            __define(__module.exports, __require, __module);
                        });
                    }
                })();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 4320 characters]