private static string VectorPosesString(Tetramino.TetraminoType tetraminoType, RotationDirection rotationDirection)
    {
        Vector2Int[] tetraminoPoses      = TetraminoTransformUtil.GetPoses(tetraminoType, RotationDirection.None);
        Vector2Int[] rotationVectorPoses = new Vector2Int[4];
        Vector2      rotationPoint       = new Tetramino(tetraminoType).rotationPoint;

        for (int i = 0; i < 4; i++)
        {
            Vector2 rotated = RotateVector.Rotate(tetraminoPoses[i], rotationPoint, rotationDirection);
            rotationVectorPoses[i] = VectorUtil.V2_V2Int(rotated);
        }
        return(string.Join("\t", rotationVectorPoses));
    }
Exemple #2
0
    // rotates each point of the poses array around rotationPoint according to the rotationType
    // and returns array with rotated points
    public static Vector2Int[] RotateArray(Vector2Int[] poses, Vector2 rotationPoint, RotationType rotationType)
    {
        int length = poses.Length;

        Vector2Int[] rotatedPoses = new Vector2Int[length];
        for (int i = 0; i < length; i++)
        {
            Vector2Int pos        = poses[i];
            Vector2    rotatedPos =
                RotateVector.Rotate(pos, rotationPoint, (RotationDirection)rotationType);
            rotatedPoses[i] = VectorUtil.V2_V2Int(rotatedPos);
        }
        return(rotatedPoses);
    }