Skip to content

Commit 0a07ea9

Browse files
committed
Added loadConfig and toJSON
1 parent 7ea3fed commit 0a07ea9

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

v3/src/gameobjects/particles/EmitterOp.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var EmitterOp = new Class({
1313
if (emitOnly === undefined) { emitOnly = false; }
1414

1515
this.propertyKey = key;
16-
this.propertyValue = GetFastValue(config, key, defaultValue);
16+
this.propertyValue = defaultValue;
1717
this.defaultValue = defaultValue;
1818

1919
this.steps = 0;
@@ -23,18 +23,39 @@ var EmitterOp = new Class({
2323
this.end = 0;
2424
this.ease;
2525

26+
this.emitOnly = emitOnly;
27+
2628
this.onEmit = this.defaultEmit;
2729
this.onUpdate = this.defaultUpdate;
2830

31+
this.loadConfig(config);
32+
},
33+
34+
loadConfig: function (config, newKey)
35+
{
36+
if (config === undefined) { config = {} };
37+
38+
if (newKey)
39+
{
40+
this.propertyKey = newKey;
41+
}
42+
43+
this.propertyValue = GetFastValue(config, this.propertyKey, this.defaultValue);
44+
2945
this.setMethods();
3046

31-
if (emitOnly)
47+
if (this.emitOnly)
3248
{
3349
// Reset it back again
3450
this.onUpdate = this.defaultUpdate;
3551
}
3652
},
3753

54+
toJSON: function ()
55+
{
56+
return JSON.stringify(this.propertyValue);
57+
},
58+
3859
onChange: function (value)
3960
{
4061
this.propertyValue = value;

0 commit comments

Comments
 (0)