```
feat: 移除自适应性能相关配置并调整动画控制器 移除了Unity自适应性能(Adaptive Performance)的相关配置文件, 包括Adaptive Performance文件夹及其子目录中的所有配置文件, 同时移除了移动通知(NotificationSettings)相关配置, 以及第一章第一关(level_chapter1_level1)的关卡配置文件, 还删除了多个材质文件如AdjustableGlowOrb、AdjustableGlowOrbHalo 和Arena相关材质。另外微调了base-人类士兵.controller中状态机 的位置坐标,将x坐标从320调整为330。 ```
This commit is contained in:
1 parent
13d0c80335
commit
f77fa20f82
413 files changed
+13494
-63858
No files matched your search
@@ -9,8 +9,9 @@ public class WorldHealthBar : MonoBehaviour
|
||||
// 当前生命值,范围会自动限制在 0 到 maxHealth 之间。
|
||||
[Min(0f)] public float currentHealth = 100f;
|
||||
|
||||
// 技能能量上限,所有单位默认使用100点。
|
||||
// 技能能量上限,英雄默认使用100点;没有技能的小怪可关闭能量条。
|
||||
[Header("技能能量")]
|
||||
public bool showEnergyBar = true;
|
||||
[Min(1f)] public float maxEnergy = 100f;
|
||||
|
||||
// 当前技能能量,范围会自动限制在 0 到 maxEnergy 之间。
|
||||
@@ -100,7 +101,7 @@ public class WorldHealthBar : MonoBehaviour
|
||||
maxEnergy = Mathf.Max(1f, maxEnergy);
|
||||
_currentEnergy = Mathf.Clamp(_currentEnergy, 0f, maxEnergy);
|
||||
CalculateLayout();
|
||||
CreateBar(); // 创建血条 UI 结构,但颜色在 Start() 中设置
|
||||
CreateBar(); // 创建血条 UI 结构;无技能单位只创建血条
|
||||
UpdateFill();
|
||||
UpdateEnergyFill();
|
||||
}
|
||||
@@ -397,7 +398,7 @@ public class WorldHealthBar : MonoBehaviour
|
||||
canvas.sortingOrder = 100;
|
||||
barObject.GetComponent<CanvasScaler>().dynamicPixelsPerUnit = 10f;
|
||||
barRect = barObject.GetComponent<RectTransform>();
|
||||
barRect.sizeDelta = new Vector2(PixelWidth, TotalPixelHeight);
|
||||
barRect.sizeDelta = new Vector2(PixelWidth, showEnergyBar ? TotalPixelHeight : PixelHeight);
|
||||
barRect.localScale = Vector3.one * (worldWidth / PixelWidth);
|
||||
barRect.localPosition = GetBarRootPosition();
|
||||
ApplyScaleCompensation();
|
||||
@@ -417,6 +418,12 @@ public class WorldHealthBar : MonoBehaviour
|
||||
inner.fillOrigin = 0;
|
||||
fillImage = inner;
|
||||
|
||||
if (!showEnergyBar)
|
||||
{
|
||||
energyFillImage = null;
|
||||
return;
|
||||
}
|
||||
|
||||
RectTransform energyRow = CreateRow(
|
||||
barObject.transform,
|
||||
"EnergyBar",
|
||||
@@ -455,7 +462,8 @@ public class WorldHealthBar : MonoBehaviour
|
||||
private Vector3 GetBarRootPosition()
|
||||
{
|
||||
float pixelToWorld = worldWidth / PixelWidth;
|
||||
float worldEnergyOffset = (TotalPixelHeight - PixelHeight) * 0.5f * pixelToWorld;
|
||||
int barHeight = showEnergyBar ? TotalPixelHeight : PixelHeight;
|
||||
float worldEnergyOffset = (barHeight - PixelHeight) * 0.5f * pixelToWorld;
|
||||
float localEnergyOffset = transform.lossyScale.y != 0f
|
||||
? worldEnergyOffset / transform.lossyScale.y
|
||||
: worldEnergyOffset;
|
||||
@@ -539,27 +547,24 @@ public class WorldHealthBar : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 创建并缓存一个带圆角的白色 Sprite,供边框和填充复用。
|
||||
// 创建并缓存一个直角矩形白色 Sprite,供边框和填充复用。
|
||||
private static Sprite RoundedSprite()
|
||||
{
|
||||
if (roundedSprite != null) return roundedSprite;
|
||||
|
||||
const int width = 64;
|
||||
const int height = 16;
|
||||
const float radius = 5f;
|
||||
Texture2D texture = new Texture2D(width, height, TextureFormat.RGBA32, false);
|
||||
texture.wrapMode = TextureWrapMode.Clamp;
|
||||
texture.filterMode = FilterMode.Bilinear;
|
||||
texture.hideFlags = HideFlags.HideAndDontSave;
|
||||
|
||||
// 填充纯白色,无圆角
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
float dx = Mathf.Max(Mathf.Max(radius - x, 0f), x - (width - 1 - radius));
|
||||
float dy = Mathf.Max(Mathf.Max(radius - y, 0f), y - (height - 1 - radius));
|
||||
bool inside = dx * dx + dy * dy <= radius * radius;
|
||||
texture.SetPixel(x, y, inside ? Color.white : Color.clear);
|
||||
texture.SetPixel(x, y, Color.white);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user