调整 convert.py 转换逻辑 + 规划后续开发
This commit is contained in:
@@ -11,8 +11,6 @@ namespace Entity.Weapon
|
||||
{
|
||||
public partial class WeaponKnife : WeaponBase
|
||||
{
|
||||
private const string HitRadiusParamKey = "HitRadius";
|
||||
|
||||
private WeaponKnifeData _weaponData;
|
||||
|
||||
private Quaternion _cachedRotation;
|
||||
@@ -157,14 +155,8 @@ namespace Entity.Weapon
|
||||
_sqrRange = _weaponData.AttackRange * _weaponData.AttackRange;
|
||||
_cachedRotation = CachedTransform.rotation;
|
||||
|
||||
if (_weaponData.TryGetParam(HitRadiusParamKey, out string hitRadiusRaw))
|
||||
{
|
||||
_hitRadius = Mathf.Max(0.1f, float.Parse(hitRadiusRaw));
|
||||
}
|
||||
else
|
||||
{
|
||||
_hitRadius = _weaponData.AttackRange;
|
||||
}
|
||||
float configuredHitRadius = _weaponData.ParamsData != null ? _weaponData.ParamsData.HitRadius : 0f;
|
||||
_hitRadius = configuredHitRadius > 0f ? Mathf.Max(0.1f, configuredHitRadius) : _weaponData.AttackRange;
|
||||
|
||||
_hitRadiusSqr = _hitRadius * _hitRadius;
|
||||
_attackEffect = new KnifeRangeAttackEffect();
|
||||
|
||||
+7
-15
@@ -11,8 +11,6 @@ namespace Entity.Weapon
|
||||
{
|
||||
public partial class WeaponLightning : WeaponBase
|
||||
{
|
||||
private const string HitRadiusParamKey = "HitRadius";
|
||||
|
||||
private WeaponLightningData _weaponData;
|
||||
|
||||
private Quaternion _cachedRotation;
|
||||
@@ -178,8 +176,14 @@ namespace Entity.Weapon
|
||||
_sqrRange = _weaponData.AttackRange * _weaponData.AttackRange;
|
||||
_cachedRotation = CachedTransform.rotation;
|
||||
|
||||
_hitRadius = ReadPositiveParam(HitRadiusParamKey, _weaponData.AttackRange);
|
||||
float configuredHitRadius = _weaponData.ParamsData != null ? _weaponData.ParamsData.HitRadius : 0f;
|
||||
_hitRadius = configuredHitRadius > 0f ? Mathf.Max(0.1f, configuredHitRadius) : _weaponData.AttackRange;
|
||||
_hitRadiusSqr = _hitRadius * _hitRadius;
|
||||
float configuredHoverHeight = _weaponData.ParamsData != null ? _weaponData.ParamsData.HoverHeight : 0f;
|
||||
if (configuredHoverHeight > 0f)
|
||||
{
|
||||
_hoverHeight = Mathf.Max(0.1f, configuredHoverHeight);
|
||||
}
|
||||
|
||||
int colliderCapacity = Mathf.Max(1, _maxHitColliders);
|
||||
if (_hitResults == null || _hitResults.Length != colliderCapacity)
|
||||
@@ -228,18 +232,6 @@ namespace Entity.Weapon
|
||||
}
|
||||
}
|
||||
|
||||
private float ReadPositiveParam(string paramName, float defaultValue)
|
||||
{
|
||||
if (_weaponData.Params != null &&
|
||||
_weaponData.Params.TryGetValue(paramName.ToLower(), out string rawValue) &&
|
||||
float.TryParse(rawValue, out float parsedValue))
|
||||
{
|
||||
return Mathf.Max(0.1f, parsedValue);
|
||||
}
|
||||
|
||||
return Mathf.Max(0.1f, defaultValue);
|
||||
}
|
||||
|
||||
private void StopAttackTween(bool resetTransform)
|
||||
{
|
||||
if (_attackSequence != null)
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace Entity.Weapon
|
||||
{
|
||||
#region Property
|
||||
|
||||
private const string SectorAngleParamKey = "SectorAngle";
|
||||
|
||||
private WeaponSlashData _weaponData;
|
||||
|
||||
private Quaternion _cachedRotation;
|
||||
@@ -184,15 +182,8 @@ namespace Entity.Weapon
|
||||
_attackRadius = Mathf.Max(0.1f, _weaponData.AttackRange);
|
||||
_attackRadiusSqr = _attackRadius * _attackRadius;
|
||||
|
||||
_sectorAngle = 90f;
|
||||
if (_weaponData.Params != null &&
|
||||
_weaponData.Params.TryGetValue(SectorAngleParamKey.ToLower(), out string rawAngle))
|
||||
{
|
||||
if (float.TryParse(rawAngle, out float parsedAngle))
|
||||
{
|
||||
_sectorAngle = Mathf.Clamp(parsedAngle, 1f, 360f);
|
||||
}
|
||||
}
|
||||
float configuredSectorAngle = _weaponData.ParamsData != null ? _weaponData.ParamsData.SectorAngle : 0f;
|
||||
_sectorAngle = configuredSectorAngle > 0f ? Mathf.Clamp(configuredSectorAngle, 1f, 360f) : 90f;
|
||||
|
||||
int capacity = Mathf.Max(1, _maxHitColliders);
|
||||
if (_hitResults == null || _hitResults.Length != capacity)
|
||||
|
||||
Reference in New Issue
Block a user