|
@@ -10,6 +10,10 @@ import { Effect2DUIMgr } from '../Manager/Effect2DUIMgr';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
const rotateSpeed = 500;
|
|
|
+export enum PlayerStatus {
|
|
|
+ LIFE,
|
|
|
+ DIE
|
|
|
+}
|
|
|
|
|
|
/** 龙卷风组件*/
|
|
|
@ccclass('TornadoComponent')
|
|
@@ -28,6 +32,8 @@ export class TornadoComponent extends Component {
|
|
|
nextExp: number = 100;
|
|
|
ai: boolean = false;
|
|
|
nickName: string = null;
|
|
|
+ playerStatus: PlayerStatus = PlayerStatus.LIFE;
|
|
|
+ playerInfo: PlayerInfo = null;
|
|
|
|
|
|
_attackInterval: number = 0.5; // 攻击间隔
|
|
|
_lastAttackTime: Map<string, number> = new Map(); // 记录上次攻击时间
|
|
@@ -56,6 +62,13 @@ export class TornadoComponent extends Component {
|
|
|
this.attack = 20;
|
|
|
this.speed = 50;
|
|
|
this.nickName = '爸爸在此';
|
|
|
+ this.playerStatus = PlayerStatus.LIFE;
|
|
|
+
|
|
|
+ this.playerInfo = {
|
|
|
+ nickName: '爸爸在此',
|
|
|
+ level: 1,
|
|
|
+ exp: 0,
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected registerEvent() {
|
|
@@ -108,12 +121,7 @@ export class TornadoComponent extends Component {
|
|
|
}
|
|
|
|
|
|
async onPlayerInfoHandler() {
|
|
|
- const playerInfo: PlayerInfo = {
|
|
|
- nickName: this.nickName,
|
|
|
- level: this.currentLv
|
|
|
- }
|
|
|
-
|
|
|
- await Effect2DUIMgr.Instance.addPlayerInfo(this.node, playerInfo);
|
|
|
+ await Effect2DUIMgr.inst.addPlayerInfo(this.node, this.playerInfo);
|
|
|
}
|
|
|
|
|
|
onRotateHandler(): void {
|