private void SetColor(Tetramino.TetraminoType type) { int childCount; SpriteRenderer[] spriteRenderers = GetComponentUtil.GetComponentsInChildren <SpriteRenderer>(transform, out childCount); LoopUtil.LoopAction((i) => spriteRenderers[i].color = TetraminoUtil.Color(type), childCount); }
public void SetOpacity(float opacity) { int childCount; SpriteRenderer[] spriteRenderers = GetComponentUtil.GetComponentsInChildren <SpriteRenderer>(transform, out childCount); LoopUtil.LoopAction((i) => spriteRenderers[i].color = ColorUtil.ColorWithOpacity(spriteRenderers[i].color, opacity), childCount); }