Esempio n. 1
0
        public LevelEditorScreen() : base()
        {
            editMode = EditMode.Selection;
            MoveTo   = new Vector2(.0f, .0f);
            Offset   = new Vector2(.0f, .0f);
            Scale    = 0.2f;
            createSideMenu();
            //          createGameScreen();
            Level       = new Level();
            LevelVisual = new LevelVisual();
            // useLevel1();
            // createVisualStartupLevel();

            createStartup();
        }
Esempio n. 2
0
        private void createVisualStartupLevel()
        {
            LevelVisual = new LevelVisual();

            var roomV = new Model.GameObjectVisual.RoomVisual()
            {
                Data = new Model.GameObject.Room()
                {
                    Column         = 0,
                    Row            = 1,
                    Position       = new Vector2(Konfiguration.Round(.0f), Konfiguration.Round(.0f)),
                    RelativeBounds = new List <Vector2>()
                    {
                        new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                        new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                        new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                        new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                    },
                    Player = new Model.GameObject.Player()
                    {
                        //InitialPosition = new Vector2(Konfiguration.Round(0.0f), Konfiguration.Round(-0.0f)),
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(-0.05f)),
                            new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(-0.05f)),
                            new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(0.05f)),
                            new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(0.05f))
                        },
                    },
                    Exit = new Exit()
                    {
                        Position       = new Vector2(1.0f, .0f),
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(-0.105f, 0.045f),
                            new Vector2(0.105f, 0.045f),
                            new Vector2(0.105f, -0.045f),
                            new Vector2(-0.105f, -0.045f),
                        },
                    },
                },
            };

            roomV.PlayerVisual = new PlayerVisual()
            {
                Data = ((Model.GameObject.Room)roomV.Data).Player,
            };
            roomV.ExitVisual = new ExitVisual()
            {
                Data = ((Model.GameObject.Room)roomV.Data).Exit
            };

            LevelVisual.Rooms.Add(roomV);

/*
 *          var roomV2 = new Model.GameObjectVisual.RoomVisual()
 *          {
 *              Data = new Model.GameObject.Room()
 *              {
 *                  Position = new Vector2(Konfiguration.Round(2.0f), Konfiguration.Round(.0f)),
 *                  RelativeBounds = new List<Vector2>() {  new Vector2( Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
 *                                                      new Vector2( Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
 *                                                      new Vector2( Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
 *                                                      new Vector2( Konfiguration.Round(.95f), Konfiguration.Round(.95f))
 *                  },
 *                  Player = new Model.GameObject.Player()
 *                  {
 *                      //InitialPosition = new Vector2(Konfiguration.Round(2.0f), Konfiguration.Round(-0.0f)),
 *                      RelativeBounds = new List<Vector2>() { new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(-0.05f)),
 *                                                     new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(-0.05f)),
 *                                                     new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(0.05f)),
 *                                                     new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(0.05f))},
 *                  },
 *
 *              },
 *          };
 *          LevelVisual.Rooms.Add(roomV2);*/

            var _level = Serializer.getLevelAs_Level(Serializer.getLevelVisualAsLevel(LevelVisual));

            _level.CurrentRoom  = _level.Rooms.First();
            _gameGraphics.Level = _level;
            _gameLogic.Level    = _level;
        }