Bilder der Drachen wrid jetzt mit Modulo berechnet
This commit is contained in:
@@ -21,7 +21,6 @@ namespace WorldOfPeacecraft
|
||||
private Image Walkable;
|
||||
private Image Water;
|
||||
private Image Wall;
|
||||
private Dictionary<int, int> dragonImageMappings = new Dictionary<int, int>();
|
||||
private Random random = new Random ();
|
||||
|
||||
public MapPanel (IBackend backend)
|
||||
@@ -134,12 +133,8 @@ namespace WorldOfPeacecraft
|
||||
IEnumerable<IEntity> players = Backend.GetPlayers ();
|
||||
foreach (IEntity dragon in dragons) {
|
||||
int id = dragon.GetId();
|
||||
if (!dragonImageMappings.ContainsKey(id))
|
||||
{
|
||||
dragonImageMappings[id] = random.Next (3);
|
||||
}
|
||||
Image image;
|
||||
switch (dragonImageMappings[id])
|
||||
switch (Math.Abs(id % 3))
|
||||
{
|
||||
case 0:
|
||||
image = Dragon1;
|
||||
@@ -151,7 +146,7 @@ namespace WorldOfPeacecraft
|
||||
image = Dragon3;
|
||||
break;
|
||||
default:
|
||||
throw new Exception("dragonImageMapping '" + dragonImageMappings[id] + "' doesn't exist");
|
||||
throw new Exception("There is no image for dragon id '" + id + "' (this should never happen)");
|
||||
}
|
||||
PaintImage(g, dragon.GetX() * TileSize, dragon.GetY() * TileSize, image);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user