|
@@ -1,4 +1,4 @@
|
|
|
-import { _decorator, CCFloat, Component, Node, tween, Tween, Vec3 } from 'cc';
|
|
|
+import { _decorator, CCFloat, Collider, Component, ITriggerEvent, Node, tween, Tween, Vec3 } from 'cc';
|
|
|
import { Effect2DUIMgr } from '../Manager/Effect2DUIMgr';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
@@ -17,9 +17,14 @@ export class PropComponent extends Component {
|
|
|
status: PropStatus = PropStatus.LIFE;
|
|
|
speed: number = 50;
|
|
|
|
|
|
+ tigger: Collider = null!;
|
|
|
+
|
|
|
start() {
|
|
|
this.status = PropStatus.LIFE;
|
|
|
this.currentHp = this.hp;
|
|
|
+
|
|
|
+ this.tigger = this.node.getComponent(Collider)!;
|
|
|
+ this.tigger.on('onTriggerExit', this.onTriggerExit, this);
|
|
|
}
|
|
|
|
|
|
//受伤
|
|
@@ -55,6 +60,10 @@ export class PropComponent extends Component {
|
|
|
.start();
|
|
|
}
|
|
|
|
|
|
+ onTriggerExit(event: ITriggerEvent): void {
|
|
|
+ Effect2DUIMgr.Instance.removeBlood(this.node);
|
|
|
+ }
|
|
|
+
|
|
|
update(deltaTime: number) {
|
|
|
|
|
|
}
|