Esempio n. 1
0
        public void LoadCamp()
        {
            // Load grid
            var sampleMap    = database.Get <string>("player_map_data");
            var gridSettings = new GridSettings()
            {
                type = GridType.ISO, cellSpacing = new FloatVector2(0.5f, 0.7f)
            };
            var grid = mapReader.TILED_ReadGrid(sampleMap, gridSettings);

            gridService.Load(grid);

            // Load grid objects
            var gridObjects = mapReader.TILED_ReadObjects(sampleMap);

            foreach (var gridObject in gridObjects)
            {
                var command = new CommandData();
                command.type   = Constants.COMMAND_SPAWN_OBJ;
                command.output = gridObject.Value;
                command.count  = 1;

                var cell = gridService.GetCell(gridObject.Key.x, gridObject.Key.y);
                commandSystem.Execute(command, cell.position, cell);
            }

            // setup camera
            cameraService.SetBoundary(dataProvider.GetGameConfig().cameraInitPos.ToVector3(), dataProvider.GetGameConfig().cameraBoundaryRadius);
            cameraService.SetZoom(dataProvider.GetGameConfig().cameraInitZoom);
            cameraService.SetPosition(dataProvider.GetGameConfig().cameraInitPos.ToVector3());
        }