|
@@ -7,6 +7,7 @@ import { GameMgr, GameStatus } from '../Manager/GameMgr';
|
|
|
import { PropComponent, PropStatus } from './PropComponent';
|
|
|
import { PlayerInfo } from './PlayerInfoComponent';
|
|
|
import { Effect2DUIMgr } from '../Manager/Effect2DUIMgr';
|
|
|
+import { AttributeBonusMgr } from '../Manager/AttributeBonusMgr';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
const rotateSpeed = 500;
|
|
@@ -30,6 +31,7 @@ export class TornadoComponent extends Component {
|
|
|
speed: number = 50;
|
|
|
currentExp: number = 0;
|
|
|
currentLv: number = 1;
|
|
|
+ giveExp: number = 10; //被吃掉给予经验
|
|
|
nextExp: number = 100;
|
|
|
nickName: string = null;
|
|
|
playerStatus: PlayerStatus = PlayerStatus.LIFE;
|
|
@@ -65,18 +67,19 @@ export class TornadoComponent extends Component {
|
|
|
}
|
|
|
|
|
|
protected initPlayer() {
|
|
|
- //DOTO 计算方式根据配置表
|
|
|
- this.currentLv = 3;
|
|
|
+ const attributeBonusMgr = AttributeBonusMgr.inst;
|
|
|
+ const userModel = attributeBonusMgr.userModel;
|
|
|
+
|
|
|
+ this.currentLv = userModel.userTornadoLevel;
|
|
|
this.currentExp = 0;
|
|
|
- this.nextExp = 100;
|
|
|
- this.attack = 20;
|
|
|
- this.speed = 50;
|
|
|
- this.nickName = '爸爸在此';
|
|
|
+ this.nextExp = attributeBonusMgr.getExpNeed(this.currentLv + 1);
|
|
|
+ this.attack = attributeBonusMgr.getStormSunderAttack(userModel.userTornadoLevel);
|
|
|
+ this.speed = attributeBonusMgr.getStormSunderSpeed(userModel.userTornadoLevel);
|
|
|
+ this.nickName = userModel.nickName;
|
|
|
|
|
|
this.playerInfo = {
|
|
|
nickName: this.nickName,
|
|
|
level: this.currentLv,
|
|
|
- exp: 0,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -219,14 +222,15 @@ export class TornadoComponent extends Component {
|
|
|
if (this.curHitObj.getComponent(PropComponent)) {
|
|
|
objExp = propComp.currentExp;
|
|
|
} else {
|
|
|
- //TODO 计算经验
|
|
|
- objExp = this.currentLv * 10;
|
|
|
+ const lv = this.curHitObj.getComponent(TornadoComponent).currentLv;
|
|
|
+ objExp = AttributeBonusMgr.inst.getStormSunderExp(lv);
|
|
|
}
|
|
|
|
|
|
this.currentExp += objExp;
|
|
|
if (this.currentExp >= this.nextExp) {
|
|
|
- this.stormLevelUp();
|
|
|
this.currentLv++;
|
|
|
+ AttributeBonusMgr.inst.userModel.userTornadoLevel = this.currentLv;
|
|
|
+ this.stormLevelUp();
|
|
|
|
|
|
this.playerInfo.level = this.currentLv;
|
|
|
Effect2DUIMgr.inst.updatePlayerInfo(this.node, this.playerInfo);
|
|
@@ -234,10 +238,10 @@ export class TornadoComponent extends Component {
|
|
|
}
|
|
|
|
|
|
private stormLevelUp() {
|
|
|
- //DOTO 计算攻击速度等属性
|
|
|
- this.attack += this.attack;
|
|
|
- this.speed += this.speed * 0.1;
|
|
|
- this.nextExp += this.nextExp;
|
|
|
+ const attributeBonusMgr = AttributeBonusMgr.inst;
|
|
|
+ this.nextExp = attributeBonusMgr.getExpNeed(this.currentLv + 1);
|
|
|
+ this.attack = attributeBonusMgr.getStormSunderAttack(this.currentLv);
|
|
|
+ this.speed = attributeBonusMgr.getStormSunderSpeed(this.currentLv);
|
|
|
this.currentExp = 0;
|
|
|
}
|
|
|
|