public void HandleEvent(IGameObject gameObject, IGameWorld gameWorld, object gameEvent) { if (gameEvent is PlayerKilled) { gameWorld.SendEvent(new GameEnd()); } if (gameEvent is PlayerReachedWinPlatform) { gameWorld.SendEvent(new GameEnd()); } }
public void HandleEvent(IGameObject gameObject, IGameWorld gameWorld, object gameEvent) { if (gameEvent is FireEvent) { var fireEvent = gameEvent as FireEvent; var(fireX, fireY) = _geometryMathService .PointOnBoundary(gameObject, fireEvent.Direction); var fireCommandOptions = new FireCommandOptions(fireX, fireY, fireEvent.Direction); _fireCommand.Do(gameObject, gameWorld, fireCommandOptions); } if (gameEvent is ShellHitEvent) { gameWorld.SendEvent(new PlayerKilled()); } if (gameEvent is MovedEvent) { var movedEvent = gameEvent as MovedEvent; _consoleWriter.SetCameraCenter(movedEvent.NewX, movedEvent.NewY); } }