bullet.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import move from "../game/move";
  2. import { LQCollide } from "../lq_collide_system/lq_collide";
  3. const {ccclass, property} = cc._decorator;
  4. @ccclass
  5. export default class bullet extends LQCollide {
  6. /*===========================自动绑定组件开始===========================*/
  7. /*自动生成*/
  8. @property({type:dragonBones.ArmatureDisplay, displayName:""})
  9. private $dragon_bone:dragonBones.ArmatureDisplay = null;
  10. /*===========================自动绑定组件结束===========================*/
  11. /*===========================自动生成按钮事件开始==========================*/
  12. /*===========================自动生成按钮事件结束==========================*/
  13. moveCpt: move = null;
  14. protected onLoad(): void {
  15. this.$dragon_bone.playAnimation('appear', 1);
  16. this.$dragon_bone.addEventListener('complete', ()=>{
  17. this.$dragon_bone.playAnimation('bullet_1', 0);
  18. });
  19. }
  20. public on_enter(collide: LQCollide): void {
  21. // cc.log(collide);
  22. this.node.destroy();
  23. }
  24. getMoveCpt(): move{
  25. if(!this.moveCpt) {
  26. this.moveCpt = this.node.getComponent(move);
  27. if(!this.moveCpt) {
  28. this.moveCpt = this.node.addComponent(move);
  29. }
  30. }
  31. return this.moveCpt;
  32. }
  33. }