AudioMng.js 867 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. hitWood: {
  5. default: null,
  6. url: cc.AudioClip
  7. },
  8. hitKnife: {
  9. default: null,
  10. url: cc.AudioClip
  11. },
  12. hitCoin: {
  13. default: null,
  14. url: cc.AudioClip
  15. },
  16. readyGo: {
  17. default: null,
  18. url: cc.AudioClip
  19. }
  20. },
  21. _playSFX: function(clip) {
  22. cc.audioEngine.playEffect( clip, false );
  23. },
  24. /**
  25. * 击中木块
  26. */
  27. playHitWood () {
  28. this._playSFX(this.hitWood)
  29. },
  30. /**
  31. * 击中刀
  32. */
  33. playKnife () {
  34. this._playSFX(this.hitKnife)
  35. },
  36. /**
  37. * 击中金币
  38. */
  39. playKnife () {
  40. this._playSFX(this.hitCoin)
  41. },
  42. playReadyGo () {
  43. this._playSFX(this.readyGo)
  44. }
  45. });