123456789101112131415161718192021222324252627282930 |
- import FSprite from "../FSprite";
- import SkillBase from "./SkillBase";
- /**
- * 冲击时候的碰撞
- */
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class ChargeCollision extends cc.Component {
- public skillBase:SkillBase;
- onBeginContact (contact:cc.PhysicsContact,self, other) {
- let sprite = this.skillBase.sprite;
- if(sprite &&sprite.isValid && sprite.hp > 0 &&
- 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 && target.hp > 0){
- if(target != null && target.isActive){
- sprite.atkjs(target);
- }
- }
- }
- }
- }
- }
|