Esempio n. 1
0
    Coordinates CoordsToRight(Coordinates coordinates, bool toRight)
    {
        //calculate new face
        coordinates.face = WorldUtility.FindFaceUpToRight(coordinates.face, toRight);

        //get coordinates x,y of face to the right or to the left
        if (toRight)
        {
            Vector2Int v = Vector2Math.EqualInverse(coordinates.x, coordinates.y, world.worldConfig.NumberCells);
            coordinates.x = v.x;
            coordinates.y = v.y;
        }
        else
        {
            Vector2Int v = Vector2Math.InverseEqual(coordinates.x, coordinates.y, world.worldConfig.NumberCells);
            coordinates.x = v.x;
            coordinates.y = v.y;
        }

        return(coordinates);
    }
Esempio n. 2
0
    Coordinates CoordsRightLeftColumn(Coordinates coordinates, bool toUp)
    {
        //calculate new face -> work the inverse, so we use !toUp
        coordinates.face = WorldUtility.FindFaceUpToRight(coordinates.face, !toUp);

        //get coordinates x,y of face to the top or face to the bottom
        if (toUp)
        {
            Vector2Int v = Vector2Math.InverseEqual(coordinates.x, coordinates.y, world.worldConfig.NumberCells);
            coordinates.x = v.x;
            coordinates.y = v.y;
        }
        else
        {
            Vector2Int v = Vector2Math.EqualInverse(coordinates.x, coordinates.y, world.worldConfig.NumberCells);
            coordinates.x = v.x;
            coordinates.y = v.y;
        }

        return(coordinates);
    }
Esempio n. 3
0
    Coordinates UpdateCoordinatesCompleteFace(Coordinates coordinates, bool forward)
    {
        if (forward)
        {
            //rotate the face, so change coordinates x and y, but not the face

            Vector2Int v = Vector2Math.InverseEqual(coordinates.x, coordinates.y, world.worldConfig.NumberCells);
            coordinates.x = v.x;
            coordinates.y = v.y;
        }
        else
        {
            //rotate the face, so change coordinates x and y, but not the face

            Vector2Int v = Vector2Math.EqualInverse(coordinates.x, coordinates.y, world.worldConfig.NumberCells);
            coordinates.x = v.x;
            coordinates.y = v.y;
        }

        return(coordinates);
    }