您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

46 行
902 B

  1. define([
  2. 'js/rendering/renderer'
  3. ], function (
  4. renderer
  5. ) {
  6. return {
  7. type: 'particles',
  8. emitter: null,
  9. init: function (blueprint) {
  10. this.blueprint = this.blueprint || {};
  11. this.blueprint.pos = {
  12. x: (this.obj.x * scale) + (scale / 2),
  13. y: (this.obj.y * scale) + (scale / 2)
  14. };
  15. this.ttl = blueprint.ttl;
  16. this.blueprint.obj = this.obj;
  17. this.emitter = renderer.buildEmitter(this.blueprint);
  18. },
  19. update: function () {
  20. if (this.ttl !== null) {
  21. this.ttl--;
  22. if (this.ttl <= 0) {
  23. if (this.destroyObject)
  24. this.obj.destroyed = true;
  25. else
  26. this.destroyed = true;
  27. return;
  28. }
  29. }
  30. if (!this.emitter.emit)
  31. return;
  32. this.emitter.spawnPos.x = (this.obj.x * scale) + (scale / 2);
  33. this.emitter.spawnPos.y = (this.obj.y * scale) + (scale / 2);
  34. },
  35. destroy: function () {
  36. renderer.destroyEmitter(this.emitter);
  37. }
  38. };
  39. });