import FSprite from "../object/FSprite";
import BObject from "./BObject";

/**
 * 龙卷风类型的子弹
 */
const {ccclass, property} = cc._decorator;

@ccclass
export default class LBObject extends BObject {

    onBeginContact (contact:cc.PhysicsContact,self, other) {
        if(self.node == this.node){
            if(other.tag != 0){

            }else if(other.node.group == 'map'){//撞到地图
            }else{
                if(this.sprite &&this.sprite.isValid && this.sprite.hp > 0 &&
                     this.sprite.node.group != other.node.group){
                    if(self.isValid && other.node.isValid){
                        let otherNode = other.node as cc.Node;
                        let target = otherNode.getComponent(FSprite);
                        if(target.hp > 0){
                            if(target != null && target.isActive){
                                this.sprite.atkjs(target,this._skillData);
                            }
                        }
                    }
                }
            }
        }
    }
}
