testAudio.js 723 B

123456789101112131415161718192021222324252627282930
  1. // Learn cc.Class:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/class.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. cc.Class({
  8. extends: cc.Component,
  9. properties: {
  10. tipClip: {
  11. default: [],
  12. type: cc.AudioClip,
  13. tooltip: "提示出拳方式, 0 左,1 中,2 右",
  14. },
  15. },
  16. // LIFE-CYCLE CALLBACKS:
  17. // onLoad () {},
  18. start () {
  19. },
  20. onPlayBoxingTip(tipIndex) {
  21. cc.audioEngine.play(this.tipClip[tipIndex], false, 1);
  22. },
  23. // update (dt) {},
  24. });