add Tile.GetTransformationFor() overload returning a nullable Matrix4x4

This commit is contained in:
Gered 2013-08-25 19:56:23 -04:00
parent 4946006e8d
commit c48e99127a
2 changed files with 16 additions and 2 deletions

View file

@ -58,8 +58,7 @@ namespace Blarg.GameFramework.TileMap
position.Y = y + (int)chunk.Position.Y;
position.Z = z + (int)chunk.Position.Z;
Matrix4x4 transform = Matrix4x4.Identity;
Tile.GetTransformationFor(tile, ref transform);
Matrix4x4? transform = Tile.GetTransformationFor(tile);
// tile color
Color color;

View file

@ -251,6 +251,21 @@ namespace Blarg.GameFramework.TileMap
return false;
}
}
public static Matrix4x4? GetTransformationFor(Tile tile)
{
if (!tile.IsRotated)
return null;
switch (tile.Rotation)
{
case 0: return FaceNorthRotation;
case 1: return FaceEastRotation;
case 2: return FaceSouthRotation;
case 3: return FaceWestRotation;
default: return null;
}
}
}
}