Add FloorVisibilityManager for dynamic floor visibility management and update material properties for transparency effects
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user