Use property id

This commit is contained in:
Noah Pilarski 2022-07-16 20:01:06 -04:00
parent 72d5bc196e
commit fedb3c9057

View File

@ -55,6 +55,7 @@ namespace NewHorizons.Components.SizeControllers
private float maxScale;
private float minScale;
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
private static readonly int ColorTime = Shader.PropertyToID("_ColorTime");
private Color _currentColour;
@ -159,18 +160,20 @@ namespace NewHorizons.Components.SizeControllers
{
_currentColour = Color.Lerp(_startColour, _endColour, t);
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t);
supernova._surface._materials[0].SetFloat("_ColorTime", t);
supernova._surface._materials[0].SetFloat(ColorTime, t);
}
else
{
_currentColour = _endColour;
supernova._surface._materials[0].SetFloat("_ColorTime", 1);
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, 1);
supernova._surface._materials[0].SetFloat(ColorTime, 1);
}
}
else
{
_currentColour = _startColour;
supernova._surface._materials[0].SetFloat("_ColorTime", 0);
supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, 0);
supernova._surface._materials[0].SetFloat(ColorTime, 0);
}
if (_flareEmitter != null) _flareEmitter._tint = _currentColour;