feat: 移除自适应性能相关配置并调整动画控制器 移除了Unity自适应性能(Adaptive Performance)的相关配置文件, 包括Adaptive Performance文件夹及其子目录中的所有配置文件, 同时移除了移动通知(NotificationSettings)相关配置, 以及第一章第一关(level_chapter1_level1)的关卡配置文件, 还删除了多个材质文件如AdjustableGlowOrb、AdjustableGlowOrbHalo 和Arena相关材质。另外微调了base-人类士兵.controller中状态机 的位置坐标,将x坐标从320调整为330。 ```
70 lines
2.3 KiB
C#
70 lines
2.3 KiB
C#
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 拆家版出兵管理:从城堡前方出兵点生成单位,消耗能量。
|
|
/// 替代旧的召唤师身边召唤逻辑。
|
|
/// </summary>
|
|
public class CastleSpawnManager : MonoBehaviour
|
|
{
|
|
public static CastleSpawnManager Instance { get; private set; }
|
|
|
|
[Header("出兵点(城堡前方)")]
|
|
public Transform blueSpawnPoint;
|
|
public Transform redSpawnPoint;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance != null && Instance != this) { Destroy(gameObject); return; }
|
|
Instance = this;
|
|
}
|
|
|
|
/// <summary>从指定阵营城堡出兵,消耗能量。teamId: 0=蓝, 1=红。</summary>
|
|
public bool TrySpawn(CharacterData data, int teamId)
|
|
{
|
|
if (data == null || data.unitPrefab == null) return false;
|
|
Transform spawnPoint = teamId == 0 ? blueSpawnPoint : redSpawnPoint;
|
|
if (spawnPoint == null)
|
|
{
|
|
Debug.LogError($"找不到 teamId={teamId} 的出兵点");
|
|
return false;
|
|
}
|
|
|
|
Vector3 direction = spawnPoint.forward;
|
|
direction.y = 0f;
|
|
if (direction.sqrMagnitude < 0.001f) direction = Vector3.forward;
|
|
direction.Normalize();
|
|
|
|
GameObject unit = Instantiate(
|
|
data.unitPrefab,
|
|
spawnPoint.position,
|
|
Quaternion.LookRotation(direction, Vector3.up));
|
|
|
|
// 设置阵营
|
|
UnitTeam unitTeam = unit.GetComponent<UnitTeam>();
|
|
if (unitTeam != null)
|
|
{
|
|
unitTeam.teamId = teamId;
|
|
unit.tag = teamId == 0 ? "Friend" : "Enemy";
|
|
}
|
|
|
|
// 初始化属性(默认 1 级)
|
|
UnitBase unitBase = unit.GetComponent<UnitBase>();
|
|
if (unitBase != null)
|
|
{
|
|
PlayerCharacterData playerData = new PlayerCharacterData("castle_spawn", 1, 0);
|
|
float hp = playerData.GetMaxHealth(data);
|
|
float atk = playerData.GetAttackPower(data);
|
|
float spd = playerData.GetMoveSpeed(data);
|
|
unitBase.InitializeFromPlayerData(hp, atk, spd);
|
|
}
|
|
|
|
Debug.Log($"城堡出兵: {data.characterName} teamId={teamId} pos={spawnPoint.position}");
|
|
return true;
|
|
}
|
|
|
|
public bool CanAfford(CharacterData data)
|
|
{
|
|
return data != null && data.unitPrefab != null;
|
|
}
|
|
}
|