Example #1
0
 private static int[] RowsToCheckForSweep(Tetramino tetramino)
 {
     Vector2Int[] absPoses = tetramino.AbsPoses;
     int[]        rowsToCheckForSweepNotUnique = LoopUtil.LoopFunc <int>((i) => absPoses[i].y, 4);
     int[]        rowsToCheckForSweepUnique    = rowsToCheckForSweepNotUnique.Distinct().OrderBy(i => i).ToArray();
     return(rowsToCheckForSweepUnique);
 }
 public static T[] GetComponentsInChildren <T>(Transform transform, out int childCount)
 {
     Transform[] children = TransformUtil.GetChildren(transform);
     childCount = children.Length;
     T[] components =
         LoopUtil.LoopFunc <T>((i) => children[i].GetComponent <T>(), childCount);
     return(components);
 }
    private static SpriteRenderer[] GetSpriteRenderers(Transform transform, out int length)
    {
        Transform[] children   = TransformUtil.GetChildren(transform);
        int         childCount = children.Length;

        SpriteRenderer[] spriteRenderers =
            LoopUtil.LoopFunc <SpriteRenderer>((i) => children[i].GetComponent <SpriteRenderer>(), childCount);
        length = childCount;
        return(spriteRenderers);
    }
Example #4
0
    public static Transform[] GetChildren(Transform transform)
    {
        int childCount = transform.childCount;

        return(LoopUtil.LoopFunc <Transform>((i) => transform.GetChild(i), childCount));
    }
    public static Vector2[] Multiply(Vector2Int[] vectorArray, float multiplier)
    {
        int length = vectorArray.Length;

        return(LoopUtil.LoopFunc <Vector2>((i) => (Vector2)vectorArray[i] * multiplier, length));
    }