public override void ColorNormal() { float bufRunTime = Reverse ? (maxTime - runTime) : runTime; float value = 0, r = 0, g = 0, b = 0, a = 0; Color[] bufColors = new Color[Group.Length]; switch (Way) { case Ways.Value: value = Curve.Evaluate(bufRunTime); for (int i = 0; i < Group.Length; i++) { bufColors[i] = originalColor[i] + distanceColor[i] * value; } break; case Ways.Curve: r = RCurve.Evaluate(bufRunTime); g = GCurve.Evaluate(bufRunTime); b = BCurve.Evaluate(bufRunTime); a = ACurve.Evaluate(bufRunTime); for (int i = 0; i < Group.Length; i++) { Color color = new Color(r, g, b, a); bufColors[i] = originalColor[i] + distanceColor[i] * color; } break; } switch (Type) { case Types.Image: for (int i = 0; i < Group.Length; i++) { Group[i].GetComponent <Image>().color = bufColors[i]; } break; case Types.Text: for (int i = 0; i < Group.Length; i++) { Group[i].GetComponent <Text>().color = bufColors[i]; } break; case Types.Sprite: for (int i = 0; i < Group.Length; i++) { Group[i].GetComponent <SpriteRenderer>().color = bufColors[i]; } break; case Types.Shadow: for (int i = 0; i < Group.Length; i++) { Group[i].GetComponent <Shadow>().effectColor = bufColors[i]; } break; case Types.RawImage: for (int i = 0; i < Group.Length; i++) { Group[i].GetComponent <RawImage>().color = bufColors[i]; } break; } #region 半程判断 if (runTime <= maxTime * 0.5f) { if (!isCenter) { isCenter = true; } } else { if (isCenter) { isCenter = false; if (OnCenter != null) { OnCenter(); } } } #endregion #region 循环判断 if (runTime >= maxTime) { if (!Loop) { isOpen = false; if (OnOver != null) { OnOver(); } } else { bufLoopCount--; if (bufLoopCount > 0 | bufLoopCount < 0) { runTime = 0f; if (OnLoop != null) { OnLoop(); } } else { isOpen = false; if (OnOver != null) { OnOver(); } bufLoopCount = LoopCount; } } } #endregion }
public override void ColorNormal() { float bufRunTime = Reverse ? (maxTime - runTime) : runTime; //跑曲线,反向or正向[x轴] float value = 0, r = 0, g = 0, b = 0, a = 0; switch (Way) { case Ways.Value: value = Curve.Evaluate(bufRunTime); for (int i = 0; i < material.Length; i++) { material[i].SetColor(Type.ToString(), originalColor[i] + distanceColor[i] * value); } break; case Ways.Curve: r = RCurve.Evaluate(bufRunTime); g = GCurve.Evaluate(bufRunTime); b = BCurve.Evaluate(bufRunTime); a = ACurve.Evaluate(bufRunTime); for (int i = 0; i < material.Length; i++) { Color color = new Color(r, g, b, a); material[i].SetColor(Type.ToString(), originalColor[i] + distanceColor[i] * color); } break; } #region 半程判断 if (runTime <= maxTime * 0.5f) { if (!isCenter) { isCenter = true; } } else { if (isCenter) { isCenter = false; if (OnCenter != null) { OnCenter(); } } } #endregion if (runTime >= maxTime) { if (!Loop) { isOpen = false; if (OnOver != null) { OnOver(); } } else { bufLoopCount--; if (bufLoopCount > 0 | bufLoopCount < 0) { runTime = 0f; if (OnLoop != null) { OnLoop(); } } else { isOpen = false; if (OnOver != null) { OnOver(); } bufLoopCount = LoopCount; } } } }