public GetImage ( uint direction, uint zoom, uint worldRotation ) : |
||
direction | uint | The direction the DGRP is facing. |
zoom | uint | Zoom level DGRP is drawn at. |
worldRotation | uint | Current rotation of world. |
return |
public DGRPImage GetImage(uint direction, uint zoom, uint worldRotation)
{
uint rotatedDirection = 0;
/**LeftFront = 0x10,
LeftBack = 0x40,
RightFront = 0x04,
RightBack = 0x01**/
int rotateBits = (int)direction << ((int)worldRotation * 2);
rotatedDirection = (uint)((rotateBits & 255) | (rotateBits >> 8));
foreach(DGRPImage image in Images)
{
if (image.Direction == rotatedDirection && image.Zoom == zoom)
{
return image;
}
}
return null;
}