コード例 #1
0
ファイル: Map.cs プロジェクト: ryancheung/WinWar
        /// <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();
        }
コード例 #2
0
        /// <summary>
        /// Load all tilesets
        /// </summary>
        internal static void LoadAllTilesets()
        {
            // TODO: FIXME with new WarFile resource loading strategy

            WarResource     tileset  = ((RawResource)WarFile.GetResourceByName("Barrens 1")).Resource;
            WarResource     tiles    = ((RawResource)WarFile.GetResourceByName("Barrens 2")).Resource;
            PaletteResource tilesPAL = WarFile.GetResourceByName("Barrens 3") as PaletteResource;
            MapTileset      swamp    = new MapTileset(Tileset.Swamp, tileset, tiles, tilesPAL);

            knownTilesets.Add(swamp);

            tileset  = ((RawResource)WarFile.GetResourceByName("Summer 1")).Resource;
            tiles    = ((RawResource)WarFile.GetResourceByName("Summer 2")).Resource;
            tilesPAL = WarFile.GetResourceByName("Summer 3") as PaletteResource;
            MapTileset summer = new MapTileset(Tileset.Summer, tileset, tiles, tilesPAL);

            knownTilesets.Add(summer);

            if (WarFile.IsDemo == false)
            {
                tileset  = ((RawResource)WarFile.GetResourceByName("Dungeon 1")).Resource;
                tiles    = ((RawResource)WarFile.GetResourceByName("Dungeon 2")).Resource;
                tilesPAL = WarFile.GetResourceByName("Dungeon 3") as PaletteResource;
                MapTileset dungeon = new MapTileset(Tileset.Dungeon, tileset, tiles, tilesPAL);
                knownTilesets.Add(dungeon);
            }
        }
コード例 #3
0
ファイル: Map.cs プロジェクト: CAMongrel/WinWar
        /// <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 ();
        }
コード例 #4
0
ファイル: MapTileset.cs プロジェクト: CAMongrel/WinWar
        /// <summary>
        /// Load all tilesets
        /// </summary>
        internal static void LoadAllTilesets()
        {
            // TODO: FIXME with new WarFile resource loading strategy

             WarResource tileset = ((RawResource)WarFile.GetResourceByName("Barrens 1")).Resource;
             WarResource tiles = ((RawResource)WarFile.GetResourceByName("Barrens 2")).Resource;
             PaletteResource tilesPAL = WarFile.GetResourceByName("Barrens 3") as PaletteResource;
             MapTileset swamp = new MapTileset(Tileset.Swamp, tileset, tiles, tilesPAL);
             knownTilesets.Add(swamp);

             tileset = ((RawResource)WarFile.GetResourceByName("Summer 1")).Resource;
             tiles = ((RawResource)WarFile.GetResourceByName("Summer 2")).Resource;
             tilesPAL = WarFile.GetResourceByName("Summer 3") as PaletteResource;
             MapTileset summer = new MapTileset(Tileset.Summer, tileset, tiles, tilesPAL);
             knownTilesets.Add(summer);

             if (WarFile.IsDemo == false)
             {
            tileset = ((RawResource)WarFile.GetResourceByName("Dungeon 1")).Resource;
            tiles = ((RawResource)WarFile.GetResourceByName("Dungeon 2")).Resource;
            tilesPAL = WarFile.GetResourceByName("Dungeon 3") as PaletteResource;
            MapTileset dungeon = new MapTileset(Tileset.Dungeon, tileset, tiles, tilesPAL);
            knownTilesets.Add(dungeon);
             }
        }