```
feat(gameplay): 实现召唤师对决模式核心功能 - 新增召唤师对决管理模式,支持点卡片直接召唤单位 - 添加召唤师点地移动控制,移动时不攻击、站定时自动攻击 - 实现召唤师模式开关,单位不再自动追击远处敌人 - 更新卡牌按钮逻辑,对决模式下按能量消耗直接召唤 - 修改单位基础行为,支持移动中不攻击的召唤师模式 - 更新核心玩法文档,从建筑生产模式转向召唤师对决模式 - 添加召唤师对决测试场景,整合新的战斗逻辑 ```
This commit is contained in:
1 parent
1cdb7c3910
commit
f06a1d8f92
21 files changed
+870
-220
No files matched your search
@@ -0,0 +1,54 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// 召唤师专属血条 UI:顶部 HUD 显示双方召唤师血量,区别于单位头顶血条。
|
||||
/// </summary>
|
||||
public class SummonerHealthBarUI : MonoBehaviour
|
||||
{
|
||||
[Header("UI 引用")]
|
||||
public Image playerHealthFill;
|
||||
public Image enemyHealthFill;
|
||||
public Text playerHealthText;
|
||||
public Text enemyHealthText;
|
||||
|
||||
[Header("召唤师引用")]
|
||||
public GameObject playerSummoner;
|
||||
public GameObject enemySummoner;
|
||||
|
||||
private WorldHealthBar playerHealthBar;
|
||||
private WorldHealthBar enemyHealthBar;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// 获取双方召唤师的血条组件
|
||||
if (playerSummoner != null)
|
||||
{
|
||||
playerHealthBar = playerSummoner.GetComponent<WorldHealthBar>();
|
||||
}
|
||||
|
||||
if (enemySummoner != null)
|
||||
{
|
||||
enemyHealthBar = enemySummoner.GetComponent<WorldHealthBar>();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateHealthBar(playerHealthBar, playerHealthFill, playerHealthText);
|
||||
UpdateHealthBar(enemyHealthBar, enemyHealthFill, enemyHealthText);
|
||||
}
|
||||
|
||||
private void UpdateHealthBar(WorldHealthBar healthBar, Image fillImage, Text healthText)
|
||||
{
|
||||
if (healthBar == null || fillImage == null) return;
|
||||
|
||||
float ratio = healthBar.currentHealth / healthBar.maxHealth;
|
||||
fillImage.fillAmount = ratio;
|
||||
|
||||
if (healthText != null)
|
||||
{
|
||||
healthText.text = $"{Mathf.CeilToInt(healthBar.currentHealth)}/{Mathf.CeilToInt(healthBar.maxHealth)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user