262 lines
8.8 KiB
C#
262 lines
8.8 KiB
C#
using cfg.MonsterCfg;
|
|
using Framework;
|
|
using Gameplay.Unit.Data;
|
|
using Gameplay.Utils;
|
|
using UnityEngine;
|
|
|
|
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 shootCd;
|
|
|
|
public int maxBulletCount;
|
|
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 float attackEndTime;
|
|
public int attackLoopCount;
|
|
|
|
public DebugShowInfo debugShowInfo;
|
|
|
|
public VehicleAudioData audioData;
|
|
|
|
public void Init(DataMonster monsterConfig)
|
|
{
|
|
var rawConfig = TableManager.Instance.Tables.EnemyVehicleConfig.GetOrDefault(monsterConfig.MonsterClassID);
|
|
if (rawConfig == null)
|
|
{
|
|
DebugUtil.LogError("VehicleConfigData.Init rawConfig(Class DataEnemyVehicle) is null");
|
|
return;
|
|
}
|
|
|
|
audioData = new VehicleAudioData();
|
|
audioData.deadAudioId = rawConfig.DeadAudioId;
|
|
audioData.walkLoopAudioId = rawConfig.WalkLoopAudioId;
|
|
audioData.walkStopAudioId = rawConfig.WalkStopAudioId;
|
|
audioData.IdleLoopAudioId = rawConfig.IdleLoopAudioId;
|
|
audioData.ReadyAudioId = rawConfig.ReadyAudioId;
|
|
|
|
configId = rawConfig.ID;
|
|
prefabPath = PathEx.GetVehicleGameModelPath(configId);
|
|
|
|
debugShowInfo = new DebugShowInfo();
|
|
debugShowInfo.configId = "EnemyVehicle@" + configId;
|
|
debugShowInfo.name = rawConfig.Name;
|
|
|
|
level = monsterConfig.MonsterLevel;
|
|
|
|
var enemyLevelConfig = TableManager.Instance.Tables.EnemyVehicleLevelUp.GetOrDefault(level);
|
|
|
|
attack = Mathf.RoundToInt(rawConfig.Damage * monsterConfig.AttackFix * enemyLevelConfig.AttackLevelUpTemplate);
|
|
defense = Mathf.RoundToInt(rawConfig.Defense * monsterConfig.DefenceFix * enemyLevelConfig.DefenceLevelUpTemplate);
|
|
hp = Mathf.RoundToInt(rawConfig.HP * monsterConfig.HPFix * enemyLevelConfig.HpLevelUpTemplate);
|
|
shield = 0;
|
|
|
|
moveSpeed = rawConfig.MoveSpeed;
|
|
turnSpeed = rawConfig.TurnSpeed;
|
|
|
|
crossLevel = rawConfig.MoveCrossLevel;
|
|
standLevel = rawConfig.StandCrossLevel;
|
|
|
|
attackDistance = rawConfig.AttackDistance;
|
|
|
|
shootCd = 1f / rawConfig.FireRate;
|
|
|
|
maxBulletCount = rawConfig.BulletCount;
|
|
reloadTime = rawConfig.ReloadTime;
|
|
|
|
moraleAttack = rawConfig.MoraleDamage;
|
|
criticalRate = rawConfig.CriticalRate;
|
|
criticalDamageScale = rawConfig.CriticalScale;
|
|
|
|
firstShootTime = rawConfig.FirstShootTime;
|
|
|
|
deadEffectId = rawConfig.DeadEffectId;
|
|
|
|
sitCount = rawConfig.SeatCount;
|
|
|
|
weaponId = rawConfig.WeaponId;
|
|
|
|
tireMarkId = rawConfig.TireMarkId;
|
|
|
|
attackHpScale = rawConfig.AttackHpScale;
|
|
attackShiledScale = rawConfig.AttackShiledScale;
|
|
|
|
scaleForHuman = rawConfig.ScaleForHuman;
|
|
scaleForVehicle = rawConfig.ScaleForVehicle;
|
|
|
|
isAttackIgnoreBlock = rawConfig.AttackIgnoreBlock;
|
|
|
|
attackEndTime = rawConfig.AttackSplitTime;
|
|
|
|
var skillUpgradeConfig = TableManager.Instance.Tables.EnemyVehicleSkillUpgrade.GetOrDefault(rawConfig.ID);
|
|
if (skillUpgradeConfig == null)
|
|
{
|
|
DebugUtil.LogError($"未找到敌人车辆技能配置:{rawConfig.ID}");
|
|
}
|
|
else
|
|
{
|
|
var skillLevelIndex = enemyLevelConfig.SkillLevel - 1;
|
|
if (skillLevelIndex < 0)
|
|
{
|
|
skillLevelIndex = 0;
|
|
}
|
|
if (skillUpgradeConfig.SkillIdList.Count <= skillLevelIndex)
|
|
{
|
|
DebugUtil.LogError($"未找到敌人车辆技能配置:{rawConfig.ID} 等级:{enemyLevelConfig.SkillLevel} 索引:{skillLevelIndex}");
|
|
// 使用最后一个技能
|
|
skillId = skillUpgradeConfig.SkillIdList[^1];
|
|
DebugUtil.LogError($"使用最后一个技能:{skillId}");
|
|
}
|
|
else
|
|
{
|
|
skillId = skillUpgradeConfig.SkillIdList[skillLevelIndex];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
audioData = new VehicleAudioData();
|
|
audioData.ReadyAudioId = rawConfig.Cfg.ReadyAudioId;
|
|
audioData.IdleLoopAudioId = rawConfig.Cfg.IdleLoopAudioId;
|
|
audioData.walkLoopAudioId = rawConfig.Cfg.WalkLoopAudioId;
|
|
audioData.walkStopAudioId = rawConfig.Cfg.WalkStopAudioId;
|
|
audioData.deadAudioId = rawConfig.Cfg.DeadAudioId;
|
|
|
|
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;
|
|
|
|
shootCd = 1f / rawConfig.Cfg.FireRate;
|
|
|
|
maxBulletCount = rawConfig.Cfg.BulletCount;
|
|
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;
|
|
|
|
attackEndTime = rawConfig.Cfg.AttackSplitTime;
|
|
attackLoopCount = rawConfig.Cfg.AttackLoopCount;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
}
|