add Tile.GetTransformationFor() overload returning a nullable Matrix4x4
This commit is contained in:
parent
4946006e8d
commit
c48e99127a
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue