public EnemyTracker(GameProps gameProps, int[,] map, IConsole console, HeadPositionReducer headPositionReducer) { _gameProps = gameProps; _console = console; _headPositionReducer = headPositionReducer; map.CloneMap(); _binaryMap = BinaryTrack.FromCartesian(gameProps, map); _currentTrack = BinaryTrack.StartEmptyTrack(gameProps); }
private void OnSurface(SurfaceDetected surfaceDetected) { _console.Debug("Opponent surface detected. Resetting enemy's track keeping the head"); _currentTrack = BinaryTrack.StartEmptyTrack(_gameProps); if (_exactEnemyTrack != null) { _exactEnemyTrack = BinaryTrack.FromAllZeroExcept(_gameProps, new List <(int, int)> { _exactEnemyTrack.Head.Value }, _exactEnemyTrack.Head);
public void OnSilence() { _console.Debug("Opponent silence detected. Resetting enemy's starting position"); _currentTrack = BinaryTrack.StartEmptyTrack(_gameProps); _exactEnemyTrack = null; _headPositionReducer.Handle(new SilenceDetected { LastMoveDirection = _lastMoveMoveDirection }); }