FTmpGood.ts 959 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import BaseEvent from "./base/BaseEvent";
  2. /**
  3. * 地上的临时道具
  4. */
  5. const {ccclass, property} = cc._decorator;
  6. @ccclass
  7. export default class FTmpGood extends BaseEvent {
  8. @property({
  9. displayName: '临时道具id'
  10. })
  11. public goodId = 2001;
  12. private isCheck = false
  13. /**
  14. * 主角进入碰撞区域
  15. */
  16. public onBegin(tag:number){
  17. if(this.isCheck){
  18. return
  19. }
  20. this.isCheck = true
  21. let header = this.ff.mFFheader;
  22. header.addTmpGood(this.goodId,1);
  23. cc.tween(this.node).sequence(
  24. cc.spawn(
  25. cc.moveBy(1, cc.v2(0, 60)).easing(cc.easeSineOut()),
  26. cc.fadeOut(1)
  27. ),
  28. cc.callFunc(()=>{
  29. this.node.removeFromParent(true);
  30. this.node.destroy();
  31. })
  32. ).start();
  33. }
  34. /**
  35. * 主角离开碰撞区域
  36. */
  37. public onEnd(tag:number){
  38. }
  39. }