LBObject.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import FSprite from "../object/FSprite";
  2. import BObject from "./BObject";
  3. /**
  4. * 龙卷风类型的子弹
  5. */
  6. const {ccclass, property} = cc._decorator;
  7. @ccclass
  8. export default class LBObject extends BObject {
  9. onBeginContact (contact:cc.PhysicsContact,self, other) {
  10. if(self.node == this.node){
  11. if(other.tag != 0){
  12. }else if(other.node.group == 'map'){//撞到地图
  13. }else{
  14. if(this.sprite &&this.sprite.isValid && this.sprite.hp > 0 &&
  15. this.sprite.node.group != other.node.group){
  16. if(self.isValid && other.node.isValid){
  17. let otherNode = other.node as cc.Node;
  18. let target = otherNode.getComponent(FSprite);
  19. if(target.hp > 0){
  20. if(target != null && target.isActive){
  21. this.sprite.atkjs(target,this._skillData);
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }