|
@@ -44,9 +44,9 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
|
|
|
private initAIPlayer() {
|
|
|
const aiConfig = PlayerMgr.inst.getRandomAIConfig();
|
|
|
- console.log(aiConfig);
|
|
|
+ console.log(aiConfig.data);
|
|
|
//text:名称 range:检测半径 move_juge:移动概率 move_time:移动时间 escape_time:逃跑时间 pursuit_1:追击玩家概率 pursuit_2:追击AI概率 pursuit_time:追击时间
|
|
|
- const { text, range, move_juge, move_time, escape_time, pursuit_1, pursuit_2, pursuit_time } = aiConfig.data;
|
|
|
+ const { text, range, move_judge, move_time, escape_time, pursuit_1, pursuit_2, pursuit_time } = aiConfig.data;
|
|
|
this.playerInfo.nickName = text;
|
|
|
this.playerInfo.level = 2;
|
|
|
this.currentLv = this.playerInfo.level;
|
|
@@ -56,7 +56,7 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
this.chaseDuration = Math.floor(pursuit_time[0] + Math.random() * (pursuit_time[1] - pursuit_time[0] + 1));
|
|
|
this.chaseAIProbability = pursuit_1;
|
|
|
this.chasePlayerProbability = pursuit_2;
|
|
|
- this.moveProbability = move_juge;
|
|
|
+ this.moveProbability = move_judge;
|
|
|
|
|
|
this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
|
|
|
this.attack = this.attributeBonusMgr.getStormSunderAttack(this.currentLv, true);
|
|
@@ -70,6 +70,8 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
if (this.playerStatus == PlayerStatus.DIE) return; // AI 死亡时不执行行为
|
|
|
|
|
|
const move = Math.random() * 100 < this.moveProbability;
|
|
|
+
|
|
|
+ // console.log(`AI 行为判断:移动概率:${this.moveProbability} 是否移动:${move}`);
|
|
|
if (move) {
|
|
|
this.randomMove();
|
|
|
} else {
|
|
@@ -99,7 +101,7 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
const targetPosition = this.node.position.clone().add(randomDirection);
|
|
|
|
|
|
PathfindingManager.getInstance().moveTo(this.node, targetPosition, this.moveDuration);
|
|
|
- console.log(`AI 触发随机移动行为!`);
|
|
|
+ console.log(`AI 触发随机移动行为!`, targetPosition);
|
|
|
|
|
|
this.scheduleOnce(() => {
|
|
|
if (!this.isChasing && !this.isEscaping) { // 再次检查状态,避免重复调用
|