testPoint.ts 697 B

1234567891011121314151617181920212223242526272829303132
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.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. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class NewClass extends cc.Component {
  10. // LIFE-CYCLE CALLBACKS:
  11. // onLoad () {}
  12. start() {
  13. }
  14. isContact: boolean = false;
  15. onBeginContact() {
  16. this.isContact = true;
  17. }
  18. getContact() {
  19. this.node.destroy();
  20. return this.isContact;
  21. }
  22. // update (dt) {}
  23. }