private void Interceptor_Moved(MazeExplorer interceptor, MazeLocation location) { if (interceptor.Location == Player.Location) { OnGameOver(); return; } GetCell(location.Column, location.Row).Explorers.Remove(interceptor); GetCell(interceptor.Location.Column, interceptor.Location.Row).Explorers.Add(interceptor); OnCaseCouranteChanged(new MazeCellEventArgs(interceptor, location, interceptor.Location)); }
private void Player_Moved(MazeExplorer interceptor, MazeLocation location) { if (GetCell(Player.Location.Column, Player.Location.Row).Explorers.Any(x => x.ExplorerType == UserType.NPC)) { OnGameOver(); return; } OnCaseCouranteChanged(new MazeCellEventArgs(Player, location, Player.Location)); if (Player.Location.Row == RowCount - 1 && Player.Location.Column == (_isLeft ? ColumnCount - 2 : 1)) { OnEndReached(); return; } }
public MazeCellEventArgs(MazeExplorer explorer, MazeLocation oldLocation, MazeLocation newLocation) { OldLocation = oldLocation; NewLocation = newLocation; Explorer = explorer; }