24 lines
		
	
	
		
			421 B
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			421 B
		
	
	
	
		
			TypeScript
		
	
	
	
| import { _decorator, Component, Node } from 'cc';
 | |
| const { ccclass, property } = _decorator;
 | |
| 
 | |
| @ccclass('Pressent')
 | |
| export class Pressent extends Component {
 | |
| 
 | |
|     @property(Node) cancel: Node;
 | |
| 
 | |
|     start() {
 | |
|         this.cancel.on(Node.EventType.TOUCH_END,this.touchEnd,this);
 | |
|     }
 | |
| 
 | |
|     touchEnd(event:Event){
 | |
|         /// 销毁节点
 | |
|         this.node.destroy();
 | |
|     }
 | |
| 
 | |
|     update(deltaTime: number) {
 | |
|         
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 |