Minor tweaks to UI Particle system following 5.5 update
parent
d0836e3130
commit
23deee414a
|
@ -196,11 +196,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
#if UNITY_5_5_OR_NEWER
|
#if UNITY_5_5_OR_NEWER
|
||||||
float frameProgress = 1 - (particle.remainingLifetime / particle.startLifetime);
|
float frameProgress = 1 - (particle.remainingLifetime / particle.startLifetime);
|
||||||
|
frameProgress = _textureSheetAnimation.frameOverTime.curveMin.Evaluate(1 - (particle.remainingLifetime / particle.startLifetime)); // TODO - once Unity allows MinMaxCurve reading
|
||||||
#else
|
#else
|
||||||
float frameProgress = 1 - (particle.lifetime / particle.startLifetime);
|
float frameProgress = 1 - (particle.lifetime / particle.startLifetime);
|
||||||
#endif
|
|
||||||
// float frameProgress = textureSheetAnimation.frameOverTime.curveMin.Evaluate(1 - (particle.lifetime / particle.startLifetime)); // TODO - once Unity allows MinMaxCurve reading
|
|
||||||
frameProgress = Mathf.Repeat(frameProgress * _textureSheetAnimation.cycleCount, 1);
|
frameProgress = Mathf.Repeat(frameProgress * _textureSheetAnimation.cycleCount, 1);
|
||||||
|
#endif
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
|
|
||||||
switch (_textureSheetAnimation.animation)
|
switch (_textureSheetAnimation.animation)
|
||||||
|
@ -214,9 +214,13 @@ namespace UnityEngine.UI.Extensions
|
||||||
frame = Mathf.FloorToInt(frameProgress * _textureSheetAnimation.numTilesX);
|
frame = Mathf.FloorToInt(frameProgress * _textureSheetAnimation.numTilesX);
|
||||||
|
|
||||||
int row = _textureSheetAnimation.rowIndex;
|
int row = _textureSheetAnimation.rowIndex;
|
||||||
// if (textureSheetAnimation.useRandomRow) { // FIXME - is this handled internally by rowIndex?
|
#if UNITY_5_5_OR_NEWER
|
||||||
// row = Random.Range(0, textureSheetAnimation.numTilesY, using: particle.randomSeed);
|
if (_textureSheetAnimation.useRandomRow)
|
||||||
// }
|
{
|
||||||
|
Random.InitState((int)particle.randomSeed);
|
||||||
|
row = Random.Range(0, _textureSheetAnimation.numTilesY);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
frame += row * _textureSheetAnimation.numTilesX;
|
frame += row * _textureSheetAnimation.numTilesX;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue