83fe1676-b077-4e6c-8af9-ca3b85189b61.js 2.93 KB
"use strict";
cc._RF.push(module, '83fe1Z2sHdObIr5yjuFGJth', 'RotaterObj');
// scripts/kernel/battle/map/RotaterObj.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.RotaterObj = void 0;
var Global_1 = require("../../../Global");
var TableDefine_1 = require("../../table/TableDefine");
var ObjData_1 = require("./ObjData");
var RotaterObj = /** @class */ (function (_super) {
    __extends(RotaterObj, _super);
    function RotaterObj() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._angle = 0;
        _this._angleSpeed = 0;
        return _this;
        //#endregion
    }
    Object.defineProperty(RotaterObj.prototype, "angle", {
        get: function () { return this._angle; },
        enumerable: false,
        configurable: true
    });
    //#region interface
    RotaterObj.prototype.onUpdate = function (dt) {
        // throw new Error("Method not implemented.");
        this._angle += (this._angleSpeed * dt);
        this._angle = this._angle % 360;
        // this._speedVec.x = 0;
        // this._speedVec.y = (tMgr.getConfig(TableName.GAME_PLAY, 3) as GamePlayTable).Value;
        // this._speedVec.rotateSelf(slib.MathUtil.getRadianByDegree(this._angle));
    };
    //#endregion
    //#region life cycle
    RotaterObj.prototype.init = function (map, type, gridX, gridY) {
        _super.prototype.init.call(this, map, type, gridX, gridY);
        this._angleSpeed = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 12).Value;
        this._imgName = 'UI_yxz_tsfk_xzg';
        this.canSlide = false;
    };
    RotaterObj.prototype.onBattleStart = function () {
        _super.prototype.onBattleStart.call(this);
        this.map.battle && this.map.battle.regUpdateObj(this); //预览模式下, map.battle为空
    };
    RotaterObj.prototype.onDead = function () {
        _super.prototype.onDead.call(this);
        this.map.battle && this.map.battle.unregUpdateObj(this);
    };
    RotaterObj.prototype.clone = function () {
        return this.cloneValue(new RotaterObj());
    };
    RotaterObj.prototype.cloneValue = function (target) {
        _super.prototype.cloneValue.call(this, target);
        target._angleSpeed = this._angleSpeed;
        return target;
    };
    return RotaterObj;
}(ObjData_1.ObjData));
exports.RotaterObj = RotaterObj;

cc._RF.pop();