FAltarFire.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import FqLogin from "../../../../login/FqLogin";
  2. import FF from "../../FF";
  3. import FMap from "../../map/FMap";
  4. import FSprite from "../../object/FSprite";
  5. import BaseEvent from "../base/BaseEvent";
  6. /**
  7. * 点亮祭坛的火
  8. */
  9. const { ccclass, property } = cc._decorator;
  10. @ccclass
  11. export default class FAltarFire extends BaseEvent {
  12. @property({
  13. displayName: '对应的地图物件'
  14. })
  15. public mapGoodId: string = '27';
  16. @property({
  17. displayName: '捡起的物品id'
  18. })
  19. public goodId = 2002;
  20. @property({
  21. type:cc.Node,
  22. displayName: '引导箭头标识'
  23. })
  24. mGuideMark: cc.Node = null;
  25. onLoad() {
  26. super.onLoad()
  27. this.node.zIndex = 9999;
  28. }
  29. private isCheck = false
  30. /**
  31. * 主角进入碰撞区域
  32. */
  33. public onBegin(tag: number) {
  34. if (this.isCheck) {
  35. return
  36. }
  37. this.isCheck = true
  38. if(this.mGuideMark){
  39. this.mGuideMark.active = false;
  40. this.ff.firstGetGoodsTips();
  41. }
  42. this.node.removeComponent(cc.PhysicsBoxCollider);
  43. let header = this.ff.mFFheader;
  44. header.addTmpGood(this.goodId, 1);
  45. cc.tween(this.node).sequence(
  46. cc.spawn(
  47. cc.moveBy(1, cc.v2(0, 200)).easing(cc.easeSineOut()),
  48. cc.fadeOut(1)
  49. ),
  50. cc.callFunc(() => {
  51. FqLogin.commitEvent(this.node.name,'','');
  52. this.node.removeFromParent(true);
  53. this.node.destroy();
  54. })
  55. ).start();
  56. }
  57. }