(client) chore:修复子弹属性错误,人物属性错误,侧边消息堆叠错误

This commit is contained in:
m0_75251201
2025-09-08 09:24:32 +08:00
parent 379ed07773
commit 6cb4483d20
9 changed files with 122 additions and 6171 deletions

View File

@ -6,9 +6,17 @@ namespace Entity
{
public class Bullet : Entity
{
public Entity bulletSource;
public Entity bulletSource { get; private set; }
public float lifeTime = 10;
public void SetBulletSource(Entity source)
{
bulletSource = source;
attributes.attack = source.attributes.attack;
}
public override void SetTarget(Vector3 pos)
{
base.SetTarget(pos);

View File

@ -7,6 +7,24 @@ namespace Entity
{
public class Character : LivingEntity
{
public override Attributes defAttributes
{
get
{
var def = base.defAttributes;
var weaponDef = GetCurrentWeapon()?.Attributes;
if (weaponDef != null)
{
weaponDef.health = def.health;
weaponDef.moveSpeed = def.moveSpeed;
return weaponDef;
}
return def;
}
}
private int _currentSelected; // 私有字段用于存储实际值
/// <summary>

View File

@ -62,12 +62,14 @@ namespace Entity
protected set => _attribute = value;
}
private Attributes _baseAttributes;
public virtual Attributes baseAttributes
public virtual Attributes baseAttributes => defAttributes;
private Attributes _defAttributes;
public virtual Attributes defAttributes
{
get
{
return _baseAttributes ??= entityDef == null ? new Attributes() : new Attributes(entityDef.attributes);
return _defAttributes ??= entityDef == null ? new Attributes() : new Attributes(entityDef.attributes);
}
}
@ -392,6 +394,8 @@ namespace Entity
{
_attackTimer = weaponResource.AttackCooldown;
_attackDetectionTime = weaponResource.AttackDetectionTime;
currentAttackWeapon = weaponResource;
if (weaponResource.AttackAnimationTime > 0)
{
TemporaryAnimationManager.Instance.GenerateTemporaryAnimation(
@ -409,14 +413,13 @@ namespace Entity
HideCurrentBodyTexture();
}
currentAttackWeapon = weaponResource;
}
public void SetBodyTexture(EntityState state, Orientation orientation)
{
HideCurrentBodyTexture();
if (IsAttacking && !currentAttackWeapon.UseEntityAttackAnimation)
if (IsAttacking && currentAttackWeapon is { UseEntityAttackAnimation: false })
return;
if (bodyNodes.TryGetValue(state, out var showStateNode))
{
@ -462,7 +465,6 @@ namespace Entity
{
return;
}
var hit = from.attributes.attack - attributes.defense;
if (hit < 0)
hit = from.attributes.attack / 100;