Esempio n. 1
0
        public static BaseLevel Generate(bool correct = true)
        {
            var game = new Game();

            var data = new LevelModel()
            {
                Port = new ShipPortModel()
                {
                    Index = 5,
                    Size = 10
                },
                Tracks = new TrackModel[]
                {
                    new TrackModel()
                    {
                        Type = TrackType.Start,
                        Direction = Direction.East,
                        Position = new Vector(0, 0)
                    },
                    new TrackModel()
                    {
                        Type = TrackType.Default,
                        Direction = Direction.East,
                        Position = new Vector((correct ? 1 : 2), 0)
                    }
                }
            };

            var manager = new LevelManager(game);
            return new BaseLevel(manager, data);
        }
Esempio n. 2
0
        private void Load(LevelModel data)
        {
            if (data == null)
                throw new ArgumentNullException("data");

            _level = new BaseLevel(this, data);
        }
Esempio n. 3
0
        public BaseLevel(LevelManager manager, LevelModel data)
        {
            if(manager == null)
                throw new ArgumentNullException("manager");
            else if (data == null)
                throw new ArgumentNullException("data");

            _manager = manager;
            _metrics = LevelMetrics.Zero;
            _port = new ShipPort(this, data.Port);
            _tracks = TrackFactory.GetInstance().Create(data);
            _carts = new List<BaseCart>();
            _spawner = new Spawner(this);

            Initialize();
        }