1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.Emitter = void 0;
|
4 | const EmitterRate_1 = require("./EmitterRate");
|
5 | const EmitterLife_1 = require("./EmitterLife");
|
6 | const Utils_1 = require("../../../../Utils");
|
7 | const EmitterSize_1 = require("./EmitterSize");
|
8 | const AnimatableColor_1 = require("../../../../Options/Classes/AnimatableColor");
|
9 | const Enums_1 = require("../../Enums");
|
10 | class Emitter {
|
11 | constructor() {
|
12 | this.autoPlay = true;
|
13 | this.fill = true;
|
14 | this.life = new EmitterLife_1.EmitterLife();
|
15 | this.rate = new EmitterRate_1.EmitterRate();
|
16 | this.shape = Enums_1.EmitterShapeType.square;
|
17 | this.startCount = 0;
|
18 | }
|
19 | load(data) {
|
20 | if (data === undefined) {
|
21 | return;
|
22 | }
|
23 | if (data.autoPlay !== undefined) {
|
24 | this.autoPlay = data.autoPlay;
|
25 | }
|
26 | if (data.size !== undefined) {
|
27 | if (this.size === undefined) {
|
28 | this.size = new EmitterSize_1.EmitterSize();
|
29 | }
|
30 | this.size.load(data.size);
|
31 | }
|
32 | if (data.direction !== undefined) {
|
33 | this.direction = data.direction;
|
34 | }
|
35 | if (data.fill !== undefined) {
|
36 | this.fill = data.fill;
|
37 | }
|
38 | this.life.load(data.life);
|
39 | this.name = data.name;
|
40 | if (data.particles !== undefined) {
|
41 | this.particles = (0, Utils_1.deepExtend)({}, data.particles);
|
42 | }
|
43 | this.rate.load(data.rate);
|
44 | if (data.shape !== undefined) {
|
45 | this.shape = data.shape;
|
46 | }
|
47 | if (data.position !== undefined) {
|
48 | this.position = {
|
49 | x: data.position.x,
|
50 | y: data.position.y,
|
51 | };
|
52 | }
|
53 | if (data.spawnColor !== undefined) {
|
54 | if (this.spawnColor === undefined) {
|
55 | this.spawnColor = new AnimatableColor_1.AnimatableColor();
|
56 | }
|
57 | this.spawnColor.load(data.spawnColor);
|
58 | }
|
59 | if (data.startCount !== undefined) {
|
60 | this.startCount = data.startCount;
|
61 | }
|
62 | }
|
63 | }
|
64 | exports.Emitter = Emitter;
|