Archived
1
0
This repository has been archived on 2025-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
cs-vampi/Spielfeld.cs

39 lines
1006 B
C#

using System;
namespace vampi
{
public class Spielfeld {
private Position pos;
private Spielflaeche sflaeche;
private Spielfigur sfigur = null;
private int[] mx = {-1, 0, 1, 1, 1, 0, -1, -1};
private int[] my = {-1, -1, -1, 0, 1, 1, 1, 0};
public Spielfigur Sfigur {
get { return this.sfigur; }
set { this.sfigur = value; }
}
public Position Pos {
get { return pos; }
}
public Spielfeld(Position pos, Spielflaeche sflaeche) {
this.pos = pos;
this.sflaeche = sflaeche;
}
public Spielfeld getNachbarfeld(int lage) {
return this.sflaeche.getSpielfeld(this.getNachbarpos(lage));
}
private Position getNachbarpos(int lage) {
Position nachbarpos = new Position(this.pos);
nachbarpos.x += mx[lage - 1];
nachbarpos.y += my[lage - 1];
return nachbarpos;
}
}
}