Exemplo n.º 1
0
 public EditorLevelRenderer(EditorLevel level)
 {
     _level = level;
     _worldRenderer = new EditorWorldRenderer(_level.World);
     _playerRenderer = new EditorPlayerRenderer(_level.World, _level.Player);
     _postProcessRenderer = new PostProcessRenderer(4);
 }
Exemplo n.º 2
0
        public EditorScreen(string levelPath)
        {
            if (!string.IsNullOrEmpty(levelPath))
            {
                _editorFile = new EditorFile(Path.GetDirectoryName(levelPath), Path.GetFileName(levelPath));
                this.LoadLevel(true);
            }
            else
            {
                _editorFile = new EditorFile();

                _level = EditorLevel.Generate();
                _levelRenderer = new EditorLevelRenderer(_level);
                _levelController = new EditorLevelController(_level);
            }
        }
Exemplo n.º 3
0
        private void LoadLevel(bool loadFromFile = true)
        {
            if (_levelRenderer != null)
            {
                _levelRenderer.Unload();
            }

            if (loadFromFile)
            {
                using (BinaryReader reader = new BinaryReader(File.OpenRead(_editorFile.FullPath)))
                {
                    _level = EditorLevel.Load(reader);
                }
            }
            else
            {
                _level = EditorLevel.Generate();
            }

            _levelRenderer = new EditorLevelRenderer(_level);
            _levelController = new EditorLevelController(_level);

            if (base.IsLoaded)
            {
                _levelRenderer.LoadContent();
                this.CreateUi();
            }
        }
Exemplo n.º 4
0
 public EditorLevelController(EditorLevel level)
 {
     _level = level;
     _playerController = new EditorPlayerController(_level.World, _level.Player);
 }