Exemplo n.º 1
0
        /// <summary>
        /// Create map
        /// </summary>
        internal Map(LevelInfoResource setLevelInfo,
                     LevelVisualResource setLevelVisual,
                     LevelPassableResource setLevelPassable)
        {
            OnSelectedEntitiesChanged = null;

            selectedEntities = new List <Entity>();

            TileWidth  = 16;
            TileHeight = 16;

            MapWidth  = 64;
            MapHeight = 64;

            levelInfo     = setLevelInfo;
            levelVisual   = setLevelVisual;
            levelPassable = setLevelPassable;

            mapDiscoverState = new MapDiscover[MapWidth * MapHeight];

            tileSet = MapTileset.GetTileset((int)levelInfo.TilesetResourceIndex);

            Players = new List <BasePlayer>();
            AddPlayers();

            Rnd = new Random();

            Pathfinder = new AStar2D();
        }
Exemplo n.º 2
0
        internal void LoadCampaignLevel(Race race, int level)
        {
            string basenameInfo = race + " " + level;

            LevelInfoResource     levelInfo     = WarFile.GetResourceByName(basenameInfo) as LevelInfoResource;
            LevelPassableResource levelPassable = WarFile.GetResource(levelInfo.PassableResourceIndex) as LevelPassableResource;
            LevelVisualResource   levelVisual   = WarFile.GetResource(levelInfo.VisualResourceIndex) as LevelVisualResource;

            if (InputHandler != null)
            {
                InputHandler.SetMapUnitOrder(MapUnitOrder.None);
            }

            CurrentMap = new Map(levelInfo, levelVisual, levelPassable);
            SetCameraOffset(levelInfo.StartCameraX * CurrentMap.TileWidth, levelInfo.StartCameraY * CurrentMap.TileHeight);

            CurrentMap.OnSelectedEntitiesChanged += HandleOnSelectedEntitiesChanged;
        }