* Start dynamic behavior associated with entity such as dynamic components and animations. * Tell all children entities to also play.
()
| 493 | * Tell all children entities to also play. |
| 494 | */ |
| 495 | play () { |
| 496 | var entities; |
| 497 | var i; |
| 498 | var key; |
| 499 | |
| 500 | // Already playing. |
| 501 | if (this.isPlaying || (!this.hasLoaded && !this.isLoading)) { return; } |
| 502 | this.isPlaying = true; |
| 503 | |
| 504 | // Wake up all components. |
| 505 | for (key in this.components) { this.components[key].play(); } |
| 506 | |
| 507 | // Tell all child entities to play. |
| 508 | entities = this.getChildEntities(); |
| 509 | for (i = 0; i < entities.length; i++) { entities[i].play(); } |
| 510 | |
| 511 | this.emit('play'); |
| 512 | } |
| 513 | |
| 514 | /** |
| 515 | * Pause dynamic behavior associated with entity such as dynamic components and animations. |
no test coverage detected