public void ChangeDirection(LookDirection lD, int playerId)
{
Point pos = Point.Zero;
switch (lD)
{
case LookDirection.Up:
pos = new Point(CellPosition.X, CellPosition.Y - 1);
break;
case LookDirection.Down:
pos = new Point(CellPosition.X, CellPosition.Y + 1);
break;
case LookDirection.Left:
pos = new Point(CellPosition.X - 1, CellPosition.Y);
break;
case LookDirection.Right:
pos = new Point(CellPosition.X + 1, CellPosition.Y);
break;
}
if (!CollisionLayer[pos.X, pos.Y])
{
CurrentDirection = lD;
_lastPlayerThatPushIt = playerId;
foreach (Point p in ActionField)
{
HazardMap[p.X, p.Y] = 0;
}
}
else
CurrentDirection = LookDirection.Idle;
}