|
@@ -43,6 +43,8 @@ export class TornadoComponent extends Component {
|
|
_attackInterval: number = 0.5; // 攻击间隔
|
|
_attackInterval: number = 0.5; // 攻击间隔
|
|
_lastAttackTime: Map<string, number> = new Map(); // 记录上次攻击时间
|
|
_lastAttackTime: Map<string, number> = new Map(); // 记录上次攻击时间
|
|
|
|
|
|
|
|
+ attributeBonusMgr: AttributeBonusMgr = null;
|
|
|
|
+
|
|
protected start(): void {
|
|
protected start(): void {
|
|
this.initPlayer();
|
|
this.initPlayer();
|
|
this.initilizeUI();
|
|
this.initilizeUI();
|
|
@@ -67,16 +69,17 @@ export class TornadoComponent extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
protected initPlayer() {
|
|
protected initPlayer() {
|
|
- const attributeBonusMgr = AttributeBonusMgr.inst;
|
|
|
|
- const userModel = attributeBonusMgr.userModel;
|
|
|
|
|
|
+ this.attributeBonusMgr = AttributeBonusMgr.inst;
|
|
|
|
+ const userModel = this.attributeBonusMgr.userModel;
|
|
|
|
|
|
- this.currentLv = userModel.userTornadoLevel;
|
|
|
|
this.currentExp = 0;
|
|
this.currentExp = 0;
|
|
- this.nextExp = attributeBonusMgr.getExpNeed(this.currentLv + 1);
|
|
|
|
- this.attack = attributeBonusMgr.getStormSunderAttack(userModel.userTornadoLevel);
|
|
|
|
- this.speed = attributeBonusMgr.getStormSunderSpeed(userModel.userTornadoLevel);
|
|
|
|
|
|
+ this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
|
|
|
|
+ this.attack = this.attributeBonusMgr.getStormSunderAttack(this.currentLv);
|
|
|
|
+ this.speed = this.attributeBonusMgr.getStormSunderSpeed(this.currentLv);
|
|
this.nickName = userModel.nickName;
|
|
this.nickName = userModel.nickName;
|
|
|
|
|
|
|
|
+ console.log(`玩家的攻击力 :${this.attack}}`)
|
|
|
|
+
|
|
this.playerInfo = {
|
|
this.playerInfo = {
|
|
nickName: this.nickName,
|
|
nickName: this.nickName,
|
|
level: this.currentLv,
|
|
level: this.currentLv,
|
|
@@ -197,6 +200,7 @@ export class TornadoComponent extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
protected onPlayerInfoHandler() {
|
|
protected onPlayerInfoHandler() {
|
|
|
|
+ if (!this.node || !this.playerInfo) return;
|
|
Effect2DUIMgr.inst.addPlayerInfo(this.node, this.playerInfo);
|
|
Effect2DUIMgr.inst.addPlayerInfo(this.node, this.playerInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -218,6 +222,7 @@ export class TornadoComponent extends Component {
|
|
if (!this.curHitObj) return;
|
|
if (!this.curHitObj) return;
|
|
|
|
|
|
const propComp = this.curHitObj.getComponent(PropComponent);
|
|
const propComp = this.curHitObj.getComponent(PropComponent);
|
|
|
|
+
|
|
let objExp = 0;
|
|
let objExp = 0;
|
|
if (this.curHitObj.getComponent(PropComponent)) {
|
|
if (this.curHitObj.getComponent(PropComponent)) {
|
|
objExp = propComp.currentExp;
|
|
objExp = propComp.currentExp;
|
|
@@ -226,13 +231,12 @@ export class TornadoComponent extends Component {
|
|
objExp = AttributeBonusMgr.inst.getStormSunderExp(lv);
|
|
objExp = AttributeBonusMgr.inst.getStormSunderExp(lv);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ objExp = AttributeBonusMgr.inst.getStormSunderExp(objExp);
|
|
this.currentExp += objExp;
|
|
this.currentExp += objExp;
|
|
if (this.currentExp >= this.nextExp) {
|
|
if (this.currentExp >= this.nextExp) {
|
|
this.currentLv++;
|
|
this.currentLv++;
|
|
- AttributeBonusMgr.inst.userModel.userTornadoLevel = this.currentLv;
|
|
|
|
- this.stormLevelUp();
|
|
|
|
-
|
|
|
|
this.playerInfo.level = this.currentLv;
|
|
this.playerInfo.level = this.currentLv;
|
|
|
|
+ this.stormLevelUp();
|
|
Effect2DUIMgr.inst.updatePlayerInfo(this.node, this.playerInfo);
|
|
Effect2DUIMgr.inst.updatePlayerInfo(this.node, this.playerInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|