Files
5.24BuYu/Assets/MyGame/Scripts/Net/WebResponses/BotConfig.cs
T

122 lines
3.5 KiB
C#
Raw Normal View History

2026-07-05 16:07:22 +08:00
using System;
using UnityEngine;
/// <summary>
/// 机器人AI配置 — 本地测试用 Inspector 调节,后续从后端 GameConfig / RoomChangeResponse 下发
/// </summary>
public class BotConfig
{
[Header("全局")]
[Tooltip("机器人总开关")]
public bool enabled = true;
[Tooltip("AI状态: active=正常 | idle=待机 | aggressive=激进")]
public string aiState = "active";
[Tooltip("爆率因子: 1.0=正常, >1容易杀, <1难杀")]
public float luckFactor = 1f;
[Tooltip("状态刷新间隔(秒), 0=不自动刷新")]
public float stateRefreshInterval;
[Header("技能配置")]
2026-07-05 17:39:30 +08:00
public BotSkillConfig skills = new BotSkillConfig();
2026-07-05 16:07:22 +08:00
[Header("active 状态参数")]
2026-07-05 17:39:30 +08:00
public BotBehaviorConfig activeBehavior = new BotBehaviorConfig();
2026-07-05 16:07:22 +08:00
[Header("idle 状态参数")]
2026-07-05 17:39:30 +08:00
public BotBehaviorConfig idleBehavior = new BotBehaviorConfig();
2026-07-05 16:07:22 +08:00
[Header("aggressive 状态参数")]
2026-07-05 17:39:30 +08:00
public BotBehaviorConfig aggressiveBehavior = new BotBehaviorConfig();
2026-07-05 16:07:22 +08:00
}
/// <summary>
/// 技能概率配置 — 每种技能独立随机,可以同时开多种
/// </summary>
public class BotSkillConfig
{
[Header("刷新")]
[Tooltip("每隔多少秒重新掷骰子决定技能组合")]
2026-07-06 22:18:28 +08:00
public float skillRefreshInterval = 10f;
2026-07-05 16:07:22 +08:00
[Space]
[Header("锁定 - 自动瞄准最近鱼")]
2026-07-08 20:49:22 +08:00
[Range(0f, 1f)] public float lockProb = 0f;
2026-07-05 16:07:22 +08:00
public float lockMinTime = 5f;
public float lockMaxTime = 20f;
[Space]
[Header("狂暴 - 开火速度翻倍")]
2026-07-06 22:18:28 +08:00
[Range(0f, 1f)] public float frenzyProb = 0.3f;
2026-07-05 16:07:22 +08:00
public float frenzyMinTime = 3f;
public float frenzyMaxTime = 8f;
[Space]
[Header("三发散弹 - 一次3发")]
2026-07-06 22:18:28 +08:00
[Range(0f, 1f)] public float tripleProb = 0.5f;
2026-07-05 16:07:22 +08:00
public float tripleMinTime = 4f;
public float tripleMaxTime = 12f;
[Space]
[Header("双倍炮 - 消耗翻倍")]
2026-07-05 18:52:09 +08:00
[Range(0f, 1f)] public float doubleProb = 0f;
2026-07-05 16:07:22 +08:00
public float doubleMinTime = 3f;
public float doubleMaxTime = 6f;
}
/// <summary>
/// 行为参数 — 每个 aiState 一组
/// </summary>
public class BotBehaviorConfig
{
[Header("开火")]
[Tooltip("开火间隔下限(秒)")]
public float fireIntervalMin = 0.3f;
[Tooltip("开火间隔上限(秒)")]
public float fireIntervalMax = 1.2f;
[Tooltip("开火概率(0~1): 每个 interval 触发开火的概率,0.9=经常开火偶尔停顿")]
[Range(0f, 1f)] public float fireProb = 0.9f;
[Header("旋转")]
[Tooltip("炮台旋转速度(度/秒)")]
2026-07-05 17:39:30 +08:00
public float rotateSpeed = 80f;
2026-07-05 16:07:22 +08:00
[Header("目标")]
[Tooltip("锁定保持时间下限(秒)")]
public float targetHoldTimeMin = 2f;
[Tooltip("锁定保持时间上限(秒)")]
public float targetHoldTimeMax = 5f;
[Tooltip("超时后切换目标的概率(0~1)")]
[Range(0f, 1f)] public float targetSwitchChance = 0.7f;
[Tooltip("优先高分鱼: 0=纯距离, 1=纯分数")]
[Range(0f, 1f)] public float targetPreferHighScore;
[Tooltip("允许打Boss")]
public bool canTargetBoss = true;
[Tooltip("允许打特殊鱼")]
public bool canTargetSpecial = true;
}
/// <summary>
/// 每个 bot 座位的技能运行时状态
/// </summary>
public class BotSkillRuntime
{
public bool lockActive;
public float lockEndTime;
public bool frenzyActive;
public float frenzyEndTime;
public bool tripleActive;
public float tripleEndTime;
public bool doubleActive;
public float doubleEndTime;
public float nextRefreshTime;
public bool HasAnySkill => lockActive || frenzyActive || tripleActive || doubleActive;
}