(client) feat:实现子弹定义 chore:将建筑碰撞体改为方形

This commit is contained in:
m0_75251201
2025-08-14 13:26:02 +08:00
parent 35924f3695
commit 12a4f9efaa
10 changed files with 287 additions and 10 deletions

View File

@ -98,7 +98,10 @@ namespace Entity
/// 表示实体是否已经死亡(生命值小于等于零)。
/// </summary>
public bool IsDead => attributes.health <= 0;
public bool IsShowingOfHitBarUI=>hitBarUIShowTimer > 0;
public bool IsAttacking => attackCoroutine != null;
private bool _isPlayerControlled = false;
private bool _warning = false;
@ -136,8 +139,7 @@ namespace Entity
public float hitBarUIShowTime = 5;
private float hitBarUIShowTimer = 0;
public bool isShowingOfHitBarUI=>hitBarUIShowTimer > 0;
/// <summary>
/// 初始化实体的基本属性和行为树。
@ -261,7 +263,7 @@ namespace Entity
}
}
if (isShowingOfHitBarUI)
if (IsShowingOfHitBarUI)
{
hitBarUIShowTimer -= Time.deltaTime;
if (hitBarUIShowTimer <= 0)
@ -276,7 +278,7 @@ namespace Entity
/// </summary>
public virtual void TryAttack()
{
if(attackCoroutine == null)
if(!IsAttacking)
attackCoroutine = StartCoroutine(AttackFlow());
}
@ -296,6 +298,8 @@ namespace Entity
/// </summary>
public virtual void TryMove()
{
if (IsAttacking)
return;
transform.position += direction * (attributes.moveSpeed * Time.deltaTime * (IsChase ? 1 : 0.5f));
}
@ -315,6 +319,8 @@ namespace Entity
public void ShowHealthBar()
{
if(!healthBarPrefab)
return;
healthBarPrefab.gameObject.SetActive(true);
healthBarPrefab.Progress = (float)attributes.health / entityDef.attributes.health;
hitBarUIShowTimer=hitBarUIShowTime;
@ -322,6 +328,8 @@ namespace Entity
public void HideHealthBar()
{
if(!healthBarPrefab)
return;
healthBarPrefab.gameObject.SetActive(false);
}
@ -358,7 +366,7 @@ namespace Entity
/// <summary>
/// 自动行为逻辑,根据行为树执行任务。
/// </summary>
private void AutoBehave()
protected virtual void AutoBehave()
{
if (aiTree == null)
return;