public PlayerInfo( MapGeometry map, int currentSectorId, Vector2 position, Vector2 direction, float angle, float radius) : base(map, currentSectorId, position, direction, angle, radius) { }
private void SwitchToMap(int index) { _screenMessage.ShowMessage($"Switching to map index {index}"); var map = _maps[index]; _currentMap = new MapGeometry(map); _playerInfo = PlayerInfo.Create(_currentMap); //RecreateRenderer(); _renderer = new SplitScreenRenderer( CreateRenderer(RendererType.Overhead), CreateRenderer(RendererType.FirstPerson)); }
public static PlayerInfo Create(MapGeometry map) { var playerThing = map.Map.Things.First(t => t.Type == 1); var playerThingIndex = map.Map.Things.IndexOf(playerThing); var position = playerThing.GetPosition(); var angle = MathHelper.ToRadians(playerThing.Angle); var direction = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)); var currentSectorId = map.ThingToSectorId[playerThingIndex]; var verticalPosition = map.Sectors[currentSectorId].Info.HeightFloor; return(new PlayerInfo(map, currentSectorId, position, direction, angle, PlayerRadius)); }