addCoinAni.ts 839 B

123456789101112131415161718192021222324252627
  1. import { _decorator, Animation, AnimationClip, Component, Node, tween } from 'cc';
  2. import { gameManager } from './gameManager';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('addCoinAni')
  5. export class addCoinAni extends Component {
  6. private m_reverse_call:any = null;
  7. public play(reverse_call){
  8. this.m_reverse_call = reverse_call;
  9. gameManager.playAddCoinSound()
  10. this.getComponent(Animation).play('add_coin_animation');
  11. }
  12. onNormalPlayFinish(){
  13. // this.getComponent(Animation).clips[0].wrapMode = AnimationClip.WrapMode.LoopReverse
  14. tween(this.node).delay(0.2).call(()=>{
  15. this.getComponent(Animation).play('add_coin_animation_reverse');
  16. if(this.m_reverse_call!=null){
  17. this.m_reverse_call()
  18. }
  19. }).start()
  20. }
  21. }