NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Vehicle/Data/VehicleConfigData.cs

145 lines
4.1 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +08:00
using cfg.VehicleCfg;
2023-10-19 15:00:19 +08:00
using Framework;
using Gameplay.Unit.Data;
using Gameplay.Utils;
2023-08-22 19:08:45 +08:00
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;
2024-06-20 13:30:39 +08:00
public float attackShiledScale;
public float attackHpScale;
2023-08-22 19:08:45 +08:00
public int moraleAttack;
public float scaleForHuman;
public float scaleForVehicle;
public float criticalRate;
public float criticalDamageScale;
public float firstShootTime;
public int weaponId;
2023-10-19 15:00:19 +08:00
public int sitCount;
2024-01-11 13:33:30 +08:00
public string prefabPath;
2023-08-22 19:08:45 +08:00
2023-10-19 15:00:19 +08:00
public int tireMarkId;
public int skillId;
2024-07-05 18:34:40 +08:00
public int deadEffectId;
2024-01-11 13:33:30 +08:00
public DebugShowInfo debugShowInfo;
2024-01-31 13:20:19 +08:00
public void Init(VehicleCultivateData rawConfig,
int passInLevel, int skillLevel)
2023-08-22 19:08:45 +08:00
{
2024-01-31 13:20:19 +08:00
configId = rawConfig.Cfg.ID;
prefabPath = PathEx.GetVehicleGameModelPath(configId);
2023-08-22 19:08:45 +08:00
debugShowInfo = new DebugShowInfo();
debugShowInfo.configId = "VehicleConfig@" + configId;
debugShowInfo.name = rawConfig.Cfg.Name;
debugShowInfo.iconPath = rawConfig.Cfg.Icon;
level = passInLevel;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
attack = rawConfig.Attack();
defense = rawConfig.Defense();
hp = rawConfig.Hp();
shield = 0;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
moveSpeed = rawConfig.Cfg.MoveSpeed;
turnSpeed = rawConfig.Cfg.TurnSpeed;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
crossLevel = rawConfig.Cfg.MoveCrossLevel;
standLevel = rawConfig.Cfg.StandCrossLevel;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
attackDistance = rawConfig.Cfg.AttackDistance;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
batteryTurnSpeed = rawConfig.Cfg.BatteryTurnSpeed;
shootCd = 1f / rawConfig.Cfg.FireRate;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
maxBulletCount = rawConfig.Cfg.BulletCount;
perShootCount = rawConfig.Cfg.PerShootCount;
reloadTime = rawConfig.Cfg.ReloadTime;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
moraleAttack = rawConfig.Cfg.MoraleDamage;
criticalRate = rawConfig.Cfg.CriticalRate;
criticalDamageScale = rawConfig.Cfg.CriticalScale;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
firstShootTime = rawConfig.Cfg.FirstShootTime;
2024-06-20 13:30:39 +08:00
2024-07-05 18:34:40 +08:00
deadEffectId = rawConfig.Cfg.DeadEffectId;
2024-06-20 13:30:39 +08:00
sitCount = rawConfig.SeatCount();
2023-10-19 15:00:19 +08:00
2024-01-31 13:20:19 +08:00
weaponId = rawConfig.Cfg.WeaponId;
2023-08-22 19:08:45 +08:00
2024-01-31 13:20:19 +08:00
tireMarkId = rawConfig.Cfg.TireMarkId;
2023-10-19 15:00:19 +08:00
2024-06-20 13:30:39 +08:00
attackHpScale = rawConfig.AttackHpScale();
attackShiledScale = rawConfig.AttackShiledScale();
scaleForHuman = rawConfig.ScaleForHuman();
scaleForVehicle = rawConfig.ScaleForVehicle();
2024-01-31 13:20:19 +08:00
var skillConfig = TableManager.Instance.Tables.VehicleSkllUpgrade.Get(rawConfig.Cfg.ID);
2024-05-27 19:44:22 +08:00
if (skillConfig == null || skillConfig.SkillIdList.Count == 0)
2024-01-25 12:51:19 +08:00
{
2024-01-31 13:20:19 +08:00
DebugUtil.LogError($"未找到车辆技能配置:{rawConfig.Cfg.ID}");
2024-01-25 12:51:19 +08:00
skillId = -1;
}
else
{
var skillLevelIndex = skillLevel - 1;
2024-05-27 19:44:22 +08:00
if (skillConfig.SkillIdList.Count <= skillLevelIndex)
{
DebugUtil.LogError($"未找到车辆技能配置:{rawConfig.Cfg.ID} 等级:{skillLevel} 索引:{skillLevelIndex}");
// 使用最后一个技能
skillId = skillConfig.SkillIdList[^1];
DebugUtil.LogError($"使用最后一个技能:{skillId}");
}
else
{
skillId = skillConfig.SkillIdList[skillLevelIndex];
}
2024-01-25 12:51:19 +08:00
}
2023-10-19 15:00:19 +08:00
// TODO: 强制指定技能id
2024-01-17 14:31:53 +08:00
// skillId = 30009;
2023-08-22 19:08:45 +08:00
}
}
}