databus.js 364 B

1234567891011121314151617181920212223242526272829303132
  1. import Pool from './base/pool'
  2. let instance
  3. /**
  4. * 全局状态管理器
  5. */
  6. export default class DataBus {
  7. constructor() {
  8. if ( instance )
  9. return instance
  10. instance = this
  11. this.pool = new Pool()
  12. this.reset()
  13. }
  14. reset() {
  15. this.score = 0
  16. this.animations = []
  17. this.gameOver = false
  18. this.box = []
  19. }
  20. }