599bdee3-944d-4a66-b318-081b7223f0d3.js 2.79 KB
"use strict";
cc._RF.push(module, '599bd7jlE1KZrMYCBtyI/DT', 'SpliterObj');
// scripts/kernel/battle/map/SpliterObj.ts

"use strict";
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 __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpliterObj = void 0;
var ObjData_1 = require("./ObjData");
var SpliterObj = /** @class */ (function (_super) {
    __extends(SpliterObj, _super);
    function SpliterObj() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._speedVec = cc.v2(0, 32);
        _this._cacheVec = cc.v2();
        _this._hit = false;
        _this._randomRange = [];
        return _this;
    }
    SpliterObj.prototype.init = function (map, type, gridX, gridY) {
        _super.prototype.init.call(this, map, type, gridX, gridY);
        this._imgName = 'UI_yxz_tsfk_ss';
        // let speed = this.map.battle.getPhysiceBallSpeed(); //预览时没有battle
        // this._speedVec.y = speed;
        var rad = slib.MathUtil.getRadianByDegree(60);
        this._randomRange.push(-rad, rad);
    };
    SpliterObj.prototype.onCollisonToBall = function (collider) {
        _super.prototype.onCollisonToBall.call(this, collider);
        if (!this._hit) {
            this._hit = true;
            this.map.battle.addToRoundClear(this);
        }
        var speed = this.map.battle.getPhysiceBallSpeed();
        // let speed = (tMgr.getConfig(TableName.GAME_PLAY, 3) as GamePlayTable).Value;
        this._speedVec.y = speed;
        var rad = Math.random() * (this._randomRange[1] - this._randomRange[0]) + this._randomRange[0];
        this._speedVec.rotate(rad, this._cacheVec);
        collider.node.getComponent(cc.RigidBody).linearVelocity = this._cacheVec;
    };
    SpliterObj.prototype.clone = function () {
        return this.cloneValue(new SpliterObj());
    };
    SpliterObj.prototype.cloneValue = function (target) {
        _super.prototype.cloneValue.call(this, target);
        target._hit = this._hit;
        target._speedVec.set(this._speedVec);
        for (var i = 0; i < this._randomRange.length; ++i) {
            target._randomRange.push(this._randomRange[i]);
        }
        return target;
    };
    return SpliterObj;
}(ObjData_1.ObjData));
exports.SpliterObj = SpliterObj;

cc._RF.pop();