Add FloorVisibilityManager for dynamic floor visibility management and update material properties for transparency effects

This commit is contained in:
2025-12-13 01:35:22 +01:00
parent 189bbb7ae7
commit 7b1eb645ef
13 changed files with 348 additions and 24 deletions

View File

@@ -31,6 +31,7 @@ namespace Infrastructure.Unity
private static readonly int EmissionColorProperty = Shader.PropertyToID("_EmissionColor");
private Action<TileViewAdapter> _onReturnToPool;
private float _targetAlpha = 1f;
private void Awake()
{
@@ -115,9 +116,23 @@ namespace Infrastructure.Unity
StartCoroutine(PulseScaleRoutine());
}
public void SetAlpha(float alpha)
{
_targetAlpha = alpha;
meshRenderer.GetPropertyBlock(_propBlock);
var currentColor = _propBlock.GetColor(ColorProperty);
currentColor.a = _targetAlpha;
_propBlock.SetColor(ColorProperty, currentColor);
meshRenderer.SetPropertyBlock(_propBlock);
}
private void SetColor(Color color)
{
meshRenderer.GetPropertyBlock(_propBlock);
color.a = _targetAlpha;
_propBlock.SetColor(ColorProperty, color);
meshRenderer.SetPropertyBlock(_propBlock);
}