a011d37a-b7a0-4dec-bb9e-e5d309ae8d66.js
3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"use strict";
cc._RF.push(module, 'a011dN6t6BN7Lue5dMJro1m', 'PotObj');
// scripts/kernel/battle/map/PotObj.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.PotObj = void 0;
var Global_1 = require("../../../Global");
var TableDefine_1 = require("../../table/TableDefine");
var ObjData_1 = require("./ObjData");
var PotObj = /** @class */ (function (_super) {
__extends(PotObj, _super);
function PotObj() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._angle = 0;
_this._angleSpeed = 0;
_this._speedVec = new cc.Vec2();
return _this;
//#endregion
}
Object.defineProperty(PotObj.prototype, "angle", {
get: function () { return this._angle; },
enumerable: false,
configurable: true
});
//#region interface
PotObj.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 = this.map.battle.getPhysiceBallSpeed();
this._speedVec.rotateSelf(slib.MathUtil.getRadianByDegree(this._angle));
};
//#endregion
//#region event
PotObj.prototype.onCollisonToBall = function (collider) {
_super.prototype.onCollisonToBall.call(this, collider);
// collider.node.setPosition(this.pixelPos); //碰撞过程中无法修改位置
collider.node.getComponent(cc.RigidBody).linearVelocity = this._speedVec;
};
//#endregion
//#region life cycle
PotObj.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, 11).Value;
this.canSlide = false;
};
PotObj.prototype.onBattleStart = function () {
_super.prototype.onBattleStart.call(this);
this.map.battle && this.map.battle.regUpdateObj(this); //预览模式下, map.battle为空
};
PotObj.prototype.onDead = function () {
_super.prototype.onDead.call(this);
this.map.battle && this.map.battle.unregUpdateObj(this);
};
PotObj.prototype.clone = function () {
return this.cloneValue(new PotObj());
};
PotObj.prototype.cloneValue = function (target) {
_super.prototype.cloneValue.call(this, target);
target._angleSpeed = this._angleSpeed;
return target;
};
return PotObj;
}(ObjData_1.ObjData));
exports.PotObj = PotObj;
cc._RF.pop();