599bdee3-944d-4a66-b318-081b7223f0d3.js
2.79 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
"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();