qiyou_effect_item.ts 799 B

1234567891011121314151617181920212223242526272829
  1. import { _decorator, Component, Node, ParticleSystem2D, tween, Vec3 } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('qiyou_effect_item')
  4. export class qiyou_effect_item extends Component {
  5. @property(ParticleSystem2D) particle:ParticleSystem2D = null
  6. private mIsCanUse:boolean = true
  7. public init(){
  8. this.node.active = false
  9. }
  10. public show(qiyou_p:Vec3){
  11. this.node.active = true
  12. this.node.position = new Vec3(qiyou_p.x,qiyou_p.y)
  13. this.particle.resetSystem()
  14. this.mIsCanUse = false
  15. tween(this.node).delay(2).call(()=>{
  16. this.mIsCanUse = true
  17. this.node.active = false
  18. this.particle.stopSystem()
  19. }).start()
  20. }
  21. public IsCanUse(){
  22. return this.mIsCanUse
  23. }
  24. }