OpenAnim.ts 721 B

1234567891011121314151617181920212223
  1. import { _decorator, Component, Node, Animation } from 'cc';
  2. import { Sound } from '../core/sound/Sound';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('OpenAnim')
  5. export class OpenAnim extends Component {
  6. @property({ tooltip: "开字旋转动画", type: Animation }) private anim: Animation;
  7. @property({ tooltip: "开红包动画", type: Animation }) private openRedAnim: Animation;
  8. @property({ tooltip: "音效组件", type: Sound }) private sound: Sound;
  9. private times = 3;
  10. start() {
  11. // [3]
  12. }
  13. public animBack() {
  14. this.times--;
  15. !this.times && this.anim.stop();
  16. !this.times && this.openRedAnim.play();
  17. !this.times && this.sound.play();
  18. }
  19. }