JG0111_2.ts 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import BaseEvent from "../../fight/evnet/base/BaseEvent";
  2. /**
  3. * 1-2 遇宠物,向天射箭的精灵族精灵
  4. * 角色前进,遇到被关在地刺中的宠物。
  5. 小鹿:嗷嗷……嗷嗷……
  6. */
  7. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class JG0111_2 extends BaseEvent {
  10. @property(cc.Node)
  11. mPet: cc.Node = null;
  12. @property(cc.Prefab)
  13. mMapDialog: cc.Prefab = null;
  14. @property({
  15. displayName: '对话内容',
  16. type: [cc.String]
  17. })
  18. text: Array<string> = [];
  19. public isOver = false
  20. /**
  21. * 主角进入碰撞区域
  22. * @param tag 碰撞组件编号
  23. */
  24. public onBegin(tag: number) {
  25. if(this.isOver){
  26. return
  27. }
  28. this.isOver = true
  29. this.pause()
  30. this.moveCamera(this.mPet.getPosition(),0.7,()=>{
  31. this.showDialog(this.mPet,this.text,()=>{
  32. this.node.destroy()
  33. this.resume()
  34. })
  35. })
  36. }
  37. }