30 lines
		
	
	
		
			494 B
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			494 B
		
	
	
	
		
			TypeScript
		
	
	
	
| import { _decorator, Component ,Animation , Node, director, resources, Sprite } from 'cc';
 | |
| const { ccclass, property } = _decorator;
 | |
| 
 | |
| @ccclass('test')
 | |
| export class test extends Component {
 | |
| 
 | |
| 
 | |
|     start() {
 | |
| 
 | |
|         const animation = this.node.getComponent(Animation);
 | |
|         
 | |
|         if (animation){
 | |
| 
 | |
|             animation.on(Animation.EventType.FINISHED,()=>{
 | |
| 
 | |
|                 this.node.destroy();
 | |
| 
 | |
|             });
 | |
| 
 | |
|         }
 | |
|         
 | |
|     }
 | |
| 
 | |
|     update(deltaTime: number) {
 | |
|         
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 |