feat(gameplay): 实现召唤师对决模式核心功能

- 新增召唤师对决管理模式,支持点卡片直接召唤单位
- 添加召唤师点地移动控制,移动时不攻击、站定时自动攻击
- 实现召唤师模式开关,单位不再自动追击远处敌人
- 更新卡牌按钮逻辑,对决模式下按能量消耗直接召唤
- 修改单位基础行为,支持移动中不攻击的召唤师模式
- 更新核心玩法文档,从建筑生产模式转向召唤师对决模式
- 添加召唤师对决测试场景,整合新的战斗逻辑
```
This commit is contained in:
huadexuan committed 2026-09-16 18:16:13 +08:00
1 parent 1cdb7c3910
commit f06a1d8f92
21 files changed
+870 -220

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: XXMf4Sr4WiqPxdnTrjn9FdzKz7CqmKicQSn0NFVDnCyDO6WMWFJD2dg=
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,220 @@
%YAML 1.1
%TAG !u! tag:yousandi.cn,2023:
--- !u!1 &7776896532109503703
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 7
m_Component:
- component: {fileID: 286193082999517309}
m_Layer: 0
m_HasEditorInfo: 1
m_Name: attackPos
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &286193082999517309
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7776896532109503703}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.019, y: 0.283, z: 0.069}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1444656758206389486}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &989067199113700134
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalPosition.x
value: -0.8
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.9
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_Name
value: "\u53EC\u5524\u5E08\u4E3B\u89D2"
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
propertyPath: m_TagString
value: Player
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 1852576806548013000, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
insertIndex: -1
addedObject: {fileID: 286193082999517309}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
insertIndex: -1
addedObject: {fileID: 5899466420499838505}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
insertIndex: -1
addedObject: {fileID: 8874205787751956438}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
insertIndex: -1
addedObject: {fileID: 6516315820976732023}
m_SourcePrefab: {fileID: 100100000, guid: 6b859b567d8ba4a7a87c03aa4b87c18c, type: 3}
--- !u!1 &106035464483675767 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
m_PrefabInstance: {fileID: 989067199113700134}
m_PrefabAsset: {fileID: 0}
--- !u!95 &5899466420499838505
Animator:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 106035464483675767}
m_Enabled: 1
m_Avatar: {fileID: 9000000, guid: 6b859b567d8ba4a7a87c03aa4b87c18c, type: 3}
m_Controller: {fileID: 22100000, guid: ca1bd6051433541cfa22bac24d4a1103, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_UpdateFrequencyMode: 0
m_UpdateFrequency: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!114 &8874205787751956438
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 106035464483675767}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e370e6a2ddc454f8c8837028614c86d7, type: 3}
m_Name:
m_EditorClassIdentifier:
attackRange: 8
detectRange: 10
attackPower: 50
attackInterval: 2
modelFacingOffset: 90
useRootMotion: 1
projectilePrefab: {fileID: 6786356955586915818, guid: e491f7d23e3cd4069823405c487be19f,
type: 3}
attackPos: {fileID: 286193082999517309}
summonableCharacters:
- {fileID: 11400000, guid: 6f138ec1db2b741aab394542890c7400, type: 2}
- {fileID: 11400000, guid: 5a726a224ff5b46718f8f4fc75299bca, type: 2}
- {fileID: 11400000, guid: 51d1dacb02fc441fa9bbea4443e50967, type: 2}
- {fileID: 11400000, guid: 6a793da90a16b4d0c97ab9c3af691849, type: 2}
- {fileID: 11400000, guid: 49f7e9a7946834177a8dce1ef1c5edb9, type: 2}
summonDistance: 1.5
summonSideOffset: 0.8
summonSearchStep: 0.8
summonSearchCount: 5
summonDepthSearchStep: 1
summonDepthSearchCount: 2
summonAnimationTimeout: 2.5
projectileSpeed: 12
projectileLifetime: 5
--- !u!114 &6516315820976732023
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 106035464483675767}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9355c53f591d4459ea620fc8191efa17, type: 3}
m_Name:
m_EditorClassIdentifier:
maxHealth: 300
currentHealth: 300
maxEnergy: 100
_currentEnergy: 0
heightOffset: 0.25
barWidth: 1.2
borderColor: {r: 0.03, g: 0.03, b: 0.03, a: 0.95}
deathEffectDuration: 1.1
deathEffectColor: {r: 0.55, g: 0.9, b: 1, a: 1}
showDamageNumbers: 1
damageNumberDuration: 0.8
damageNumberRiseHeight: 1.2
damageNumberSpawnHeight: 1.5
damageNumberSize: 0.09
--- !u!4 &1444656758206389486 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1852576806548013000, guid: 6b859b567d8ba4a7a87c03aa4b87c18c,
type: 3}
m_PrefabInstance: {fileID: 989067199113700134}
m_PrefabAsset: {fileID: 0}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: CH9NsSqqVnqFjFbGA8nYsMTtB1V8QYYj+f2/XGK8gFxQUJ1gLpYP0cw=
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: Xn0f5ir8VS6B22vrUeDxX6zyjPoPyJCwnujSqZKSP5RfDlB/o9Ks2sI=
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+102
View File
@@ -0,0 +1,102 @@
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 战斗管理器:监听双方召唤师死亡,触发胜负判定并显示结果 UI。
/// </summary>
public class BattleManager : MonoBehaviour
{
[Header("召唤师引用")]
public GameObject playerSummoner;
public GameObject enemySummoner;
[Header("胜负 UI")]
public GameObject victoryPanel;
public GameObject defeatPanel;
private WorldHealthBar playerHealthBar;
private WorldHealthBar enemyHealthBar;
private bool battleEnded = false;
private void Start()
{
// 获取双方召唤师的血条组件
if (playerSummoner != null)
{
playerHealthBar = playerSummoner.GetComponent<WorldHealthBar>();
}
if (enemySummoner != null)
{
enemyHealthBar = enemySummoner.GetComponent<WorldHealthBar>();
}
// 隐藏胜负 UI
if (victoryPanel != null) victoryPanel.SetActive(false);
if (defeatPanel != null) defeatPanel.SetActive(false);
}
private void Update()
{
if (battleEnded) return;
// 检测己方召唤师死亡
if (playerHealthBar != null && playerHealthBar.IsDead)
{
OnBattleEnd(false);
return;
}
// 检测敌方召唤师死亡
if (enemyHealthBar != null && enemyHealthBar.IsDead)
{
OnBattleEnd(true);
return;
}
}
private void OnBattleEnd(bool victory)
{
battleEnded = true;
// 暂停游戏
Time.timeScale = 0f;
// 显示对应 UI
if (victory)
{
Debug.Log("胜利!");
if (victoryPanel != null)
{
victoryPanel.SetActive(true);
}
}
else
{
Debug.Log("失败!");
if (defeatPanel != null)
{
defeatPanel.SetActive(true);
}
}
}
// 重新开始按钮回调
public void OnRestartButtonClicked()
{
Time.timeScale = 1f;
UnityEngine.SceneManagement.SceneManager.LoadScene(
UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
}
// 退出按钮回调
public void OnQuitButtonClicked()
{
Time.timeScale = 1f;
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: Di4etymsUXvNaAtAYCGTjqWlsQBo5CkpSQWOamGKNe31K6x/sOO8dpY=
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -206,6 +206,23 @@ public class MainCharacterCombat : MonoBehaviour
return true;
}
// 召唤师对决模式:点卡片按 CharacterData 直接召唤(能量消耗在 RequestSummon 同路径处理)。
public bool RequestSummonByData(CharacterData characterData)
{
if (summoning || animator == null || characterData == null || characterData.unitPrefab == null)
{
return false;
}
int index = System.Array.IndexOf(summonableCharacters, characterData);
if (index < 0)
{
return false;
}
return RequestSummon(index + 1);
}
private void BeginSummon(GameObject prefab, CharacterData characterData, PlayerCharacterData playerData)
{
if (prefab == null)
+16
View File
@@ -79,6 +79,16 @@ public class SummonCardButton : MonoBehaviour
return;
}
// 召唤师对决模式:点卡片直接在召唤师身边召唤,消耗能量。
if (SummonerDuelManager.Instance != null)
{
if (SummonerDuelManager.Instance.TrySummon(characterData))
{
StartCooldown();
}
return;
}
// 建筑模式:检查建筑费用是否足够
if (GoldSystem.Instance == null || GoldSystem.Instance.CurrentGold < characterData.buildingCost)
{
@@ -163,6 +173,12 @@ public class SummonCardButton : MonoBehaviour
return BattleSetupManager.Instance.CanAfford(characterData);
}
// 召唤师对决模式按能量判断。
if (SummonerDuelManager.Instance != null)
{
return SummonerDuelManager.Instance.CanAfford(characterData);
}
// 建筑模式按金币判断。
if (GoldSystem.Instance == null)
{
+157
View File
@@ -0,0 +1,157 @@
using UnityEngine;
using UnityEngine.EventSystems;
/// <summary>
/// 召唤师对决:召唤师点地移动操控(直线移动,无寻路)。
/// 点击己方区域地面 → 直线走到目标点(clamp 在己方带内)。
/// 移动时不攻击;站定后自动攻击射程内目标。
/// </summary>
public class SummonerClickMovement : MonoBehaviour
{
[Header("己方半场 clamp(世界坐标)")]
public float minX = -9f;
public float maxX = 9f;
public float minZ = -29f;
public float maxZ = -11f;
[Header("移动速度")]
public float moveSpeed = 5f;
public float stopDistance = 0.2f;
[Header("地面射线")]
public LayerMask groundMask = ~0;
private Camera mainCamera;
private MainCharacterCombat combat;
private Animator animator;
private Vector3 targetPosition;
private bool hasTarget;
private void Awake()
{
combat = GetComponent<MainCharacterCombat>();
animator = GetComponent<Animator>();
}
private void Start()
{
mainCamera = Camera.main;
}
private void Update()
{
HandleClickToMove();
HandleMovement();
}
// 点地移动:点击地面即设置目标点(EventSystem 判定不在 UI 上时才生效)。
private void HandleClickToMove()
{
if (Input.GetMouseButtonDown(0) && !IsPointerOverUI())
{
if (RaycastGround(out Vector3 groundPoint))
{
Vector3 clamped = ClampToOwnHalf(groundPoint);
MoveTo(clamped);
}
}
}
// 执行直线移动
private void HandleMovement()
{
if (!hasTarget) return;
Vector3 currentPos = transform.position;
Vector3 direction = targetPosition - currentPos;
direction.y = 0f;
float distance = direction.magnitude;
// 到达目标
if (distance <= stopDistance)
{
ClearTarget();
return;
}
// 移动
direction.Normalize();
transform.position += direction * moveSpeed * Time.deltaTime;
// 朝向移动方向
if (direction.sqrMagnitude > 0.001f)
{
transform.rotation = Quaternion.LookRotation(direction, Vector3.up);
}
// 播放走路动画
if (animator != null)
{
animator.SetInteger("speed", 1);
}
}
// 外部入口:把召唤师移动到某点(clamp 后设置目标)。
public void MoveTo(Vector3 worldPosition)
{
Vector3 clamped = ClampToOwnHalf(worldPosition);
targetPosition = clamped;
targetPosition.y = transform.position.y; // 保持 Y 不变
hasTarget = true;
// 移动中暂停攻击(防风筝规则)
if (combat != null)
{
combat.enabled = false;
}
}
public void ClearTarget()
{
hasTarget = false;
// 停止动画
if (animator != null)
{
animator.SetInteger("speed", 0);
}
// 站定后恢复自动攻击
if (combat != null)
{
combat.enabled = true;
}
}
// 半场 clamp:X 与 Z 均限制在己方带内。
private Vector3 ClampToOwnHalf(Vector3 position)
{
return new Vector3(
Mathf.Clamp(position.x, minX, maxX),
position.y,
Mathf.Clamp(position.z, minZ, maxZ));
}
private bool RaycastGround(out Vector3 point)
{
point = Vector3.zero;
if (mainCamera == null)
{
mainCamera = Camera.main;
if (mainCamera == null) return false;
}
Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit, 200f, groundMask.value))
{
point = hit.point;
return true;
}
return false;
}
private bool IsPointerOverUI()
{
return EventSystem.current != null && EventSystem.current.IsPointerOverGameObject();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: D3MZ53/+Bi5T65J7i/sGjy4OrNmkAPexctr/dMT82/ffKFb1P6oQ0Co=
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+52
View File
@@ -0,0 +1,52 @@
using UnityEngine;
/// <summary>
/// 召唤师对决模式:点卡片直接在召唤师身边召唤单位(能量消耗 + 卡片冷却沿用现有系统)。
/// 复用 SummonCardButton 的点击入口:无 BattleSetupManager、无 GoldSystem 时走本模式。
/// </summary>
public class SummonerDuelManager : MonoBehaviour
{
public static SummonerDuelManager Instance { get; private set; }
[Header("召唤师")]
public MainCharacterCombat summonerCombat;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
}
private void Start()
{
if (summonerCombat == null)
{
summonerCombat = FindObjectOfType<MainCharacterCombat>();
}
}
// 卡片点击入口:能量足够时由召唤师执行召唤动画与生成。
public bool TrySummon(CharacterData data)
{
if (summonerCombat == null)
{
Debug.LogError("找不到召唤师 MainCharacterCombat");
return false;
}
// RequestSummon 内部走能量判断(TryConsumeMana)与召唤动画。
return summonerCombat.RequestSummonByData(data);
}
// 卡片可用性:能量是否足够(供 SummonCardButton 判断置灰)。
public bool CanAfford(CharacterData data)
{
return data != null
&& ManaSystem.Instance != null
&& ManaSystem.Instance.CurrentManaInt >= data.manaCost;
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: DCtO4X/+USoIwkGoI7+2kj00a9R1yMRAYBXPILcLhDHrIqmIIORGtp8=
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+54
View File
@@ -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)}";
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: CilJ4H+sVH2HTBsacd3p++uNBi+u613d+RUcMwWW0wsoqCmwgU2DNms=
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+36 -1
View File
@@ -72,6 +72,13 @@ public class UnitBase : MonoBehaviour
[Min(0f)] public float separationWeight = 3f;
[Min(0f)] public float targetSpreadBias = 6f;
[Header("召唤师模式")]
// 召唤师:不自动追击远处敌人,只在站定后攻击射程内的目标;移动由 SummonerClickMovement 控制。
public bool summonerMode = false;
//召唤师模式下允许自动攻击的开关(移动时由操控脚本关闭,站定时开启)。
private bool summonerAttackEnabled = true;
private static Collider[] s_separationBuffer = new Collider[30];
//角色状态
@@ -243,6 +250,20 @@ public class UnitBase : MonoBehaviour
target = FindNearestOpponent();
if (target != null)
{
// 召唤师模式:不主动追击,站定且攻击开关开启时才攻击射程内目标。
if (summonerMode)
{
if (!IsWithinAttackReach(target) || !summonerAttackEnabled)
{
state = State.Alert;
// 动画由 SummonerClickMovement 控制,这里不设置
applyGravity();
return;
}
attack(target);
return;
}
state = State.Track;
//目标在攻击范围外则朝目标移动,否则开始攻击
@@ -260,7 +281,11 @@ public class UnitBase : MonoBehaviour
//场上没有敌人时进入待机,不再巡逻移动
state = State.Alert;
animator.SetInteger("speed", 0);
// 召唤师模式下动画由 SummonerClickMovement 控制(移动时 speed=1,站定后 speed=0)
if (!summonerMode)
{
animator.SetInteger("speed", 0);
}
applyGravity();
}
@@ -268,6 +293,16 @@ public class UnitBase : MonoBehaviour
public string OpponentTag => GetOpponentTag();
// 召唤师模式下控制"移动中不攻击":移动时 false,站定后 true。
public void SetSummonerAttackEnabled(bool enabled)
{
summonerAttackEnabled = enabled;
if (!enabled && state == State.Track)
{
state = State.Alert;
}
}
public float AttackSpeedMultiplier => attackSpeedMultiplier;
public bool IsStunned => statusEffectController != null && statusEffectController.IsStunned;
+3
View File
@@ -89,6 +89,9 @@ public class WorldHealthBar : MonoBehaviour
// 防止死亡逻辑重复执行。
private bool isDead;
// 公开死亡状态供外部查询(用于胜负判定)
public bool IsDead => isDead;
// 初始化血量和血条 UI。
private void Awake()
{