using cfg.VehicleCfg; using Framework; using Gameplay.Unit.Data; using Gameplay.Utils; namespace Gameplay.Vehicle.Data { public class VehicleConfigData { public int configId; public int level; public int attack; public int defense; public int hp; public int shield; public float moveSpeed; public float turnSpeed; public int attackDistance; public int standLevel; public int crossLevel; public float batteryTurnSpeed; public float shootCd; public int maxBulletCount; public int perShootCount; public float reloadTime; public float attackShiledScale; public float attackHpScale; public int moraleAttack; public float scaleForHuman; public float scaleForVehicle; public float criticalRate; public float criticalDamageScale; public float firstShootTime; public int weaponId; public int sitCount; public string prefabPath; public int tireMarkId; public int skillId; public int deadEffectId; public bool isAttackIgnoreBlock; public DebugShowInfo debugShowInfo; public void Init(VehicleCultivateData rawConfig, int passInLevel, int skillLevel) { if (rawConfig == null || rawConfig.Cfg == null) { DebugUtil.LogError("VehicleConfigData.Init rawConfig(Class VehicleCultivateData) is null"); return; } configId = (int)rawConfig.Cfg.ID; prefabPath = PathEx.GetVehicleGameModelPath(configId); debugShowInfo = new DebugShowInfo(); debugShowInfo.configId = "VehicleConfig@" + configId; debugShowInfo.name = rawConfig.Cfg.Name; debugShowInfo.iconPath = rawConfig.Cfg.Icon; level = passInLevel; attack = rawConfig.Attack(); defense = rawConfig.Defense(); hp = rawConfig.Hp(); shield = 0; moveSpeed = rawConfig.Cfg.MoveSpeed; turnSpeed = rawConfig.Cfg.TurnSpeed; crossLevel = rawConfig.Cfg.MoveCrossLevel; standLevel = rawConfig.Cfg.StandCrossLevel; attackDistance = rawConfig.Cfg.AttackDistance; batteryTurnSpeed = rawConfig.Cfg.BatteryTurnSpeed; shootCd = 1f / rawConfig.Cfg.FireRate; maxBulletCount = rawConfig.Cfg.BulletCount; perShootCount = rawConfig.Cfg.PerShootCount; reloadTime = rawConfig.Cfg.ReloadTime; moraleAttack = rawConfig.Cfg.MoraleDamage; criticalRate = rawConfig.Cfg.CriticalRate; criticalDamageScale = rawConfig.Cfg.CriticalScale; firstShootTime = rawConfig.Cfg.FirstShootTime; deadEffectId = rawConfig.Cfg.DeadEffectId; sitCount = rawConfig.SeatCount(); weaponId = rawConfig.Cfg.WeaponId; tireMarkId = rawConfig.Cfg.TireMarkId; attackHpScale = rawConfig.AttackHpScale(); attackShiledScale = rawConfig.AttackShiledScale(); scaleForHuman = rawConfig.ScaleForHuman(); scaleForVehicle = rawConfig.ScaleForVehicle(); isAttackIgnoreBlock = rawConfig.Cfg.AttackIgnoreBlock; var skillConfig = TableManager.Instance.Tables.VehicleSkllUpgrade.Get(rawConfig.Cfg.ID); if (skillConfig == null || skillConfig.SkillIdList.Count == 0) { DebugUtil.LogError($"未找到车辆技能配置:{rawConfig.Cfg.ID}"); skillId = -1; } else { var skillLevelIndex = skillLevel - 1; if (skillConfig.SkillIdList.Count <= skillLevelIndex) { DebugUtil.LogError($"未找到车辆技能配置:{rawConfig.Cfg.ID} 等级:{skillLevel} 索引:{skillLevelIndex}"); // 使用最后一个技能 skillId = skillConfig.SkillIdList[^1]; DebugUtil.LogError($"使用最后一个技能:{skillId}"); } else { skillId = skillConfig.SkillIdList[skillLevelIndex]; } } // TODO: 强制指定技能id // skillId = 30009; } } }