Beispiel #1
0
    private ISpriteDictionary GetSpriteDictionaryMock()
    {
        ISpriteDictionary spriteDictionary = Substitute.For <ISpriteDictionary>();

        spriteDictionary.GetSpriteByID(Arg.Any <int>()).Returns(GetDummySprite());
        return(spriteDictionary);
    }
Beispiel #2
0
 private Vector2[] CreateUVs(int tilesHeight, int tilesWidth, int verticesWidth, int numVertices)
 {
     Vector2[] uvCoords = new Vector2[numVertices * 4];
     for (int i = 0; i < tilesHeight; i++)
     {
         for (int j = 0; j < tilesWidth; j++)
         {
             Sprite tileSprite = spriteDictionary.GetSpriteByID(m_tiles[i][j].ID);
             //Top left corner south
             uvCoords[(i * verticesWidth + j) * 4 + 0 + 2] = tileSprite.uv[1];
             //Top right corner west
             uvCoords[(i * verticesWidth + j + 1) * 4 + 3] = tileSprite.uv[2];
             //Bottom left corner north
             uvCoords[((i + 1) * verticesWidth + j) * 4 + 0] = tileSprite.uv[3];
             //Bottom right corner east
             uvCoords[((i + 1) * verticesWidth + j + 1) * 4 + 1] = tileSprite.uv[0];
         }
     }
     return(uvCoords);
 }